Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env bash
: '
Copyright <2017> <Tom Brand>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE S
@tom025
tom025 / replace_omega_with_expect.sh
Last active August 29, 2015 14:19
Replace `Ω(...).Should(...)` with `Expect(...).To(...)` in ginkgo tests
# Using Mac OS X 10.10 `sed`
find . -name '*_test.go' | xargs sed -E -i '' -e 's/Ω\((.+)\)\.(Should|To)(\(|Not\()(.+)$/Expect(\1).To\3\4/'
@tom025
tom025 / main.go
Created March 12, 2015 14:24
Comparing `BulkInfo()` and `Info()` performance
package main
import (
"fmt"
"time"
"github.com/cloudfoundry-incubator/garden"
"github.com/cloudfoundry-incubator/garden/client"
"github.com/cloudfoundry-incubator/garden/client/connection"
)
@tom025
tom025 / errors.rb
Created December 15, 2011 17:30
Grabbing errors from nested objects from an ActiveRecord::ValidationError
e.record.errors.each_error {|key, err| e.record.send(key).map{|attr| pp "#{key}: #{attr.errors.full_messages}" } }
class Configuration
attr_accessor :tail_logs, :max_connections, :admin_password
def initialize
@app_server = AppServer.new
end
def app_server
yield(@app_server) if block_given?
@app_server
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCgnVYyBuqnVFqxUM0WRRIb8bYxnf0mp8l3QDjzYZOMdF4oMTHvL+jSGY6Do5vpaKxryZ7FOiJtOmKlTeqFngAvp1sGj6ds/M423ykyF4sJbVCxAANX+xRarEm1v7msc1GJaJUYvdIdsDS+EpybumrWW/Rt2QL3pvjl+uY349zYtwJkpTcvk8Xgt1TzU6OIBN6k54bhB2ANtzcTiDvbMEoBaHItFSOxwZGkGc+sO1VmZku2WcweBSsVIzyYny40FkAIY0VgkRJmrWjeCwqKHK2G6YjdkMsAugXK6b6k4KHSidgAsSFWpjN7zhng9DaDnaEGq3s5jbKwicQ3MH624H9/ jenkins@Zennor
#!/usr/bin/env ruby
board = ARGV[0]
def corner_available?(board)
[0,2,6,8].each do |num|
if board[num].chr.to_s == '-'
return num
end
end
end