Skip to content

Instantly share code, notes, and snippets.

View markburns's full-sized avatar
💭
👋

Mark Burns markburns

💭
👋
View GitHub Profile
@markburns
markburns / errorWrapper.js
Last active August 29, 2015 14:05
I wonder if there's any cross-browser libraries that do this kind of thing
error = {
message: "Expected true to be false.",
stack: "Error: Expected true to be false.\n at new jasmine.ExpectationResult (http://0.0.0.0:3001/relative/assets/jasmine/1.3.1.js?body=1:114:32)\n at null.toBe (http://0.0.0.0:3001/relative/assets/jasmine/1.3.1.js?body=1:1237:29)\n at null.<anonymous> (http://0.0.0.0:3001/relative/assets/integration/integration_spec.js?body=1:11:27)\n at jasmine.Block.execute (http://0.0.0.0:3001/relative/assets/jasmine/1.3.1.js?body=1:1066:17)\n at jasmine.Queue.next_ (http://0.0.0.0:3001/relative/assets/jasmine/1.3.1.js?body=1:2098:31)\n at jasmine.Queue.start (http://0.0.0.0:3001/relative/assets/jasmine/1.3.1.js?body=1:2051:8)\n at jasmine.Spec.execute (http://0.0.0.0:3001/relative/assets/jasmine/1.3.1.js?body=1:2378:14)\n at jasmine.Queue.next_ (http://0.0.0.0:3001/relative/assets/jasmine/1.3.1.js?body=1:2098:31)\n at jasmine.Queue.start (http://0.0.0.0:3001/relative/assets/jasmine/1.3.1.js?body=1:2051:8)\n at jasmine.Suite.execute (http://
@markburns
markburns / IterableSpy
Last active August 29, 2015 14:10
Unsure what methods are used on an object in a Rails application?
[2014-12-02 09:47:22.581] INFO Region requires .display_name (called with [])
[2014-12-02 09:47:22.581] INFO Region requires display_name.downcase (called with [])
[2014-12-02 09:47:22.977] INFO Region requires .countries (called with [])
[2014-12-02 09:47:22.977] INFO Region requires countries.select (called with [])
[2014-12-02 09:47:22.977] INFO Region requires countries.select.sort_by (called with [])
[2014-12-02 09:47:23.113] INFO Region requires display_name.downcase.to_ascii (called with [])
[2014-12-02 09:47:23.121] INFO regions requires .display_name (called with [])
[2014-12-02 09:47:23.123] INFO regions requires .sid (called with [])
[2014-12-02 09:47:23.127] INFO Region requires countries.select.sort_by.each (called with [])
[2014-12-02 09:47:23.129] INFO Region requires countries.select.sort_by.block-inside-each (called with [])
@markburns
markburns / keybase.md
Created December 18, 2014 15:21
keybase.md

Keybase proof

I hereby claim:

  • I am markburns on github.
  • I am markburns (https://keybase.io/markburns) on keybase.
  • I have a public key whose fingerprint is D3E9 6B0C 2017 9491 F331 D76A F947 3B24 BAC1 25F1

To claim this, I am signing this object:

@markburns
markburns / ec.go
Last active August 29, 2015 14:15
package ec
import (
big "math/big"
)
type Point struct {
X *big.Int
Y *big.Int
}
module Kernel
def TODO(msg="")
$stderr.puts "#{__method__}: #{msg} #{[ caller[1]]}"
end
end
@markburns
markburns / lsm.rb
Created March 23, 2010 20:16
#A very simple script to display rails migrations in alphabetic order
#!/usr/bin/ruby
#Util to show migrations in a nice to read format
#Highlights current version of db in red
#requires term-ansicolor gem
#usage - copy to your rails root, chmod +x lsm.rb , then ./lsm or ./lsm s to sort alphabetically
require 'date'
require 'rubygems'
require 'term/ansicolor'
include Term::ANSIColor
@markburns
markburns / markdown
Created March 23, 2010 21:40
Adapted script to preview markdown in a browser
#!/usr/bin/env ruby
#Adapted from http://pragmatig.wordpress.com/2009/06/17/quick-markdown-preview-for-github-readme/
#Added --firefox or -f parameter so that it won't open firefox each time, and you can just hit refresh instead.
raise "Usage:\nmarkdown <filename> [-f|--firefox]" unless ARGV[0]
require 'rubygems'
#e.g. rdiscount, gem install rdiscount (or any other bluecloth flavour...)
require 'markdown'
Building native extensions. This could take a while...
ERROR: Error installing bloopsaphone:
ERROR: Failed to build gem native extension.
/home/mark/.rvm/rubies/ruby-1.8.7-p249/bin/ruby extconf.rb
checking for main() in -lportaudio... yes
creating Makefile
make
gcc -I. -I. -I/home/mark/.rvm/rubies/ruby-1.8.7-p249/lib/ruby/1.8/i686-linux -I. -D_FILE_OFFSET_BITS=64 -fPIC -g -O2 -I../../c -c bloopsaphone.c
@markburns
markburns / exception_finder.rb
Last active September 14, 2015 22:54
Find all raises and exception definitions in dependencies of slanger
require 'bundler/setup'
require "slanger"
require "byebug"
paths = `bundle show --paths`.split("\n").map &:chomp
def search_for(paths, search)
paths.reject{|p| (p =~ /\/slanger/) || (p =~ /\/bundler-/) || (p =~ /\/pry-/) || (p=~/\/minitest-/)}.map do |p|
gem = File.basename(p).split("-").first
gem = {"activesupport" => "active_support"}[gem] || gem
@markburns
markburns / post-commit
Created November 17, 2010 17:56
Checks the spec and features directory for any "I debug", "show me the page" or "show_me_the_page" and prevents a commit if so
#!/usr/bin/env ruby
require 'rubygems'
begin
require 'term/ansicolor'
include Term::ANSIColor
rescue LoadError
puts "To get color from this post-commit hook install term/ansicolor"
%w[red blue green].each { |color| eval "def #{color} &blk; blk.call; end" }
end