Skip to content

Instantly share code, notes, and snippets.

View markburns's full-sized avatar
💭
👋

Mark Burns markburns

💭
👋
View GitHub Profile
module DomainConcepts
def self.prepended(base)
base.class_eval do
before_action :set_view_paths
end
end
%i(index show edit new).each do |a|
define_method a do
super()
Process: ruby [82556]
Path: /Users/USER/*/ruby
Identifier: ruby
Version: 0
Code Type: X86-64 (Native)
Parent Process: zsh [64346]
Responsible: iTerm2 [632]
User ID: 501
Date/Time: 2016-10-11 05:57:48.373 +0100
@markburns
markburns / dbg.rb
Last active March 10, 2016 09:51
dbg.rb
require "binding_of_caller"
class BasicObject
def dbg(variable_name=nil)
puts ">" * 80
other_binding = binding.of_caller(1)
vars =
other_binding.eval("local_variables") +
other_binding.eval("instance_variables")
@markburns
markburns / Gemfile
Created November 12, 2015 22:46
Simple call forwarding with Twilio
source 'https://rubygems.org'
gem 'rack'
@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
module Kernel
def TODO(msg="")
$stderr.puts "#{__method__}: #{msg} #{[ caller[1]]}"
end
end
@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
}
@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 / metro_bank_csv_converter.rb
Last active March 11, 2018 19:44
MetroBank UK to FreeAgent CSV format converter
require "csv"
class MetroBankCsvConverter
def initialize(lines)
lines =lines.split("\n")
lines.shift(3)
lines = lines.join("\n")
@raw_csv = CSV.parse(lines, headers: headers)
end
@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 [])