Skip to content

Instantly share code, notes, and snippets.

View levycarneiro's full-sized avatar

Levy Carneiro Jr. levycarneiro

View GitHub Profile
#!/usr/bin/env ruby
#
# Brute-force way to retrieve all Github's repositories at once
# Usage:
# github_repos.rb clone # will clone all the user's repositories
# github_repos.rb clone test # will just clone 6 repositories for testing purposes
# github_repos.rb pull # will update all of the user's local repositories
#
# If you have forked repositories, the original sources will be added
# as remotes with the default 'forked_from' name, and a new 'forked_from'
# Converting a general MySQL query...
UPDATE `jos_content` SET checked_out = 62, checked_out_time = '2009-11-23 13:09:46' WHERE id = '179'
# ...into a Rails Migration
class Migration20091123001 < ActiveRecord::Migration
def self.up
item = JosContent.find(179)
item.checked_out = 62
item.checked_out_time = '2009-11-23 13:09:46'
item.save!
class Tweet < ActiveRecord::Base
Tweet_identificator = 'protip:'
def self.fetch_new_tweets
Twitter::Search.new.
containing(Tweet_identificator).
not_retweeted.
since(last_id_processed).
fetch
end
describe Tweet do
describe "basic fetching of tweets" do
it "should fetch new tweets from Twitter" do
new_search = mock(Twitter::Search)
search_containing = mock(Twitter::Search)
search_not_retweeted = mock(Twitter::Search)
search_since = mock(Twitter::Search)
last_id_processed = Tweet.stub!(:last_id_processed => 123)
search_since = mock(Twitter::Search)