This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| board_string = "003020600900305001001806400008102900700000008006708200002609500800203009005010300" | |
| class Sudoku | |
| attr_accessor :board | |
| def initialize(string) | |
| @board = string | |
| end | |
| def rows |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require "mathn" | |
| module Calculator | |
| extend self | |
| def call(expression) | |
| eval(sanitize(expression)).to_f | |
| end | |
| private |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| execute pathogen#infect() | |
| call pathogen#helptags() | |
| syntax enable | |
| set background=light | |
| colorscheme cake16 | |
| set guifont="Inconsolata" | |
| set smartindent | |
| set cursorline |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 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' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $(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; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| execute pathogen#infect() | |
| call pathogen#helptags() | |
| syntax enable | |
| set background=light | |
| colorscheme solarized | |
| set guifont=inconsolata | |
| set smartindent | |
| set cursorline |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 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 |