Skip to content

Instantly share code, notes, and snippets.

View rafaelss's full-sized avatar

Rafael Souza rafaelss

View GitHub Profile
@jeremyjbowers
jeremyjbowers / varnish-simple.vcl
Created December 31, 2011 04:59
A simple Varnish configuration file.
/*
*
* First, set up a backend to answer the request if there's not a cache hit.
*
*/
backend default {
# Set a host.
.host = "192.168.1.100";
@funny-falcon
funny-falcon / patch-1.9.2-gc.patch
Created March 5, 2011 11:11
GC tunning simple patch ruby 1.9.2 p180
diff --git a/gc.c b/gc.c
--- a/gc.c
+++ b/gc.c
@@ -77,6 +77,41 @@ void *alloca ();
#ifndef GC_MALLOC_LIMIT
#define GC_MALLOC_LIMIT 8000000
#endif
+#define HEAP_MIN_SLOTS 10000
+#define FREE_MIN 4096
+
require "money"
class Decorator < BasicObject
undef_method :==
def initialize(component)
@component = component
end
def method_missing(name, *args, &block)
@pauljamesrussell
pauljamesrussell / i18n_debug.rb
Created December 4, 2011 23:23
Output debugging information about i18n translation lookups that are occurring.
require 'i18n'
if (Rails.env.development? || Rails.env.test?) && ENV['DEBUG_TRANSLATION']
module I18n
class << self
def translate_with_debug(*args)
puts "Translate: #{args.inspect}"
translate_without_debug(*args)
end
alias_method_chain :translate, :debug

#Phoenix 1.1.x to 1.2.0 Upgrade Instructions

Project Generator

To generate new projects as 1.2.0, install the new mix archive:

mix archive.install https://github.com/phoenixframework/archives/raw/master/phoenix_new.ez

Deps

@tenderlove
tenderlove / person_test.rb
Created February 10, 2011 23:04
Use minitest/spec with Rails 3
require 'test_helper'
require 'minitest/autorun'
module Tenderlove
class Spec < MiniTest::Spec
include ActiveSupport::Testing::SetupAndTeardown
include ActiveRecord::TestFixtures
alias :method_name :__name__ if defined? :__name__
self.fixture_path = File.join(Rails.root, 'test', 'fixtures')
@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"
@steveklabnik
steveklabnik / _comment.html.erb
Created October 9, 2012 06:05
Presenters in Rails?
<article>
<header>
<h3><%= comment.author %></h3>
</header>
<%= comment.body %>
</article>
@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
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