I hereby claim:
- I am travisofthenorth on github.
- I am travishunter (https://keybase.io/travishunter) on keybase.
- I have a public key whose fingerprint is 3D8C 4969 767F 1A5F E4B9 714C B781 0CC4 B1C2 283F
To claim this, I am signing this object:
class ListEntry | |
attr_accessor :next, :prev, :data | |
def initialize(data) | |
@next = nil | |
@prev = nil | |
@data = data | |
end | |
end | |
class List |
module Sort | |
def mergesort!(a) | |
a.replace(mergesort(a)) | |
end | |
def mergesort(a) | |
return a if a.length <= 1 | |
halfway = a.length / 2 | |
left, right = a[0..halfway - 1], a[halfway..a.length] |
class Graph | |
def initialize | |
@nodes = [] | |
end | |
def add_node(name) | |
fail 'Node already exists!' if find_node(name) | |
nodes << Node.new(name) | |
nodes.last | |
end |
/** | |
* Original original code (Java) by Neil Wallis | |
* @link http://www.neilwallis.com/java/water.html | |
* | |
* Original JS code by Sergey Chikuyonok ([email protected]) | |
* http://chikuyonok.ru | |
*/ | |
(function(){ | |
var canvas = document.getElementById('c'), | |
/** @type {CanvasRenderingContext2D} */ |
# Print all combinations of balanced parentheses of length n | |
def recurse(str:, open:, closed:, n:) | |
if open + closed == n - 1 | |
str += ')' | |
p str | |
else | |
if open < n / 2 | |
recurse(str: str + '(', open: open + 1, closed: closed, n: n) | |
end |
module FactoryGirlHelper | |
BLACKLIST = [:user] | |
def first(args) | |
name = args.first | |
klass = name.to_s.camelize.constantize | |
conditions = args.last | |
if conditions.present? && conditions.is_a?(Hash) |
module JailedConsole | |
extend ActiveSupport::Concern | |
included do | |
require 'colorize' | |
def sandbox_console | |
require 'webmock' | |
require 'sidekiq/testing' if defined?(Sidekiq) | |
end |
#!/bin/bash | |
find spec -iname "*spec.rb" -exec sed -i.bak 's/create/build/g' {} \; | |
find spec -iname "*spec.rb" -print0 | while IFS= read -r -d $'\0' spec; do | |
spring rspec $spec --fail-fast | |
if [[ $? -gt 0 ]]; then | |
echo "$spec did not pass" | |
else | |
echo "$spec passed!!!" |
I hereby claim:
To claim this, I am signing this object:
class Matrix | |
Coordinate = Struct.new(:x, :y) | |
def initialize(grid) | |
@grid = grid | |
end | |
def binary_search(n) | |
row = find_row(n, 0, grid.count - 1) | |
return nil unless row |