Skip to content

Instantly share code, notes, and snippets.

View gworley3's full-sized avatar

Gordon Seidoh Worley gworley3

View GitHub Profile
t.prefs_.set('color-palette-overrides',[
"#626262",
"#ff8373",
"#b4fb73",
"#fffdc3",
"#a5d6ff",
"#ff90ff",
"#d1d2ff",
"#f1f1f1",
"#ffc4be",
@gworley3
gworley3 / sample_slave_use.rb
Created March 28, 2014 21:53
DbCharmer - Getting Started - sample_slave_use.rb
DbCharmer.force_slave_reads do
# all read operations againt ActiveRecord objects will now
# go against the read slaves. this extends to calls on
# ActiveRecord objects in nested function calls.
end
@gworley3
gworley3 / config\initializers\extend_active_record.rb
Created March 28, 2014 21:35
DbCharmer - Getting Started - extend_active_record.rb
require 'db_charmer'
class ActiveRecord::Base
extend AdStage::Logger
include AdStage::Logger
db_magic :slaves => (SLAVE_DB_CONNECTIONS.empty? ? [connection] : SLAVE_DB_CONNECTIONS), :force_slave_reads => false
log(:warn, "no slave databases connected") if SLAVE_DB_CONNECTIONS.empty?
end
@gworley3
gworley3 / config\initializers\db_charmer.rb
Created March 28, 2014 21:29
DbCharmer - Getting Started - db_charmer.rb
SLAVE_DB_CONNECTIONS = (ENV['SLAVE_DATABASE_URLS'] || '').split(',').map do |db_url|
ENV[db_url] && Class.new(ActiveRecord::Base) { establish_connection(ENV[db_url]) }.connection
end.compact
@gworley3
gworley3 / Gemfile
Last active August 29, 2015 13:57
DbCharmer - Getting Started - Gemfile
gem 'db-charmer', '~>1.9.0'
@gworley3
gworley3 / clojure.vim
Created May 8, 2013 18:59
clojure syntax file that doesn't depend on a clojure plugin; based on a syntax file that does depend on a clojure plugin
" Vim syntax file
" Language: Clojure
" Maintainer: Toralf Wittner <[email protected]>
" modified by Meikel Brandmeyer <[email protected]>
" modified by G Gordon Worley III <[email protected]>
" URL: http://kotka.de/projects/clojure/vimclojure.html
" this version does not depend on other clojure plugins
if version < 600
syntax clear
@gworley3
gworley3 / ack_menuitem.vim
Created May 8, 2013 14:57
an ack menuitem for nerdtree; requires ack plugin for vim
if exists("g:loaded_nerdtree_ack_menuitem")
finish
endif
let g:loaded_nerdtree_ack_menuitem = 1
if !executable("ack")
finish
endif
call NERDTreeAddMenuItem({
@gworley3
gworley3 / desert256gw.vim
Created July 25, 2012 17:23
Modified version of desert256 vim theme
" Vim color file
" Maintainer: G Gordon Worley III <[email protected]>
" Based on the desert256 theme by Henry So, Jr. <[email protected]>
"
" Essentially a copy of desert256 with some added styles in place of using
" defaults so that it behaves well with terminal color schemes. Only tested
" in 256 color terminal. Mainly done to make diff usable.
"
" The desert256 info comments:
"
@gworley3
gworley3 / battery.sh
Created July 18, 2012 15:24
Darwin battery monitor in terminal
#!/bin/sh
#based on https://raw.github.com/richoH/dotfiles/master/bin/battery
#displays 100% when battery is full
#hearts fill from the left rather than the right, video game style
HEART_FULL=♥
HEART_EMPTY=♡
[ -z "$NUM_HEARTS" ] &&
NUM_HEARTS=5
@gworley3
gworley3 / grep_menuitem.vim
Created June 8, 2011 19:41 — forked from scrooloose/grep_menuitem.vim
nerdtree plugin to integrate nerdtree with :grep (with support for spaces in file names)
if exists("g:loaded_nerdtree_grep_menuitem")
finish
endif
let g:loaded_nerdtree_grep_menuitem = 1
if !executable("grep")
finish
endif
call NERDTreeAddMenuItem({