Skip to content

Instantly share code, notes, and snippets.

View ktham's full-sized avatar

Kevin Tham ktham

  • Iterable, Inc.
  • Los Angeles, CA
View GitHub Profile
@ktham
ktham / gist:1856859
Created February 18, 2012 01:57
Rails Installation (OS X Lion)
# Make sure xCode 4.3 is installed first!!!
# Command line tools no longer come bundled with xCode, install it by going to:
preferences -> downloads -> command line tools
# Install RVM
bash -s stable < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer)
# Then restart terminal
@ktham
ktham / after_commit_with_transactional_fixtures.rb
Created October 26, 2012 16:53
Patch ActiveRecord to fire after_commit callbacks at the appropriate time during tests with transactional fixtures.
module ActiveRecord
module ConnectionAdapters
module DatabaseStatements
#
# Run the normal transaction method; when it's done, check to see if there
# is exactly one open transaction. If so, that's the transactional
# fixtures transaction; from the model's standpoint, the completed
# transaction is the real deal. Send commit callbacks to models.
#
# If the transaction block raises a Rollback, we need to know, so we don't
if Rails.env.production?
require 'new_relic/agent/instrumentation/controller_instrumentation'
module NewRelic
module Agent
module Instrumentation
module API
def newrelic_request_headers
@newrelic_request.env
@ktham
ktham / 0-readme.md
Created November 24, 2012 08:26 — forked from burke/0-readme.md
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.

# Outputs this at warn log level:
# 1.2.3.4 GET /path 200 OK BlahController#action HTML 938.2 (DB 11.8, View 719.7) {params} {optional params from flash[:log]}
#
# Save as config/initializers/oneline_detailed_logging.rb. Consider
# decreasing the log level from "info" to "warn" (in production.rb) so
# the one-line log message replaces the standard request logs.
# override process_action to add 2 things to the payload:
# - remote IP
#! /bin/sh
# Copyright (c) 2013 PgPool Global Development Group
#
# Permission to use, copy, modify, and distribute this software and
# its documentation for any purpose and without fee is hereby
# granted, provided that the above copyright notice appear in all
# copies and that both that copyright notice and this permission
# notice appear in supporting documentation, and that the name of the
# author not be used in advertising or publicity pertaining to
# distribution of the software without specific, written prior
@ktham
ktham / README.md
Created August 14, 2013 00:59 — forked from ngauthier/README.md
@ktham
ktham / gist:0c43828acbb4db62113e
Created June 13, 2014 18:19
Run a simple web server
# Running a simple web server in ruby
ruby -run -e httpd . -p 8888
# Running a simple web server in python2
python -m SimpleHTTPServer 8888
# Running a simple web server in python3
python3 -m http.server 8888
# Running a simple web server in node via http-server
@ktham
ktham / keybase.md
Last active May 4, 2023 00:08
Keybase/ktham

Keybase proof

I hereby claim:

  • I am ktham on github.
  • I am kevintham (https://keybase.io/kevintham) on keybase.
  • I have a public key ASA70H-Lg-zL-bE9Q_Lx-ZagsbKox3uoLkjtG6eEjkD49go

To claim this, I am signing this object: