Skip to content

Instantly share code, notes, and snippets.

View ippy04's full-sized avatar

Justin Ip ippy04

View GitHub Profile
##
# CarrierWave Amazon S3 File Reprocessor Rake Task
#
# Written (specifically) for:
# - CarrierWave
# - Ruby on Rails 3
# - Amazon S3
#
# Works with:
# - Any server of which you have write-permissions in the Rails.root/tmp directory
@ippy04
ippy04 / MailchimpDeliveryMethod
Created March 17, 2011 01:20
Delivery Method for Mailchimp STS and Amazon SES using Uakari
class MailchimpDeliveryMethod
attr_accessor :settings
def initialize(values = {})
self.settings = {:track_opens => true,
:track_clicks => true
}.merge!(values)
end
def deliver!(mail)
@ippy04
ippy04 / chef_bootstrap_rvm.erb
Created July 14, 2011 22:57 — forked from bensie/chef_bootstrap_rvm.erb
Chef Bootstrap With RVM and 1.9.2 (Ubuntu)
bash -c '
if [ ! -f /usr/bin/chef-client ]; then
apt-get update
apt-get install -y build-essential bison openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-0 libsqlite3-dev sqlite3 libxml2-dev autoconf libc6-dev
bash < <(curl -s https://rvm.beginrescueend.com/install/rvm)
(
cat <<'EOP'
[[ -s "/usr/local/rvm/scripts/rvm" ]] && source "/usr/local/rvm/scripts/rvm" # This loads RVM into a shell session.
EOP
@ippy04
ippy04 / async_io.rb
Created August 25, 2011 07:29 — forked from nolman/async_io.rb
Async IO
require 'rubygems'
require 'eventmachine'
require 'em-http-request'
require 'fiber'
EventMachine.run do
http = EM::HttpRequest.new('http://www.google.com').get
begin
puts "Before"
http.callback {
@ippy04
ippy04 / hbs_renderer.rb
Created December 28, 2011 05:34 — forked from saaji/hbs_renderer.rb
handlebars renderer for Ruby On Rails 3.1 using hbs gem
require 'handlebars'
module HBSTemplateHandler
def self.call(template)
if template.locals.include? :hbs
<<-TEMPLATE
template = Handlebars.compile #{template.source.inspect}
template.call(hbs || {}).html_safe
TEMPLATE
else
@ippy04
ippy04 / patch-1.9.2-gc.patch
Created January 14, 2012 21:38 — forked from funny-falcon/patch-1.9.2-gc.patch
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
+
@ippy04
ippy04 / 0-readme.md
Created February 9, 2012 08:23 — forked from burke/0-readme.md
ruby-1.9.3-p0 cumulative performance patch.

Patched ruby 1.9.3-p0 for 30% faster rails boot

What is?

This script installs a patched version of ruby 1.9.3-p0 with patches to make ruby-debug work again (#47) and boot-time performance improvements (#66 and #68), and runtime performance improvements (#83 and #84).

Huge thanks to funny-falcon for the performance patches.

@ippy04
ippy04 / ruby_gc.sh
Created February 22, 2012 20:12 — forked from mikhailov/ruby_gc.sh
Ruby’s GC Configuration
- http://www.coffeepowered.net/2009/06/13/fine-tuning-your-garbage-collector/
- http://snaprails.tumblr.com/post/241746095/rubys-gc-configuration
article’s settings: ("spec spec" took 17-23!sec)
export RUBY_HEAP_MIN_SLOTS=1250000
export RUBY_HEAP_SLOTS_INCREMENT=100000
export RUBY_HEAP_SLOTS_GROWTH_FACTOR=1
export RUBY_GC_MALLOC_LIMIT=30000000
export RUBY_HEAP_FREE_MIN=12500
@ippy04
ippy04 / hack.sh
Created March 31, 2012 14:19 — forked from erikh/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
Alltrails::Application.configure do
# Settings specified here will take precedence over those in config/application.rb
# In the development environment your application's code is reloaded on
# every request. This slows down response time but is perfect for development
# since you don't have to restart the webserver when you make code changes.
config.cache_classes = false
# Log error messages when you accidentally call methods on nil.
config.whiny_nils = true