This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| new_file_path = "path/to/subtitle_fixed_file.txt" | |
| File.truncate(new_file_path, 0) | |
| new_file = File.open(new_file_path, "w") | |
| file = File.open("path/to/subtitle_file.txt", "r").readlines.each do |line| | |
| reg = /;(\d{2}) \d{2};/ | |
| match = line.match(reg) | |
| if match.class == MatchData | |
| m = match[1] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # spec/pickle/adapter.rb | |
| module Pickle | |
| class Adapter | |
| class MongoMapper < Adapter | |
| def self.factories | |
| factories = [] | |
| model_classes.each do |klass| |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'rubygems' | |
| require 'flatbed' | |
| ROOT_DIR = File.dirname(__FILE__) + "/.." | |
| IMAGE_DIR = File.expand_path(File.join(ROOT_DIR,"pngs")) | |
| CLIP_DIR = File.expand_path(File.join(ROOT_DIR,"clips")) | |
| FileUtils.mkdir_p(CLIP_DIR) | |
| still_clips = { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| no such file to load -- grip/url_helper |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Given I am on create account | |
| ... | |
| When I attach the file "features/support/assets/test_profile_image.jpg" to "user[image]" | |
| When I press "Save Changes" | |
| Then my account should be created | |
| And the "last" "User" should have a "image" attachment | |
| ... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Post | |
| include MongoMapper::Document | |
| timestamps! | |
| end | |
| # rake task | |
| namespace :tumblr do |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'test_helper' | |
| class CardinalizeTest < Test::Unit::TestCase | |
| def test_a_floats_cardinality | |
| assert_equal 10.0.cardinalize, "North" | |
| assert_equal 310.5.cardinalize, "Northwest" | |
| assert_equal 175.2.cardinalize, "South" | |
| assert_equal 40.0.cardinalize, "Northeast" | |
| assert_equal -40.0.cardinalize, "Northwest" | |
| assert_equal 600.5.cardinalize, "Southwest" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'rubygems' | |
| require 'oauth' | |
| require 'oauth/consumer' | |
| require 'ruby-debug' | |
| require 'json' | |
| API_KEY = "#####" | |
| API_KEY_PRIVATE = "####" | |
| USERNAME = "####" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'csv' | |
| file = "db/commission_junction/2087028_18584_20080827.csv" | |
| rows = CSV::Reader.parse(File.open(file)).to_a | |
| cols = rows.shift | |
| collection = rows.collect do |row| | |
| Hash[*cols.zip(row).flatten] | |
| end | |
| puts collection.first.inspect |