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
.DS_Store | |
myapp/ |
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 'net/http' | |
class Object | |
def method_missing(methId) | |
suggestion = Net::HTTP.get('search.yahooapis.com', "/WebSearchService/V1/spellingSuggestion?appid=YahooDemo&query=#{methId.to_s}") | |
method = /<Result>(.*)<\/Result>/.match(suggestion) | |
if method | |
puts "#{method[1]} bloody bastard, is ****#{method[1].upcase}****, not #{methId}... read the fucking docs!!!" | |
self.send method[1] | |
else | |
puts "what the hell '#{methId}' is bloody bastard?... read the fucking docs!!!" |
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 'faker' | |
require 'colored' | |
class Object | |
def tap | |
yield self | |
self | |
end | |
end | |
class Percentage |
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
setup do | |
@margie = Factory(:user, :login => 'm.thatcher') | |
@jaiku = Factory(:jaiku, :content => "To solve Britain’s economic Disease with Socialism is like treating leukaemia with leeches.", :user => @margie) | |
@activity = @jaiku.activities.first | |
end | |
should 'link the activities created on a model with the user that is generating the activity' do | |
assert_equal @margie, @activity.user, "The activity should be registered as made by the user that create the jaiku" | |
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
// | |
// copied from: http://www.tek-tips.com/viewthread.cfm?qid=1465395&page=5 | |
// TODO: reference original author... | |
// | |
function copy(rubyurl) { | |
var flashcopier = 'flashcopier'; | |
if(!document.getElementById(flashcopier)) { | |
var divholder = document.createElement('div'); | |
divholder.id = flashcopier; | |
document.body.appendChild(divholder); |
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
// | |
// copied from: http://www.tek-tips.com/viewthread.cfm?qid=1465395&page=5 | |
// TODO: reference original author... | |
// | |
function copy(rubyurl) { | |
var flashcopier = 'flashcopier'; | |
if(!document.getElementById(flashcopier)) { | |
var divholder = document.createElement('div'); | |
divholder.id = flashcopier; | |
document.body.appendChild(divholder); |
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 'rubygems' | |
require 'hpricot' | |
require 'open-uri' | |
# el de Ara t. Howard no el de facets. | |
require 'openobject' | |
def scrap(element, id) | |
img = element.search("/img").first | |
paragraph = element.search("/p").first |
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 'rubygems' | |
require 'tools' | |
require 'tog' | |
require 'plugins' | |
def with_migration_tpl_file(tpl_file) | |
File.open(tpl_file, 'w') {|file| | |
file.write <<-eos | |
class CreateComments < ActiveRecord::Migration |
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 'rubygems' | |
# the "jnunemaker-twitter" gem | |
require 'twitter' | |
#client = get_auth_client | |
# todo Store the last tweet | |
since_tw = 0 | |
results = Twitter::Search.new("#euruko").per_page(100).since(since_tw) |
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
sentinel = 'Rails::Initializer.run do |config|' | |
gsub_file 'config/environment.rb', /(#{Regexp.escape(sentinel)})/mi do |match| | |
"\nrequire 'desert'\n#{match}" | |
end | |
def gsub_file(path, regexp, *args, &block) | |
content = File.read(path).gsub(regexp, *args, &block) | |
File.open(path, 'wb') { |file| file.write(content) } | |
end |
OlderNewer