Skip to content

Instantly share code, notes, and snippets.

View JonahMoses's full-sized avatar

Jonah Moses JonahMoses

View GitHub Profile
class Employee < ActiveRecord::Base
end
class Manager < Employee
self.table_name = 'employees'
has_many :engineers
def nearest_manager
self
end
source ~/.dotfiles/vim/bundles " Bundles
2
3 syntax on " Enable syntax highlighting
4 filetype plugin indent on " Enable filetype-specific indenting and plugins
5
6 nnoremap Q <nop>| " disable EX mode
7 nnoremap q <nop>| " disable EX mode
8 nnoremap <Space> <nop>| " remove functionality from spacebar to allow leader to be spacebar
9 let mapleader = ' '| " leader is spacebar
10 nnoremap ; :| " remap ; to :
function gs
2 git status $argv
3 end
4
5 function gb
6 git branch $argv
7 end
8
9 function gp
10 git push origin master $argv
set -g __fish_git_prompt_show_informative_status 1
set -g __fish_git_prompt_hide_untrackedfiles 1
set -g __fish_git_prompt_color_branch magenta bold
set -g __fish_git_prompt_showupstream "informative"
set -g __fish_git_prompt_char_upstream_ahead "↑"
set -g __fish_git_prompt_char_upstream_behind "↓"
set -g __fish_git_prompt_char_upstream_prefix ""
set -g __fish_git_prompt_char_stagedstate "●"
# modify the prompt to contain git branch name if applicable
2 git_prompt_info() {
3 ref=$(git symbolic-ref HEAD 2> /dev/null)
4 if [[ -n $ref ]]; then
5 echo "on branch %{$fg[red]%}${ref#refs/heads/}%{$reset_color%}"
6 fi
7 }
8
9 setopt promptsubst
10 export PS1='${SSH_CONNECTION+"%{$fg_bold[green]%}%n@%m:"}% $reset_color$fg[green]%~ $reset_color$(git_prompt_info)
@JonahMoses
JonahMoses / RectangleSpec
Created March 18, 2014 20:20
WrapperRangeSpec
require 'spec_helper'
2
3 describe Rectangle do
4 let(:good_point1) { Point.new(25,60) }
5 let(:good_point2) { Point.new(-35,170) }
6 let(:bad_point) { Point.new(-350,-350) }
7 let(:rectangle) {
8 input_pairs = "45,45,-50,-175"
9 Rectangle.from_input(input_pairs)
10 }
class SchoolTest < MiniTest::Test
def school
@school
end
def setup
@school = School.new
end
@JonahMoses
JonahMoses / gist:7635526
Created November 25, 2013 02:53
scrabble
Bundler.require
require './lib/scrabble'
require './lib/player'
require 'minitest/autorun'
require 'minitest/pride'
class PlayerTest < MiniTest::Unit::TestCase
def test_a_player_accepts_a_name
player = Player.new("Katrina")
@JonahMoses
JonahMoses / gist:7601892
Created November 22, 2013 15:39
Scabble Player Class
Bundler.require
require './lib/scrabble'
require './lib/player'
require 'minitest/autorun'
require 'minitest/pride'
class PlayerTest < MiniTest::Unit::TestCase
def test_a_player_accepts_a_name
player = Player.new("Katrina")
@JonahMoses
JonahMoses / gist:6832892
Created October 4, 2013 21:14
Music Visualizer
require 'ruby-processing'
class Visualizer < Processing::App
load_library "minim"
import "ddf.minim"
import "ddf.minim.analysis"
def setup