Skip to content

Instantly share code, notes, and snippets.

View akitaonrails's full-sized avatar

Fabio Akita akitaonrails

View GitHub Profile
# This will ride alongside god and kill any rogue memory-greedy
# processes. Their sacrifice is for the greater good.
unicorn_worker_memory_limit = 300_000
Thread.new do
loop do
begin
# unicorn workers
#
@JonRowe
JonRowe / Gemfile
Created January 26, 2010 14:10
Gemfile to allow bundling Merb 1.0.15 via Bundler... read symlink instructions...
# This Gemfile is a cheat
# It allows bundling via bundler using Merb 1.0.15
# To use this you *MUST* symlink gems/gems to gems/ruby/1.8/gems etc.
# I recommend symlinking gems/gems gems/cache gems/specification gems/doc just to be sure
bundle_path "gems"
bin_path "bin"
def self.dependency(*args)
gem(*args)
@akitaonrails
akitaonrails / build_oniguruma_ios.sh
Created April 19, 2011 16:37
Build Oniguruma as a fat binary for iOS and the simulator
#!/bin/bash
# This script will compile a oniguruma static lib for the device and simulator
cd onig
# Compile a version for the device...
CC=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc CPP=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/cpp AR=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ar ./configure --disable-shared --host=arm-apple-darwin --disable-cpp CFLAGS="-arch armv6 -isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.3.sdk"
@jnunemaker
jnunemaker / fu.md
Created July 12, 2011 23:20
FUN BUG?!

Posted to the REE Google Group as well: https://groups.google.com/forum/#!topic/emm-ruby/EBkMfFpk40A

A week back I innocently updated Sinatra on an app which in turn updated Rack. Since then, I've had crazy hung passenger processes that just gobble up CPU like it is going out of style.

After spending a few days trying everything I knew to to fix it, today I got help from a friend (Eric Lindvall) and dug in with strace, rbtrace, gdb, and gdb.rb and found the issue. Rack 1.3.0 tests a regex against a URL and it causes things to hang.

@klauswuestefeld
klauswuestefeld / gist:1186975
Created September 1, 2011 19:03
Martin Fowler to Usurp Pattern
We couldn’t find that file to show.
@grosser
grosser / resque_web.rb
Created September 13, 2011 15:08 — forked from skippy/resque_web.rb
Mountable resque-web for rails 3+ apps
# https://gist.github.com/1214052
require 'sinatra/base'
class ResqueWeb < Sinatra::Base
require 'resque/server'
use Rack::ShowExceptions
if CFG[:user].present? and CFG[:password].present?
Resque::Server.use Rack::Auth::Basic do |user, password|
user == CFG[:user] && password == CFG[:password]
@saetia
saetia / gist:1623487
Last active May 1, 2024 19:55
Clean Install – OS X 10.11 El Capitan

OS X Preferences


most of these require logout/restart to take effect

# Enable character repeat on keydown
defaults write -g ApplePressAndHoldEnabled -bool false

# Set a shorter Delay until key repeat
@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.

@stevecj
stevecj / computes_recursively.rb
Last active November 27, 2015 03:13
Fake tail recursion in Ruby without relying on tail optimization support in the Ruby VM
# This is a mixin module that adds support for tail-recursive
# style programming in Ruby without relying on any true tail
# recursion optimization in the Ruby virtual machine.
#
# Since tail recursion calls are actually deferred until after
# returning from the method that invoked #tail, recursions can
# be "nested" to an unlimited depth without overflowing the
# stack.
#
# The including module can define tail-recursive methods within
@akitaonrails
akitaonrails / mountain-lion-brew-setup.markdown
Created June 18, 2012 13:43 — forked from myobie/mountain-lion-brew-setup.markdown
Get Mountain Lion Preview 4 and Homebrew to Be Happy

Get Mountain Lion Preview 4 and Homebrew to Be Happy

1) Install XCode 4.5 Developer Preview into /Applications

Get it from http://developer.apple.com. You will not be able to submit apps to any stores using this XCode version, so turn away if that is something you might want to do.

2) Install Command Line Tools

In XCode's Preferences > Downloads you can install command line tools.