Skip to content

Instantly share code, notes, and snippets.

View BlakeWilliams's full-sized avatar
💭
building things, probably

Blake Williams BlakeWilliams

💭
building things, probably
View GitHub Profile
@BlakeWilliams
BlakeWilliams / tracer.rb
Created September 4, 2021 01:49
Track allocations by Ruby source file + line
require "objspace"
ObjectSpace.trace_object_allocations do
yield
end
allocations = ObjectSpace.each_object.map do |obj|
next if ObjectSpace.allocation_sourcefile(obj).nil?
next if ObjectSpace.allocation_sourcefile(obj) == __FILE__
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Ansi 0 Color</key>
<dict>
<key>Alpha Component</key>
<real>1</real>
<key>Blue Component</key>
<real>0.24705882370471954</real>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Ansi 0 Color</key>
<dict>
<key>Alpha Component</key>
<real>1</real>
<key>Blue Component</key>
<real>0.12941177189350128</real>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Ansi 0 Color</key>
<dict>
<key>Alpha Component</key>
<real>1</real>
<key>Blue Component</key>
<real>0.15686275064945221</real>
module Rescuable
extend ActiveSupport::Concern
class_methods do
def rescue_with_empty_content?
defined?(@rescue_with_empty_content) && @rescue_with_empty_content
end
def rescue_with_empty_content!
@rescue_with_empty_content = true
@BlakeWilliams
BlakeWilliams / crb.md
Last active July 22, 2020 14:00
Component Embedded Ruby ideas

Introduce a context concept that provides anything extra that may be passed to a component:

A component that supports context might be implemented like:

class MyComponent
  def context=(context)
    @context = context
  end
 
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Ansi 0 Color</key>
<dict>
<key>Alpha Component</key>
<real>1</real>
<key>Blue Component</key>
<real>0.32549020648002625</real>
module.exports = {
setupTestFrameworkScriptFile: '<rootDir>/setup.ts',
roots: ['<rootDir>/src'],
transform: {
'^.+\\.tsx?$': 'ts-jest',
},
testRegex: '(/__tests__/.*|(\\.|/)(test|spec))\\.tsx?$',
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
}
- run: echo 'export PRONTO_PULL_REQUEST_ID=$CIRCLE_PR_NUMBER' >> $BASH_ENV
- run: if [ $PRONTO_PULL_REQUEST_ID != false ]; then pronto run -f github_pr_review -c origin/master; fi
group :development, :test do
gem 'rubocop', '~> 0.55.0', require: false
end
group :test do
gem 'pronto'
gem 'pronto-rubocop', require: false
end