This file contains 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 'json' | |
require 'open-uri' | |
require 'nokogiri' | |
require 'byebug' | |
require 'logger' | |
# OPTIONS # | |
# In Seconds | |
INTERVAL = 5 |
This file contains 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
# Resolves an arbitrary number of promises in order. Returns the last promise | |
# unresolved (or an empty promise if there were none) for chainability. | |
serialResolver = (promises) -> | |
promise = promises.shift() | |
switch | |
# Promise array was empty to begin with. | |
when promise is undefined | |
$q.when() | |
# For the last promise in the array, return it for chainability. |
This file contains 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
module MyApp | |
class Application | |
console do | |
Rails::ConsoleMethods.send :include, ConsoleAddons | |
end | |
end | |
end | |
module ConsoleAddons | |
def clattrs(model) |
This file contains 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 'benchmark' | |
require 'securerandom' | |
require 'ostruct' | |
cids = {} | |
class Object | |
def deep_copy | |
Marshal.load(Marshal.dump(self)) | |
end |
This file contains 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
#!/usr/bin/env ruby | |
require 'active_support' | |
require 'active_support/inflector' | |
file = File.open('output.txt', 'w+') | |
ARGF.readlines.each do |line| | |
file << line.titleize | |
end |
This file contains 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 'optparse' | |
module TabsToSpaces | |
def self.start(args, options) | |
@options = options | |
display_options_and_args(args) | |
process(args.first) | |
end |