Skip to content

Instantly share code, notes, and snippets.

View dylanerichards's full-sized avatar

Dylan Richards dylanerichards

View GitHub Profile
board_string = "003020600900305001001806400008102900700000008006708200002609500800203009005010300"
class Sudoku
attr_accessor :board
def initialize(string)
@board = string
end
def rows
require 'spec_helper'
require '../24/deck.rb'
require 'pry'
require 'stringio'
describe Deck do
let(:deck) { Deck.new }
it "starts empty" do
expect(deck.deck).to be_empty
require "mathn"
module Calculator
extend self
def call(expression)
eval(sanitize(expression)).to_f
end
private
execute pathogen#infect()
call pathogen#helptags()
syntax enable
set background=light
colorscheme cake16
set guifont="Inconsolata"
set smartindent
set cursorline
# Prefix
set -g prefix C-a
unbind C-b
bind C-a send-prefix
# Mouse scrolling
set-window-option -g mode-mouse on
# improve colors
set -g default-terminal 'screen-256color'
@dylanerichards
dylanerichards / form.js
Created March 26, 2015 15:28
Animoto Challenge
$(document).ready(function() {
function validateEmail(email){
var emailReg = new RegExp(/^(("[\w-\s]+")|([\w-]+(?:\.[\w-]+)*)|("[\w-\s]+")([\w-]+(?:\.[\w-]+)*))(@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$)|(@\[?((25[0-5]\.|2[0-4][0-9]\.|1[0-9]{2}\.|[0-9]{1,2}\.))((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\.){2}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\]?$)/i);
var valid = emailReg.test(email);
if(!valid) {
return false;
} else {
return true;
@dylanerichards
dylanerichards / .tmux.conf
Created February 23, 2015 20:54
.tmux.conf
# 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 / .vimrc
Created February 23, 2015 20:32
vimrc
execute pathogen#infect()
call pathogen#helptags()
syntax enable
set background=light
colorscheme solarized
set guifont=inconsolata
set smartindent
set cursorline
@dylanerichards
dylanerichards / descending_sort_array.rb
Created February 11, 2015 21:02
Sort array descending with max in middle
def sort_descending(array)
halves = array.each_slice((array.length) / 2).to_a
first = halves[0].sort
second = halves[1].sort.reverse
first + second
end
array = [1, 2, 5, 4, 3, 6]
sort_descending(array)
@dylanerichards
dylanerichards / person_questions.rb
Last active August 29, 2015 14:15
For the haters
# Save Person instances
# Ask use who he is
# Display proper questions
# We have a set of people.
# Two sets of questions
# We want to give a set of questions to each of those people based on their age
#
class Person