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
rvm --trace package install readline | |
--trace package install readline | |
rvm 0.1.23 by Wayne E. Seguin ([email protected]) [http://rvm.beginrescueend.com/] | |
+ [[ -z '' ]] | |
+ [[ ! -z '' ]] | |
+ [[ ! -z '' ]] | |
+ [[ ! -z '' ]] | |
+ [[ 3 -gt 0 ]] |
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
This example shows how to setup an environment running Rails 3 beta under 1.9.1 with a 'rails3' gem set. | |
∴ rvm update --head | |
# ((Open a new shell)) | |
# If you do not already have the ruby interpreter installed, install it: | |
∴ rvm install 1.9.1 | |
# Switch to 1.9.1 | |
∴ rvm 1.9.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
# Testing gistr | |
# http://github.com/blog/137-gist-on-your-tumblr |
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
module Twitter | |
class Search | |
def fetch(force=false) | |
if @fetch.nil? || force | |
query = @query.dup | |
query[:q] = query[:q].join(' ') | |
query[:format] = 'json' #This line is the hack and whole reason we're monkey-patching at all. | |
response = self.class.get('http://search.twitter.com/search', :query => query, :format => :json) | |
@fetch = Mash.new(response) | |
end |
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
def self.posts_and_comments_per_month_graph(number_of_months = 3) | |
require 'gruff' | |
g = Gruff::Line.new #Define a New Graph | |
g.title = "Recent posts and comments per month" #Title for the Graph | |
current = Time.current | |
posts_data = [] | |
comments_data = [] | |
labels_data = {} | |
number_of_months.downto(0) do |t| | |
month = current.months_ago(t) |
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 LifeController < ApplicationController | |
require 'rubygems' | |
require 'twitter' | |
layout 'life' | |
def show | |
@twitts = [] | |
@my_twitts = [] | |
Twitter::Search.new('bugyou').per_page(3).each do |r| | |
@twitts << r | |
end |
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
# ruby search_twitter.rb <username> <search string> | |
require 'rubygems' | |
require 'twitter' | |
Twitter::Search.new(ARGV[1]).from(ARGV[0]).each { |r| puts '--------------------------------', r.text } |
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
int main(int arg_count,char ** arg_values) | |
{ | |
printf("Hello World\n"); | |
return 0; | |
} |
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 File.dirname(__FILE__) + '/exceptions' | |
require File.dirname(__FILE__) + '/identity' | |
module Authorization | |
module ObjectRolesTable | |
module UserExtensions | |
def self.included( recipient ) | |
recipient.extend( ClassMethods ) | |
end |
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
#Obtaining a model from a string | |
@model.constantize.find(:all) | |
# or | |
@item.send(@relationship) | |