Skip to content

Instantly share code, notes, and snippets.

View urubatan's full-sized avatar

Rodrigo Urubatan Ferreira Jardim urubatan

View GitHub Profile
function scoreboard(initial) {
if(Object.keys(initial).length < 2){
throw new Exception('you need at least two players')
}
stored = {}
for (x in initial){
var v = parseInt(initial[x])
if(v.isNa)N
stored[x.toLowerCase()] =
}

Keybase proof

I hereby claim:

  • I am urubatan on github.
  • I am urubatan (https://keybase.io/urubatan) on keybase.
  • I have a public key ASCYEc1gNsfKiYuLhmiRxM2jES9sI84zpnfQsBVFSAdf7go

To claim this, I am signing this object:

#!/usr/bin/env ruby
require 'koala' # gem install koala --no-ri --no-rdoc
# create a facebook app and get access token from here
# https://developers.facebook.com/tools/explorer
# select "groups", "photos" when authenticating
oauth_access_token = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
group_filtering_words = ['ruby']
image_path = 'image.png' #change to your image path
message = 'My Cool image.' # your message
@urubatan
urubatan / remove_dups.rb
Created May 24, 2012 14:42
Ruby script to remove duplicated files, I created it when migrating my pictures collection from iPhoto to picasa, and merged some independent collections, it created a real mess, and the result of this big mess is this gist.
require 'digest/sha1'
require 'fileutils'
directories = [
"SOURCE DIR 1",
"SOURCE DIR 2"
]
files = {}
directories.each do |dir_name|
puts "Scanning Directory: #{dir_name} "
Dir.glob("#{dir_name}/**/*.*") do |file_name|
@urubatan
urubatan / gist:1224723
Created September 18, 2011 04:16
VIM function to save the selected range to a file and replace the contents with a pointer to the file. Goot to be used with http://github.com/urubatan/codemerger
function! ExtractText(fileName,first_line,last_line)
let text = getline(a:first_line,a:last_line)
execute ":" . a:first_line . "," . a:last_line . "delete"
execute "normal O{{" . a:fileName . "}}"
return writefile(text, a:fileName)
endfunction
command! -range -nargs=1 Es call ExtractText(<f-args>,<line1>,<line2>)
class <%= controller_class_name %>Controller < ApplicationController
respond_to :html, :xml, :js
<% unless options[:singleton] -%>
# GET /<%= table_name %>
# GET /<%= table_name %>.xml
def index
@<%= table_name %> = <%= orm_class.all(class_name) %>
respond_with @<%= table_name %>
end
<% end -%>
class TestaosController < ApplicationController
respond_to :html, :xml, :js
# GET /testaos
# GET /testaos.xml
def index
@testaos = Testao.all
respond_with @testaos
end
# GET /testaos/1
namespace :templates do
desc "Copy all the templates from rails to the application directory for customization"
task :copy do
require 'rubygems'
require 'rubygems/gem_runner'
require 'fileutils'
railties = (version = ENV['VERSION']) ?
Gem.cache.find_name('railties', "= #{version}").first :
Gem.cache.find_name('railties').sort_by { |g| g.version }.last
base_path = railties.full_gem_path