Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
👋

Mark Burns markburns

💭
👋
View GitHub Profile
@markburns
markburns / flow-pr
Created May 26, 2021
create draft pr
View flow-pr
#!/usr/bin/env bash
branch=${1:-$(current-branch)}
base_branch=${2:-develop}
# git push --force-with-lease || git push --set-upstream origin $branch
mkdir -p tmp/.github
VIM_FILE='tmp/.github/pr.md'
rm -f tmp/.github/pr.md
View awesome_print_presentation.md

10:00 awesome print

> require 'ap'
> ap 1.methods

9:45 and get this

View gist:b9ef6b250ad3a9107bb0efaceeeb34d3
### Keybase proof
I hereby claim:
* I am markburns on github.
* I am markburns (https://keybase.io/markburns) on keybase.
* I have a public key ASBr1rTAPuZ3Ckll7M_n6ba4hmpKz9C9U7dcJNZ5yMs87Ao
To claim this, I am signing this object:
@markburns
markburns / problematic_variable_finder.rb
Last active Feb 14, 2019
Find class variables, class instance variables, global variables and cattr_accessors etc in all your dependencies
View problematic_variable_finder.rb
require 'parser/current'
require 'active_support/all'
require 'rspec'
require 'byebug'
require 'pstore'
module FsCaching
def store
@store ||= PStore.new(".gem_problems.pstore")
end
View gist:ababd7e5c8c8b89dc0ea1ee780e44159
const values = [true, false, 1, 0, -1, "true", "false", "1", "0", "-1", "", undefined, Infinity, -Infinity, [], {}, [[]], [0], [1], NaN]
values.forEach(function(v){
values.forEach(function(v2){
var same = ((v==v2)==(v2==v));
if(!same){ console.log(v, v2, same)}
})
})
View prison_break.rb
module PrisonBreak
class Visit
attr_accessor :free_prisoner
attr_reader :prison, :payload
DISABLED_SYMBOLS = %w{, ` ( ? ! + <<}
DISABLED_WORDS = %w{send eval system exec popen rm puts require new load create file include free call push concat irb }
GUARD_RE = Regexp.new((DISABLED_SYMBOLS + DISABLED_WORDS).map {|i| Regexp.escape(i) }.join('|'))
View ruby_object_model_example.rb
module SomeClass
SomeClass == self
def self.a_class_method(options)
SomeClass == self
end
class << self
SomeClass.singleton_class == self
@markburns
markburns / lint_spec.rb
Created Jul 24, 2017
run lint and db:seed in specs only if changed
View lint_spec.rb
# 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
@markburns
markburns / a.rb
Last active Jul 13, 2017
Defining methods at the top level scope
View a.rb
#!/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
@markburns
markburns / delfos_queries_ab.errors
Last active Jun 27, 2017
delfos bundler errors
View delfos_queries_ab.errors
{"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