Skip to content

Instantly share code, notes, and snippets.

View knutsenm's full-sized avatar

Mark Knutsen knutsenm

  • Cru
  • Orlando, FL
View GitHub Profile
.org $8000
.org $ff00
XAML = $24 ; Last "opened" location Low
XAMH = $25 ; Last "opened" location High
STL = $26 ; Store address Low
STH = $27 ; Store address High
L = $28 ; Hex value parsing Low
H = $29 ; Hex value parsing High
YSAV = $2A ; Used to see if hex value is given
@soberstadt
soberstadt / prof.rb
Last active February 17, 2017 15:30
A script to paste into your rails console to evaluate performance of arbitrary command
# frozen_string_literal: true
# find ruby-prof gem on global scope
@ruby_prof_path = `cd .. && gem which ruby-prof`
if path.blank?
# install ruby-prof if we can't find it
`cd .. && gem install ruby-prof`
@ruby_prof_path = `cd .. && gem which ruby-prof`
end
@ruby_prof_path = @ruby_prof_path.sub(/ruby-prof.rb\n/, '')
@cantino
cantino / object_comparison_helper.rb
Created September 21, 2015 21:23
Recursive Ruby data structure diff
module ObjectComparisonHelper
def deep_hash_diff(obj1, obj2, path = 'root', differences = [])
if obj1.class != obj2.class
differences << "object types differ at #{path}: #{obj1.class} vs #{obj2.class}"
else
case obj1
when Hash, HashWithIndifferentAccess
differences << "key sets differ at #{path}: #{obj1.keys.inspect} vs #{obj2.keys.inspect}" if obj1.keys.to_set != obj2.keys.to_set
obj1.each do |key, value|
deep_hash_diff(value, obj2[key], "#{path}.#{key}", differences)
@codespore
codespore / Active_Admin_Cheats.rb
Last active August 30, 2022 14:17
Quick reference to useful ActiveAdmin customizations
# Add Action button on the top navigation menu. Useful for resource with nested resources
action_item :only => :show do
link_to('Show Users', admin_group_users_path(resource))
end
# Custom show page with children items
show do