Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View andion's full-sized avatar
🐶

Lucas Andión Montáns andion

🐶
View GitHub Profile
@andion
andion / sample_slides.md
Last active August 29, 2015 14:14
Slide-pack-me test

--

SlidePack

A really simple slides generator & viewer

--

Simple

@andion
andion / slides.md
Created February 4, 2015 13:01
Sample SlidePack Slides

--

SlidePack

A really simple slides generator & viewer

--

Simple

# 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'
@andion
andion / model from string.rb
Created January 21, 2009 17:53
ontaining a model from a string
#Obtaining a model from a string
@model.constantize.find(:all)
# or
@item.send(@relationship)
@andion
andion / object_roles_table.rb
Created February 11, 2009 16:29
from rails authorization plugin
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