Skip to content

Instantly share code, notes, and snippets.

View supernullset's full-sized avatar

Sean Williamson supernullset

View GitHub Profile
@supernullset
supernullset / DB_cleaner.rb
Created January 21, 2013 21:00
Multi-Database DatabaseCleaner setup
RSpec.configure do |config|
config.before :suite do
# set up a global cleaning strategy
DatabaseCleaner.clean_with(:truncation)
# AR specific strategy
DatabaseCleaner[:active_record].strategy = :truncation
# Explicitly tell DatabaseCleaner what connection is AR
DatabaseCleaner[:active_record, connection: :pediafed_test]
@supernullset
supernullset / teams.thor
Created February 17, 2013 05:33
Quick task to add org members to a specific repo
require 'github_api'
require 'io/console'
class Teams < Thor
include Thor::Actions
desc "ls", "list users in an organization"
def ls(org)
connenction = connect
members = connenction.orgs.members.list org
@supernullset
supernullset / aggregator.rb
Created April 1, 2013 05:47
First pass aggregator
class Aggregator
def initialize(target_filename, output_filename, pattern, output_file_type=nil)
@target_filename = target_filename
@output_filename = output_filename
@pattern = pattern
@output_file_type = output_file_type || "csv"
end
def run
open_files
@supernullset
supernullset / email-date-grouper.rb
Created April 1, 2013 05:48
mail-grouper one off script
require "tempfile"
require "fileutils"
require "csv"
require "time"
# -*- coding: utf-8 -*-
rents = "/Users/seanjw/Library/Thunderbird/Profiles/gdg1f8hw.default/ImapMail/imap.googlemail.com/Parents"
output = "/Users/seanjw/Dropbox/Programming-Languages/Ruby/rents-email-dates.txt"
odd_output = "/Users/seanjw/Dropbox/Programming-Languages/Ruby/odd-rents-dates.txt"
# Seans Theme
if patched_font_in_use; then
TMUX_POWERLINE_SEPARATOR_LEFT_BOLD="⮂"
TMUX_POWERLINE_SEPARATOR_LEFT_THIN="⮃"
TMUX_POWERLINE_SEPARATOR_RIGHT_BOLD="⮀"
TMUX_POWERLINE_SEPARATOR_RIGHT_THIN="⮁"
else
TMUX_POWERLINE_SEPARATOR_LEFT_BOLD="◀"
TMUX_POWERLINE_SEPARATOR_LEFT_THIN="❮"
@supernullset
supernullset / .zshrc.sh
Created June 7, 2013 21:48
Terminal Quote- A first draft of my own inspirational startup quotes
PHRASES=(
"A leader leads by example not by force. \n- Sun Tzu"
"All warfare is based on deception. \n- Sun Tzu"
"To know your Enemy, you must become your Enemy.\n- Sun Tzu"
"It is said that if you know your enemies and know yourself, you will not be imperilled in a hundred battles; if you do not know your enemies but do know yourself, you will win one and lose one; if you do not know your enemies nor yourself, you will be imperilled in every single battle.\n- Sun Tzu"
"He who knows when he can fight and when he cannot will be victorious.\n- Sun Tzu"
"Subtle and insubstantial, the expert leaves no trace; divinely mysterious, he is inaudible. Thus he is master of his enemy's fate.\n- Sun Tzu"
"The key is to keep company only with people who uplift you, whose presence calls forth your best.\n- Epictetus"
"There is only one way to happiness and that is to cease worrying about things which are beyond the power of our will.\n- Epictetus"
"When you are offended at any man's fault, turn to yourself and study your ow
(defun assign-group-from-hash (hash keys)
"creates a series of instance variable assignments in the style @key = hash.fetch(:key)"
(interactive "sHash Name: \nsKeys(separated by a space): ")
(let ((hash-keys (split-string keys)))
(mapc (lambda (key) (insert (format "@%s = %s.fetch(:%s)\n" key hash key))) hash-keys)
)
)
(global-set-key [f2] 'toggle-selective-display-at-depth)
(defun toggle-selective-display-at-depth (column)
(interactive "P")
(set-selective-display
(if selective-display nil (or column 3))))
(global-set-key [f2] 'toggle-selective-display-at-depth)
(defun toggle-selective-display-at-depth (column)
(interactive "P")
(set-selective-display
(if selective-display nil (or column 3))))
require "benchmark"
class KWBM
attr_reader :foo, :baz
def initialize(foo: "bar", baz: "biz")
@foo = foo
@baz = baz
end
def call