Skip to content

Instantly share code, notes, and snippets.

View trak3r's full-sized avatar

Thomas "Teflon Ted" Davis trak3r

View GitHub Profile
@trak3r
trak3r / README.md
Created April 24, 2013 12:37 — forked from reinh/README.md

Syntax highlight SQL inside Ruby <<-SQL heredocs

Embeds SQL syntax highlighting inside Ruby heredocs labeled SQL. This will also work to embed other syntaxen, e.g., HTML.

Optional PGSQL enhanced syntax:

(requires https://github.com/exu/pgsql.vim)

 syntax include @SQL syntax/pgsql.vim
require "net/http"
# Example Usage:
#
# use Rack::Proxy do |req|
# if req.path =~ %r{^/remote/service.php$}
# URI.parse("http://remote-service-provider.com/service-end-point.php?#{req.query}")
# end
# end
#
@trak3r
trak3r / gist:3390368
Created August 18, 2012 23:37 — forked from tankchintan/gist:1335220
Procedure for installing and setting Sun JDK Java on Default Amazon Linux AMI
# Get the latest Sun Java SDK from Oracle http://www.oracle.com/technetwork/java/javase/downloads/jdk-7u1-download-513651.html
wget http://download.oracle.com/otn-pub/java/jdk/7u1-b08/jdk-7u1-linux-i586.rpm
# Rename the file downloaded, just to be nice
mv jdk-7u1-linux-i586.rpm\?e\=1320265424\&h\=916f87354faed15fe652d9f76d64c844 jdk-7u1-linux-i586.rpm
# Install Java
sudo rpm -i jdk-7u1-linux-i586.rpm
# Check if the default java version is set to sun jdk
@trak3r
trak3r / filters_view.js.coffee
Created March 5, 2012 17:23 — forked from kwhitaker/filters_view.js.coffee
Trying to scope back to currentView
class window.PlacementFiltersView extends Backbone.View
el: "#placements form#filters"
initialize: ->
currentView = @
# Create a hash of labels for the filter type-aheads
@filterLabels = []
jQuery(@el).find('.filter-top-level option').each ->
if jQuery(@).val() isnt ''
@trak3r
trak3r / descriptive_sql_load_log.rb
Created July 19, 2011 20:53 — forked from JackDanger/descriptive_sql_load_log.rb
Let Rails display file names and line numbers for log activity.
module ActiveRecord
module ConnectionAdapters
class AbstractAdapter
protected
# Turn:
# User Load (6.3ms) SELECT * FROM "users"
# Into:
# User Load /app/views/_partial.erb:27 (6.3ms) in `_app_views_partial_erb` SELECT * FROM "users"
@trak3r
trak3r / git-merge-into
Created May 16, 2011 15:31 — forked from anonymous/git-merge-into
Merge the current branch into another branch without (manually) switching
#!/usr/bin/env ruby
# Merges the current branch into the specified branch after checking out that branch.
# Usage:
# git merge-into [branch]
# [branch] defaults to "master" if not specified
# "sprint" is my convenience library for handling external processes.
@trak3r
trak3r / gist:647643
Created October 26, 2010 19:54 — forked from bryanl/gist:647174
export RUBY_HEAP_MIN_SLOTS=1000000
export RUBY_HEAP_SLOTS_INCREMENT=1000000
export RUBY_HEAP_SLOTS_GROWTH_FACTOR=1
export RUBY_GC_MALLOC_LIMIT=1000000000
export RUBY_HEAP_FREE_MIN=500000
This example shows how to setup an environment running Rails 3 beta under 1.9.1 with a 'rails3' gem set.
∴ rvm update --head
# ((Open a new shell)) or do 'rvm reload'
# If you do not already have the ruby interpreter installed, install it:
∴ rvm install 1.9.1
# Switch to 1.9.1 and gemset rails3, create if it doesn't exist.
∴ rvm --create use 1.9.1@rails3
namespace :prune do
desc "Delete all unnecessary files from vendored Rails"
task :rails do
require 'fileutils'
list = Dir.glob("vendor/rails/*/test")
FileUtils.rm_rf list, :verbose => true unless list.empty?
end
tell application "Terminal"
activate
do script with command "cd ~/my/development/directory"
do script with command "cd ~/my/development/directory; mate ."
do script with command "cd ~/my/development/directory; script/server"
do script with command "cd ~/my/development/directory; script/console"
do script with command "cd ~/my/development/directory; autotest"
end tell