Skip to content

Instantly share code, notes, and snippets.

View rafaelss's full-sized avatar

Rafael Souza rafaelss

View GitHub Profile
~$ ARCHFLAGS='-arch i386 -arch x86_64'
~$ rvm install 1.8.7 --debug --reconfigure -C --enable-shared=yes
~$ wget http://sourceforge.net/projects/rubycocoa/files/RubyCocoa/1.0.0/RubyCocoa-1.0.0.tar.gz/download
~$ tar xzf RubyCocoa-1.0.0.tar.gz && rm RubyCocoa-1.0.0.tar.gz && cd RubyCocoa-1.0.0
~/RubyCocoa-1.0.0$ ruby install.rb config --build-universal=yes
~/RubyCocoa-1.0.0$ ruby install.rb setup
~/RubyCocoa-1.0.0$ sudo ruby install.rb install
@rafaelss
rafaelss / Gemfile
Created May 20, 2010 22:18 — forked from rmanalan/.gems
rack static site
source "http://rubygems.org"
gem 'rack-contrib', :git => 'git://github.com/rack/rack-contrib.git'
gem 'rack-rewrite'
# Rails developers have long had bad experiences with fixtures for
# several reasons, including misuse.
#
# Misuse of fixtures is characterized by having a huge number of them,
# requiring the developer to maintain a lot of data and creating dependencies
# between tests. In my experience working (and rescuing) many applications, 80%
# of fixtures are only used by 20% of tests.
#
# An example of such tests is one assuring that a given SQL query with
# GROUP BY and ORDER BY conditions returns the correct result set. As expected,
@macournoyer
macournoyer / tm_reveal_in_github.rb
Created January 14, 2011 15:31
Reveal in GitHub TextMate command
#!/usr/bin/env ruby
# Reveal in GitHub TextMate command
require 'pathname'
path = Pathname.new(ENV["TM_FILEPATH"]).relative_path_from(Pathname.new(ENV["TM_PROJECT_DIRECTORY"]))
repo_path = `/usr/local/bin/git remote show origin`[/Fetch URL: git@(.*)\.git$/, 1].tr(":", "/")
branch = `/usr/local/bin/git symbolic-ref HEAD`[/refs\/heads\/(.*)$/, 1]
exec "open 'http://#{repo_path}/blob/#{branch}/#{path}'"
@grantr
grantr / searchable_model.rb
Created April 25, 2011 22:08
ActiveModel module for elasticsearch indexing
# class Person
# include SearchableModel
# include SearchableModel::SearchMethods
#
# ...
#
# end
module SearchableModel
@sosedoff
sosedoff / google2.rb
Created May 19, 2011 19:59
Goole OAuth2 omniauth strategy
require 'omniauth/oauth'
require 'multi_json'
module OmniAuth
module Strategies
class Google2 < OAuth2
def initialize(app, client_id = nil, client_secret = nil, options = {}, &block)
client_options = {
:site => 'https://accounts.google.com/o/oauth2',
:authorize_url => 'https://accounts.google.com/o/oauth2/auth',
class DatabaseImporter
def initialize(sql_file)
@sql_file = sql_file
end
def all_values
tables_names.inject({}) { |memo,name| memo[name] = values_for(name); memo }
end
@rafaelss
rafaelss / build.sh
Last active October 2, 2015 20:18
Script to build nginx with some modules configured
#!/usr/bin/env bash
version="1.5.10"
pcre_version="8.34"
set -e
rm -rf nginx-$version*
# download nginx
@steveklabnik
steveklabnik / _comment.html.erb
Created October 9, 2012 06:05
Presenters in Rails?
<article>
<header>
<h3><%= comment.author %></h3>
</header>
<%= comment.body %>
</article>
@fnando
fnando / Vagrantfile
Last active December 14, 2015 23:19
My single-box Vagrant settings, VMware Fusion Edition.
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
config.vm.box = "precise64"
config.vm.network :private_network, ip: "192.168.33.2"
config.vm.synced_folder ".", "/Projects", id: "vagrant-root"
config.vm.provider(:vmware_fusion) do |v|
v.vmx["memsize"] = "2048"