--
--
# Localization-with-gettext-plugin setup | |
LocalizationWithGettext.config.supported_languages = %w(gl es) | |
LocalizationWithGettext.config.default_language = 'gl' | |
# Date format extensions | |
ActiveSupport::CoreExtensions::Time::Conversions::DATE_FORMATS.merge!( | |
:default => '%d/%b/%Y %H:%M', | |
:compact => '%d/%b/%Y', | |
:weekday => '%A' , | |
:monthname => '%B' |
#Obtaining a model from a string | |
@model.constantize.find(:all) | |
# or | |
@item.send(@relationship) | |
require File.dirname(__FILE__) + '/exceptions' | |
require File.dirname(__FILE__) + '/identity' | |
module Authorization | |
module ObjectRolesTable | |
module UserExtensions | |
def self.included( recipient ) | |
recipient.extend( ClassMethods ) | |
end |
int main(int arg_count,char ** arg_values) | |
{ | |
printf("Hello World\n"); | |
return 0; | |
} |
# ruby search_twitter.rb <username> <search string> | |
require 'rubygems' | |
require 'twitter' | |
Twitter::Search.new(ARGV[1]).from(ARGV[0]).each { |r| puts '--------------------------------', r.text } |
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 |
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) |
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 |