Skip to content

Instantly share code, notes, and snippets.

View kivanio's full-sized avatar
🏠
Working from home

Kivanio Barbosa kivanio

🏠
Working from home
View GitHub Profile
# José Valim <jose.valim@gmail.com>
# http://josevalim.blogspot.com/
# http://www.pagestacker.com/
module RenderSiblingHelper
# What?
#
# Since render_component was deprecated in Rails 2.2, this helper is a
# lightweight implementation of "components", being used in Pagestacker.
#
@kivanio
kivanio / gist:52809
Created January 26, 2009 13:10 — forked from peterc/gist:33337
# SUPER DARING APP TEMPLATE 1.0
# By Peter Cooper
# Link to local copy of edge rails
inside('vendor') { run 'ln -s ~/dev/rails/rails rails' }
# Delete unnecessary files
run "rm README"
run "rm public/index.html"
run "rm public/favicon.ico"
#!/usr/bin/env macruby
# From: http://www.stompy.org/2008/08/14/xcode-and-git-another-build-script/
# Expanded from here: http://www.furmanek.net/36/using-macruby-to-set-xcode-project-version-from-git/
# Xcode auto-versioning script for Subversion by Axel Andersson
# Updated for git by Marcus S. Zarra and Matt Long
# Converted to ruby by Abizern
# Converted to MacRuby by Gregory Furmanek
# Merged with MacRuby version by elliottcable
# Appends the git sha to the version number set in Xcode.
@kivanio
kivanio / gist:58062
Created February 4, 2009 11:28 — forked from pauldix/gist:57285
require 'feedzirra'
# fetching a single feed
feed = Feedzirra::Feed.fetch_and_parse("http://feeds.feedburner.com/PaulDixExplainsNothing")
# feed and entries accessors
feed.title # => "Paul Dix Explains Nothing"
feed.url # => "http://www.pauldix.net"
feed.feed_url # => "http://feeds.feedburner.com/PaulDixExplainsNothing"
feed.etag # => "GunxqnEP4NeYhrqq9TyVKTuDnh0"
# Kivanio Barbosa
# Class to remove or install gems
class Phoda
attr_accessor :command
attr_accessor :file
attr_accessor :sudo
def initialize(command,file,sudo=false)
raise "Need some existent File." unless File.exist?(file)
@file = file
#!/usr/bin/env ruby
# Execute the git, gem, or rake command, depending on the second argument
case ARGV.first
when /^(add|bisect|branch|checkout|clone|commit|diff|fetch|grep|init|log|merge|mv|pull|push|rebase|reset|rm|show|status|tag)$/
system "git #{ARGV.join(' ')}"
when /^(build|cert|check|cleanup|contents|dependency|environment|fetch|generate_index|help|install|list|lock|mirror|outdated|pristine|query|rdoc|search|server|sources|specification|stale|uninstall|unpack|update|which)$/
system "gem #{ARGV.join(' ')}"
else
@kivanio
kivanio / Result
Created August 21, 2009 12:01 — forked from flavorjones/Result
XML Document parsing benchmark
user system total real
hpricot:xml:doc 10.160000 0.950000 11.110000 ( 11.144462)
hpricot2:xml:doc 0.950000 0.000000 0.950000 ( 0.953266)
nokogiri:compat:doc 0.220000 0.020000 0.240000 ( 0.238401)
nokogiri:xml:doc 0.170000 0.030000 0.200000 ( 0.200283)
XML XPath benchmarks (//status/text, //user/name)
user system total real
hpricot:xml:xpath 7.580000 1.150000 8.730000 ( 8.728314)
class Object
def send_through(object, *args)
object.dispatcher_for(self).call(self, *args)
end
end
module Dispatcher
class DispatcherNotFound < StandardError; end
def self.extended(klass)
@kivanio
kivanio / cruise.rake
Created September 8, 2009 12:36 — forked from bmabey/cruise.rake
# This assumes you have the metric_fu and kablame plugins installed.
# For kablame I like to modify it to include your stories or features dir as well as the specs.
# Set the artifacts dir for development
ENV['CC_BUILD_ARTIFACTS'] ||= File.expand_path("#{RAILS_ROOT}/metrics")
rspec_base = File.expand_path("#{RAILS_ROOT}/vendor/plugins/rspec/lib")
$LOAD_PATH.unshift(rspec_base) if File.exist?(rspec_base)
require 'spec/rake/spectask'
require 'spec/rake/verify_rcov'
http://www.sinatrarb.com/wild.html
http://www.sinatrarb.com/extensions-wild.html
http://www.irclogger.com
http://followcost.com
http://moourl.com
http://whoisbigger.sobrerailes.com
http://integrityapp.com
http://github.com/adamwiggins/scanty/tree/master
http://github.com/atmos/hancock/tree/master
http://github.com/cschneid/irclogger/tree/master