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' | |
| describe 'unintended sequence' do | |
| before(:all) do | |
| @x = {a: 1, b: 2} | |
| end | |
| it 'modifies the array' do | |
| @x[:a] = 2 | |
| @x[:a].should eq 2 |
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' | |
| describe 'Random numbers' do | |
| it 'fails every time' do | |
| numbers = 10.times.map { rand(100) } | |
| numbers.join(', ').should eq 'the Tardis' | |
| end | |
| end |
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
| class Tapper | |
| attr_reader :eavesdroppers | |
| def initialize(source, *eavesdroppers) | |
| @source = source | |
| @eavesdroppers = eavesdroppers | |
| end | |
| def method_missing(method, *args) | |
| if @source.respond_to?(method) |
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
| # put the following function into .bash_profile or .bashrc to evaluate this file | |
| # function go { `awk -v val=^$1$ '$1!~/^[:space:]*#/ && $1~val { print "cd "$2 }' ~/.go_shortcuts`; } | |
| sample /some/deep/directory/to/link/to |
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
| # Configuration file for the slate window management tool for OS X. | |
| # For more information see: https://github.com/jigish/slate | |
| # | |
| # Config by Nathan Fritz. Updated 2014-01. | |
| # settings {{{ | |
| # | |
| # instruct slate to base nudges and resizes on current screensize and to | |
| # use an 8x8 grid for the layout popup | |
| # |
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
| #!/usr/bin/env ruby | |
| require "thor" | |
| require "yaml" | |
| require "open3" | |
| class App < Thor | |
| MAILLOG_REGEX = /^.+:(?<timestamp>\w+\s+\d+ \d\d+:\d\d:\d\d) (?<server>[^\s]+) .+ to=<(?<to>[^>]+)>.+ relay=(?<relay>[^,]+),.+status=(?<status>.+)$/ | |
| # other mail analysis-type stuff... | |
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 'minitest/autorun' | |
| class Monkey | |
| @@m1 = "monkey" | |
| class << self | |
| attr_accessor :m2 | |
| end | |
| def self.m1=(m) |
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 timer | |
| start_time = Time.now | |
| 1_000_000.times do | |
| yield | |
| end | |
| Time.now - start_time | |
| end | |
| time_a = timer do | |
| x = "this this this this this this this this this this this this this this this " + |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
| # -*- mode: ruby -*- | |
| # vi: set ft=ruby : | |
| Vagrant.configure(2) do |config| | |
| config.vm.box = "ubuntu/vivid64" | |
| config.vm.network "forwarded_port", guest: 3000, host: 3000 | |
| config.vm.provider "virtualbox" do |vb| | |
| vb.memory = "1024" | |
| end |