Skip to content

Instantly share code, notes, and snippets.

View 6ewis's full-sized avatar

Lewis 6ewis

  • Toronto, Ontario
View GitHub Profile
# Path to your oh-my-zsh installation.
export ZSH=$HOME/.oh-my-zsh
# Set name of the theme to load.
# Look in ~/.oh-my-zsh/themes/
# Optionally, if you set this to "random", it'll load a random theme each
# time that oh-my-zsh is loaded.
ZSH_THEME="bureau"
# Uncomment the following line to use case-sensitive completion.
#Use backtick as the prefix
# Do it just like this or you will not
# be able to use type backtick literally
unbind C-b
set -g prefix `
bind ` send-prefix
bind-key l last-window
unbind %
bind '|' split-window -h
unbind '"'
@6ewis
6ewis / gist:8612604
Created January 25, 2014 06:32
fast parser
#!/usr/bin/env ruby
#Usage parse <argument>
require 'csv'
require 'active_support/inflector'
require 'set'
module Printer
def print_statistics
require 'csv'
require 'active_support/inflector'
require 'ruby-prof'
Customer = Struct.new(:cust_id,
:elect_or_gas,
:disconnect_doc,
:move_in_date,
:move_out_date,
@6ewis
6ewis / gist:7941346
Created December 13, 2013 08:30
here is what I suggest you could do
require 'active_support/all'
class Article
attr_accessor :id
def initialize(attributes={})
@id = attributes[:id]
end
@6ewis
6ewis / gist:7919828
Last active December 31, 2015 02:19
random test. # I wanted to try and flush the string before it dies. note that ruby only has a finalizer , it does not have a destructor. I could have use ObjectSpace.define_finalizer self, proc {persist} and use GC.start at the command line to run the garbage collector however it would be after destroying an instance object.
#persistent_string.rb
class PersistentString < String
def initialize data= nil
@@count ||= 0
load data #ObjectSpace.define_finalizer self, proc {persist}
super
end
#Instance Methods
@6ewis
6ewis / gist:7919715
Created December 11, 2013 22:32
random task =)
#task_helper.rb
require 'spec_helper'
describe Task do
describe '#reccurent' do
it 'raises an Argument error' do
expect { Task.new.reccurent }.to raise_error {|error| error.should be_a(ArgumentError)}
end