This file contains 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
alias show-changed-directories="gd master --name-only | sort | sed -e 's/\/[^\/]*rb$//' |sed -e 's/\/.*\.js$//' | sed -e 's/\/.*\.haml$//' | sed -e 's/\/.*yml$//' | sort | uniq" | |
alias show-changed-specs="git diff master --name-only | grep spec.rb " | |
alias run-changed-specs="show-changed-specs | xargs zeus rspec" | |
alias update-pr="git checkout master && git pull --rebase && git checkout - && git rebase master" | |
alias docker-env-eval='eval "$(docker-machine env default)"' | |
alias docker-machine-refresh='(docker-machine stop || docker-machine kill) ; docker-machine start; docker-env-eval' | |
alias docker-setup="yes | docker-machine regenerate-certs && docker-env-eval && docker-machine start default" |
This file contains 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 "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 |
This file contains 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
module SomeClass | |
SomeClass == self | |
def self.a_class_method(options) | |
SomeClass == self | |
end | |
class << self | |
SomeClass.singleton_class == self |
This file contains 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 bash | |
git rev-parse --abbrev-ref HEAD | tail -2 |
This file contains 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
# spec/lint_spec.rb | |
require "rails_helper" | |
RSpec.describe "Lint" do | |
it "FactoryGirl" do | |
should_run = directory_changed?("spec/factories") || directory_changed?("db") | |
next unless should_run | |
FactoryGirl.lint |
This file contains 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 | |
def do_something_probably_just_in_this_script! | |
puts "called in #{self} from #{caller[-1]}" | |
end | |
module HeresAnother | |
def this_one | |
puts "called in #{self} from #{caller[-1]}" | |
end |
This file contains 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
{"step_number":1,"stack_uuid":"7b5a17fa-8abc-4dda-854b-a251b4d2593a","call_site_file":"spec/bundler/plugin/api/source_spec.rb","call_site_line_number":10,"container_method_klass_name":"RSpec::ExampleGroups::BundlerPluginAPISource::Attributes","container_method_type":"InstanceMethod","container_method_name":"source","container_method_file":"/Users/markburns/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/rspec-core-3.5.4/lib/rspec/core/memoized_helpers.rb","container_method_line_number":295,"called_method_klass_name":null,"called_method_type":"InstanceMethod","called_method_name":"initialize","called_method_file":"lib/bundler/plugin/api/source.rb","called_method_line_number":47} | |
{"step_number":1,"stack_uuid":"810ec287-64bd-4241-9924-ff5f958f62e5","call_site_file":"spec/bundler/plugin/api/source_spec.rb","call_site_line_number":10,"container_method_klass_name":"RSpec::ExampleGroups::BundlerPluginAPISource::Attributes","container_method_type":"InstanceMethod","container_method_name":"source","container_method_fil |
This file contains 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 "binding_of_caller" | |
Thread.current[:current_thread_local_info] = "value set inside (main)" | |
class A | |
def something | |
t = Thread.new do | |
Thread.current[:current_thread_local_info] = "value set inside A#something" | |
B.new.another_thing |
This file contains 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
# Example sets some state | |
class SomeObject | |
def self.asdf | |
@a = 1 | |
end | |
end | |
SomeObject.asdf | |
This file contains 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
git-expert () { | |
git log --all $1 | sed "s/.*\[\(.*\)\].*/\1/g" 2>/dev/null | sort | uniq -c | sort -r | |
} |