Skip to content

Instantly share code, notes, and snippets.

View chebyte's full-sized avatar
🤡
smile

maurotorres chebyte

🤡
smile
View GitHub Profile
@chebyte
chebyte / heroku_clonedb.txt
Created November 25, 2011 19:09
clone db from your heroku app
= Heroku CloneDB Plugin
Use this plugin to properly clone a PostgreSQL database from Heroku to localhost. The main difference between this plugin and db:pull is that foreign keys and other db constraints are handled properly.
== Installation
After that, a simple
$ heroku plugins:install [email protected]:chebyte/heroku_clonedb.git
@chebyte
chebyte / heroku_clonedb
Created November 12, 2011 05:16
clone db from your heroku app
= Heroku CloneDB Plugin
Use this plugin to properly clone a PostgreSQL database from Heroku to localhost. The main difference between this plugin and db:pull is that foreign keys and other db constraints are handled properly.
== Installation
After that, a simple
$ heroku plugins:install [email protected]:chebyte/heroku_clonedb.git
@chebyte
chebyte / gist:1154889
Created August 18, 2011 19:13
Guide for configure Tomcat6, Solr 1.4, Sunspot for Rails Application on Ubuntu 8.04 or 10.04

Guide for configure Tomcat6, Solr 1.4, Sunspot for Rails Application on Ubuntu 8.04 or 10.04

1. Install the Java JRE and Ant

for ubuntu 8.04

add the following sources to /etc/apt/sources.list

deb http://us.archive.ubuntu.com/ubuntu/ hardy multiverse
deb-src http://us.archive.ubuntu.com/ubuntu/ hardy multiverse
deb http://us.archive.ubuntu.com/ubuntu/ hardy-updates multiverse

@chebyte
chebyte / sunspot_cell.rb
Created August 13, 2011 16:30
index file contents like pdf, html, doc, etc.. using solr, sunspot gem, paperclip, s3 and Rails 3
= Sunspot Cell
This plugin adds Cell support (for indexing rich documents like pdf, docs, html, etc...) to Sunspot (developed against Sunspot 1.2.1).
Support Paperclip and S3 Storage
The code is based on the patch included here:
http://outoftime.lighthouseapp.com/projects/20339/tickets/98-solr-cell
== Requirements
@chebyte
chebyte / get_url_title_jquery.js
Created August 5, 2011 14:40
get url title with jquery and yql
$('#other').change(function(){
var url = $(this).val();
var yql_url = "http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20html%20where%20url%3D%22" + encodeURIComponent(url) + "%22%20and%0A%20%20%20%20%20%20xpath%3D'%2F%2Ftitle'&format=json&callback=?";
$.getJSON(yql_url, function(json) {
if (json && json.query && json.query.results && json.query.results.title) {
alert(json.query.results.title);
}
});
});
@chebyte
chebyte / views_couchdb.txt
Created July 22, 2011 01:07
many views in one design document on couchdb
{
"_id": "_design/articles",
"language": "javascript",
"views": {
"all": {
"map": "function(doc) { if(doc.type == 'article') { emit(null, doc); } }"
},
"by_author_id": {
"map": "function(doc) { if(doc.type == 'article') { emit([doc.author_id], doc); } }"
},
@chebyte
chebyte / generate_valid_token.rb
Created July 7, 2011 12:39
generate valid token for youtube
require 'rubygems'
require 'oauth'
KEY = "key"
SECRET = "secrect"
consumer = OAuth::Consumer.new(KEY, SECRET, {
:site=>"https://www.google.com",
:request_token_path=>"/accounts/OAuthGetRequestToken",
:authorize_path=>"/accounts/OAuthAuthorizeToken",
@chebyte
chebyte / upload_youtube_it.rb
Created June 28, 2011 13:24
upload video with youtube_it from web
#application_controller.rb
class ApplicationController < ActionController::Base
helper_method :yt_client
private
def yt_client
@yt_client ||= YouTubeIt::Client.new(:username => user, :password => password, :dev_key => dev_key)
#you can use the auth method that you want.
end
end
@chebyte
chebyte / sinatra_cucumber_rspec2
Created June 13, 2011 14:59
sinatra template cucumber rspec 2
#https://github.com/chebyte/sinatra-cucumber-rspec-2-template
== Rspec 2 ==
#ruby spec/example_spec.rb
.
Finished in 0.06865 seconds
1 example, 0 failures
@chebyte
chebyte / reorderable
Created June 13, 2011 01:01
plugin for reorder item with rails 3 and jquery
# Reorderable
Allows drag-n-drop reordering of ActiveRecord model items when using MySQL and jQuery.
## Installation
Add the following to your Gemfile:
gem 'reorderable', :git => "git://github.com/chebyte/reorderable.git"