Skip to content

Instantly share code, notes, and snippets.

View rafaelfranca's full-sized avatar
🚆
Focused on Rails

Rafael Mendonça França rafaelfranca

🚆
Focused on Rails
View GitHub Profile
@burke
burke / 0-readme.md
Created January 27, 2012 13:44 — forked from funny-falcon/cumulative_performance.patch
ruby-1.9.3-p327 cumulative performance patch for rbenv

ruby-1.9.3-p327 cumulative performance patch for rbenv

This installs a patched ruby 1.9.3-p327 with various performance improvements and a backported COW-friendly GC, all courtesy of funny-falcon.

Requirements

You will also need a C Compiler. If you're on Linux, you probably already have one or know how to install one. On OS X, you should install XCode, and brew install autoconf using homebrew.

class ActionDispatch::Routing::Mapper
def draw(routes_name)
instance_eval(File.read(Rails.root.join("config/routes/#{routes_name}.rb")))
end
end
BCX::Application.routes.draw do
draw :api
draw :account
draw :session
@mxcl
mxcl / uninstall_homebrew.sh
Created August 26, 2011 11:25
Uninstall Homebrew
#!/bin/sh
# Just copy and paste the lines below (all at once, it won't work line by line!)
# MAKE SURE YOU ARE HAPPY WITH WHAT IT DOES FIRST! THERE IS NO WARRANTY!
function abort {
echo "$1"
exit 1
}
set -e
@funny-falcon
funny-falcon / cumulative_performance.patch
Created January 22, 2012 19:19
ruby-1.9.3-p0 cumulative performance patch.
diff --git a/common.mk b/common.mk
index ea244cc..4f22609 100644
--- a/common.mk
+++ b/common.mk
@@ -629,7 +629,8 @@ file.$(OBJEXT): {$(VPATH)}file.c $(RUBY_H_INCLUDES) {$(VPATH)}io.h \
gc.$(OBJEXT): {$(VPATH)}gc.c $(RUBY_H_INCLUDES) {$(VPATH)}re.h \
{$(VPATH)}regex.h $(ENCODING_H_INCLUDES) $(VM_CORE_H_INCLUDES) \
{$(VPATH)}gc.h {$(VPATH)}io.h {$(VPATH)}eval_intern.h {$(VPATH)}util.h \
- {$(VPATH)}debug.h {$(VPATH)}internal.h {$(VPATH)}constant.h
+ {$(VPATH)}debug.h {$(VPATH)}internal.h {$(VPATH)}constant.h \
@SlexAxton
SlexAxton / .zshrc
Last active April 25, 2023 03:57
My gif workflow
gifify() {
if [[ -n "$1" ]]; then
if [[ $2 == '--good' ]]; then
ffmpeg -i $1 -r 10 -vcodec png out-static-%05d.png
time convert -verbose +dither -layers Optimize -resize 600x600\> out-static*.png GIF:- | gifsicle --colors 128 --delay=5 --loop --optimize=3 --multifile - > $1.gif
rm out-static*.png
else
ffmpeg -i $1 -s 600x400 -pix_fmt rgb24 -r 10 -f gif - | gifsicle --optimize=3 --delay=3 > $1.gif
fi
else
@rondy
rondy / gist:2256526
Created March 30, 2012 22:32
Prompt branch name to deploy on Capistrano (OOP way)
namespace :deploy do
task :set_branch do
set :branch, prompt_branch_name
end
before "deploy:update" , "deploy:set_branch"
end
def prompt_branch_name
BranchedDeploy.new.prompt
end
@fnando
fnando / rubygems_proxy.rb
Created April 28, 2011 22:54
Rack app for caching RubyGems files. Very useful in our build server that sometimes fails due to our network or rubygems.org timeout.
# Moved to its own repo: http://github.com/fnando/rubygems_proxy
@kneath
kneath / _README.md
Created November 18, 2009 21:42 — forked from defunkt/bundle.rake
Intelligent asset bundling for Rails (GitHub's asset bundling)

GitHub Javascript Strategy

Unless otherwise necessary (such as mobile development), the GitHub javascript codebase is based off jQuery. You can safely assume it will be included on every page.

File naming

  • All jquery plugins should be prefixed with jquery, such as jquery.facebox
  • All github-specific jquery plugins should be prefixed with jquery.github. Like jquery.github.repo_list.js
  • All page-specific files (that only run on ONE page) should be prefixed with page. page.billing.js
@apotonick
apotonick / pure_ruby.rb
Created May 7, 2012 06:01
Cells in Sinatra, Webmachine, Love
require 'cell/base'
class FakeRoutes # should be sinatra's url helper instance
def url_for(*)
end
def named_routes # required due to a fucking stupid line in AbstractController::UrlFor#25 (3.2.3)
# super - _routes.named_routes.helper_names
Object.new.instance_eval do
@lucasmazza
lucasmazza / documentup.sh
Created February 2, 2012 23:52
Using documentup with a local README.
# gem install bcat
curl -X POST --data-urlencode content@README.md http://documentup.com/compiled | bcat