Skip to content

Instantly share code, notes, and snippets.

View chebyte's full-sized avatar
🤡
smile

maurotorres chebyte

🤡
smile
View GitHub Profile
@chebyte
chebyte / mongoid-simple-tags
Created June 13, 2011 00:55
mongoid tag system
= mongoid-simple-tags
mongoid-simple-tags is a basic and simple tagging system for mongoid using map-reduce function
== Install
Add the following to Gemfile:
gem "mongoid-simple-tags"
== Usage
@chebyte
chebyte / yql_ruby_1.9.rb
Created April 22, 2011 22:09
yql api for tuby 1.9
require 'net/http'
require 'hpricot'
require 'cgi'
require 'uri'
require 'cgi'
require 'openssl'
require 'base64'
module Chebyte
class OauthUtil
@chebyte
chebyte / authlogic_to_devise.rb
Created February 1, 2011 02:37
migration for authlogic to devise
rename_column :users, :crypted_password, :encrypted_password
add_column :users, :confirmation_token, :string, :limit => 255
add_column :users, :confirmed_at, :timestamp
add_column :users, :confirmation_sent_at, :timestamp
execute "UPDATE users SET confirmed_at = created_at, confirmation_sent_at = created_at"
add_column :users, :reset_password_token, :string, :limit => 255
add_column :users, :remember_token, :string, :limit => 255
add_column :users, :remember_created_at, :timestamp
@chebyte
chebyte / youtube_it_authsub.rb
Created November 27, 2010 00:18
support for authsub on youtube_it gem
require 'rubygems'
require 'youtube_it'
#first get the token user in this link
https://www.google.com/accounts/AuthSubRequest?
next=callback url
&scope=http%3A%2F%2Fgdata.youtube.com
&session=1
&secure=0
@chebyte
chebyte / delayed_job.rb
Created November 25, 2010 20:23
script for run delayed_job in background
#!/usr/bin/env ruby
require 'rubygems'
require 'daemon-spawn'
RAILS_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
class DelayedJobWorker < DaemonSpawn::Base
def start(args)
ENV['RAILS_ENV'] ||= args.first || 'development'
@chebyte
chebyte / youtube_it.rb
Created November 25, 2010 14:14
things that you can do with youtube_it gem
require 'rubygems'
require 'youtube_it'
KEY = "consumer key"
SECRET = "consumer secret"
#with oauth
client = YouTubeIt::OAuthClient.new(:consumer_key => KEY, :consumer_secret => SECRET, :dev_key => "devkey")
client.authorize_from_access("user_token","user_token_secret")
####lib####
require 'net/http'
require 'hpricot'
require 'cgi'
require 'uri'
require 'cgi'
require 'openssl'
require 'base64'
module Chebyte
== DB ROCKET
A simple database agnostic import/export app to transfer data to/from a remote database from Ruby on Rails APP based on TAPS.
== Usage: Server
The first thing that you need is create yaml configuration for add the data for access to the server, so into your app rails run:
# db_rocket create
require 'yaml'
namespace :app do
RE_COLOR_RGB = Regexp.new('(rgb[\s]*\([\s-]*[\d]+(\.[\d]+)?[%\s]*,[\s-]*[\d]+(\.[\d]+)?[%\s]*,[\s-]*[\d]+(\.[\d]+)?[%\s]*\))', Regexp::IGNORECASE)
RE_COLOR_HEX = /(#([0-9a-f]{6}|[0-9a-f]{3})([\s;]|$))/i
RE_COLOR_NAMED = /([\s]*^)?(aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|purple|red|silver|teal|white|yellow|transparent)([\s]*$)?/i
RE_COLOR = Regexp.union(RE_COLOR_RGB, RE_COLOR_HEX, RE_COLOR_NAMED)
@results = []
== Installation
If you haven't already, install Hone's herocutter plugin:
$ heroku plugins:install git://github.com/hone/heroku_herocutter.git
After that, a simple
$ heroku plugins:install jammit