This file contains 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
// FacebookSDK | |
// https://developers.facebook.com/docs/plugins/page-plugin/ | |
(function(d, s, id) { | |
var js, fjs = d.getElementsByTagName(s)[0]; | |
if (d.getElementById(id)) return; | |
js = d.createElement(s); | |
js.id = id; | |
js.src = "//connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.8"; | |
fjs.parentNode.insertBefore(js, fjs); | |
}(document, 'script', 'facebook-jssdk')); // Replace 'facebook-jssdk' with your page id. |
This file contains 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
namespace :redis do | |
desc "start sync redis databases to local" | |
task :start => :environment do | |
uri = URI.parse REDISTOGO_URL | |
redis = Net::Telnet::new("Host" => "localhost", "Port" => 6379, "Prompt" => /\z/n) | |
redis.cmd("CONFIG SET MASTERAUTH #{uri.password}") | |
redis.cmd("SLAVEOF #{uri.host} #{uri.port}") | |
redis.close | |
end |
This file contains 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
Surround these with : e.g. :calling: | |
+1 | |
-1 | |
bulb | |
calling | |
clap | |
cop | |
feet |
This file contains 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
namespace :delayed_job do | |
desc "Start delayed_job process" | |
task :start, :roles => :app do | |
run "cd #{current_path}; RAILS_ENV=production script/delayed_job start" | |
end | |
desc "Stop delayed_job process" | |
task :stop, :roles => :app do | |
run "cd #{current_path}; RAILS_ENV=production script/delayed_job stop" | |
end |
This file contains 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
namespace :open_directory do | |
# http://www.google.com/Top/ | |
# http://rdf.dmoz.org/rdf/structure.rdf.u8.gz | |
desc "tasks that deal with Google Open Directory importing" | |
task :import => :environment do | |
seeds = [] | |
Category.delete_all |
This file contains 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 Telephone | |
module Push | |
class Config | |
class FileNotFoundException < StandardError;end | |
class MissingKeyException < StandardError;end | |
attr_accessor :params |
This file contains 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 render(opts = {}, extra_options = {}, &block) | |
if opts[:to_yaml] then | |
headers["Content-Type"] = "text/plain;" | |
render :text => Hash.from_xml(render_to_string(:template => opts[:to_yaml], :layout => false)).to_yaml, :layout => false | |
elsif opts[:to_json] then | |
# headers["Content-Type"] = "text/javascript;" | |
render :json => Hash.from_xml(render_to_string(:template => opts[:to_json], :layout => false)).to_json, :layout => false | |
else | |
super opts, extra_options, &block | |
end |
This file contains 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
#!/bin/sh | |
cat gem_list | sed -n '4,$ p' | \ | |
while read gem versions; do | |
for version in $(echo ${versions} | sed "s/[(),]//g"); do | |
echo ${gem} ${version} | |
gem install --no-rdoc --no-ri ${gem} -v ${version} | |
done | |
done |
This file contains 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
REGIOES_BRASILEIRAS = { | |
'Norte' => [ | |
['Acre', 'AC'], | |
['Amapá','AP'], | |
['Amazonas', 'AM'], | |
['Pará', 'PA'], | |
['Rondônia', 'RO'], | |
['Roraima', 'RR'], | |
['Tocantins', 'TO'] | |
], |
This file contains 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
# Lo-fi client for the Facebook API. E.g.: | |
# | |
# fb = FacebookClient.new(:api_key => 'api-key', :secret => 'secret') | |
# fb.call 'users.getInfo', :session_key => 'session-key', :uids => 'user-id', :fields => 'birthday' | |
# | |
class FacebookClient | |
def initialize(default_params={}) | |
@default_params = default_params.reverse_merge({ | |
:rest_server => 'http://api.new.facebook.com/restserver.php', | |
:format => 'JSON', |