Skip to content

Instantly share code, notes, and snippets.

View dylanerichards's full-sized avatar

Dylan Richards dylanerichards

View GitHub Profile
@dylanerichards
dylanerichards / overwrite_subtract.rb
Created February 6, 2015 13:30
Operators are just methods
# Operators are just methods. We can define and overwrite them just like any other.
# By operators I mean things like +, -, *, /, and the list goes on. But these
# are the most common.
#
# The goal for this program is to overwrite the subtract
# method. For RightTriangle. The result should be a RightTriangle whose sides
# are the result of performing subtraction (I know that's weird wording).
@dylanerichards
dylanerichards / parentheses.rb
Last active August 29, 2015 14:14
Parentheses Checker
class ParenthesesChecker
attr_reader :input
def initialize(input)
@input = input
end
def check_valid_parentheses
if begins_incorrectly? || ends_incorrectly? || unmatching_paren_count?
false
@dylanerichards
dylanerichards / assignments.rb
Created February 5, 2015 13:50
Assigning Ruby Core Methods to People
people = %w(Umar Trevor Randy Marlone Gerardo Alex Isaac Conner)
methods = [
"String#count", "String#index", "String#rindex",
"String#gsub", "String#to_sym", "Hash#delete",
"Hash#delete_if", "Hash#each_key", "Hash#each_value",
"Hash#value?", "Hash#invert", "Hash#length",
"Hash#merge", "Hash#select", "Hash#to_a",
"Hash#values", "Hash#keys", "Array#compact",
"Array#delete", "Array#delete_at", "Array#delete_if",
@dylanerichards
dylanerichards / gist:4ad95bf94da2ca0cb804
Created February 2, 2015 23:20
Application start stack trace
18:20:20 clock.1 | started with pid 65300
18:20:20 resque.1 | started with pid 65301
18:20:20 web.1 | started with pid 65302
18:20:21 web.1 | /Users/dylanrichards/.rvm/gems/ruby-2.0.0-p598/gems/kgio-2.8.0/lib/kgio_ext.bundle: [BUG] Segmentation fault
18:20:21 web.1 | ruby 2.0.0p598 (2014-11-13 revision 48408) [x86_64-darwin14.1.0]
18:20:21 web.1 |
18:20:21 web.1 | -- Crash Report log information --------------------------------------------
18:20:21 web.1 | See Crash Report log file under the one of following:
18:20:21 web.1 | * ~/Library/Logs/CrashReporter
18:20:21 web.1 | * /Library/Logs/CrashReporter
@dylanerichards
dylanerichards / vimscript
Last active August 29, 2015 14:14
.vimrc
execute pathogen#infect()
call pathogen#helptags()
syntax enable
set background=light
colorscheme solarized
set guifont=inconsolata
set smartindent
set cursorline
set tabstop=2
clock: bundle exec clockwork lib/clock.rb
resque: env TERM_CHILD=1 COUNT=3 QUEUE=high,normal,low RESQUE_TERM_TIMEOUT=100 bundle exec rake resque:work
web: bundle exec unicorn -p 3000 -c ./config/unicorn.rb
# smart pane switching with awareness of vim splits
bind -n C-h run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-h) || tmux select-pane -L"
bind -n C-j run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-j) || tmux select-pane -D"
bind -n C-k run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-k) || tmux select-pane -U"
bind -n C-l run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-l) || tmux select-pane -R"
bind -n C-\ run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys 'C-\\') || tmux select-pane -l"
set -g default-terminal "screen-256color"
# set -g status-bg colour235
@dylanerichards
dylanerichards / gist:c77267c88b7f19cb5af4
Last active August 29, 2015 14:10
Link to jquery cdna
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
@dylanerichards
dylanerichards / .tmux.conf
Created November 7, 2014 05:59
Tmux configuration file
# smart pane switching with awareness of vim splits
bind -n C-h run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-h) || tmux select-pane -L"
bind -n C-j run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-j) || tmux select-pane -D"
bind -n C-k run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-k) || tmux select-pane -U"
bind -n C-l run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-l) || tmux select-pane -R"
bind -n C-\ run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys 'C-\\') || tmux select-pane -l"
set -g default-terminal "screen-256color"
# set -g status-bg colour235
@dylanerichards
dylanerichards / Gemfile.rb
Last active August 29, 2015 14:06
Twitter Feed
gem 'twitter'