This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# unicorn_rails -c /data/github/current/config/unicorn.rb -E production -D | |
rails_env = ENV['RAILS_ENV'] || 'production' | |
# 16 workers and 1 master | |
worker_processes (rails_env == 'production' ? 16 : 4) | |
# Load rails+github.git into the master before forking workers | |
# for super-fast worker spawn times | |
preload_app true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# Alex's changes: | |
# * erector and erector_mixin | |
# * each template now includes a loop and a variable (this affects HAML quite a lot) | |
# * automated comparison and benchmarking | |
# * make sure variable is truly being interpolated | |
# # of iterations = 10000 | |
# user system total real |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 30 minutes Lisp in Ruby | |
# Hong Minhee <http://dahlia.kr/> | |
# | |
# This Lisp implementation does not provide a s-expression reader. | |
# Instead, it uses Ruby syntax like following code: | |
# | |
# [:def, :factorial, | |
# [:lambda, [:n], | |
# [:if, [:"=", :n, 1], | |
# 1, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'rack' | |
class Object | |
def webapp | |
class << self | |
define_method :call do |env| | |
func, *attrs = env['PATH_INFO'].split('/').reject(&:empty?) | |
[200, {}, send(func, *attrs)] | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
RedisSessionStore.logger = Rails.logger | |
session_options = {:expire_after => 1.day, :key_prefix => 'sessions'} | |
MultiSessionStore.stores[:plain] = [RedisSessionStore, session_options.merge(:key => '_session_id')] | |
MultiSessionStore.stores[:secure] = [RedisSessionStore, session_options.merge(:key => '_secure_session_id', :secure => ['production', 'staging'].include?(Rails.env))] | |
MultiSessionStore.default_store = :plain | |
MultiSessionStore.routes = [ | |
['/admin', :secure], | |
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Nice to study. Original here http://www.20thingsilearned.com/js/twentythings.min.js | |
*/ | |
var TT = TT || {}; | |
TT.PAGE_WIDTH = 800; | |
TT.PAGE_HEIGHT = 500; | |
TT.PAGE_MIN_WIDTH = 1000; | |
TT.PAGE_MIN_HEIGHT = 680; | |
TT.PAGE_MARGIN_LEFT = 32; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'app' | |
require 'thinking_sphinx/tasks' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SUMMARY | |
I like to use kcachegrind for doing profiling on my ruby code. Most of my development | |
is done on OSX, and while you can install kcachegrind via macports, it takes forever | |
because it has to build KDE, as well. Much to my surprise, the fine folks who | |
wrote kcachegrind also made a QT version, qcachegrind. I was able to build this on | |
OSX without too much effort, only having to install QT and GraphViz. Yippie! | |
I'm running OSX 10.6.7, with Xcode 4. My default gcc/g++ version is 4.2. I'm sure | |
it will build just fine on earlier versions of Xcode, but I haven't tested it. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
######################################################################### | |
# # | |
# MySQL performance tuning primer script # | |
# Writen by: Matthew Montgomery <[email protected]> # | |
# Inspired by: MySQLARd (http://gert.sos.be/demo/mysqlar/) # | |
# Version: 1.5-r5 Released: 2009-11-22 # | |
# Licenced under GPLv2 # | |
# # |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# _______ _ _ _ _ _ | |
# |__ __| | (_) (_) | | | | | |
# | | | |__ _ ___ ___ ___ _ __ _ _ __ | |_ _ __ ___ _____ _____ __| | | |
# | | | '_ \| / __| / __|/ __| '__| | '_ \| __| | '_ ` _ \ / _ \ \ / / _ \/ _` | | |
# | | | | | | \__ \ \__ \ (__| | | | |_) | |_ | | | | | | (_) \ V / __/ (_| | | |
# |_| |_| |_|_|___/ |___/\___|_| |_| .__/ \__| |_| |_| |_|\___/ \_/ \___|\__,_| | |
# | | | |
# |_| | |
# | |
# New home : https://github.com/bric3/osx-jdk5-installer |
OlderNewer