Skip to content

Instantly share code, notes, and snippets.

View epochwolf's full-sized avatar

Epoch Wolf epochwolf

View GitHub Profile
@jwise
jwise / Example usage
Created October 16, 2011 03:40
A few short scripts to walk through Lua tables in GDB
(gdb) lua_globals L
(gdb) lua_gettype $rv
(gdb) lua_gettable $rv "string"
Walking node part...
Value at node idx 1 Key [STRING]: string -> value type 5 @ (TValue *)0x81012cc
(gdb) lua_gettype $rv
(gdb) lua_walktable $rv
Walking array part...
Walking node part...
Value at node idx 0 Key [STRING]: sub -> value type 6 @ (TValue*)0x8100160
@rthbound
rthbound / puts_callbacks.rb
Last active December 17, 2015 04:19
Paste this into the rails console and see the total number of callbacks your application has defined for its models.
Rails.application.eager_load!
models = ActiveRecord::Base.descendants.map(&:name)
callbacks = []
callback_types = %w{ _save_callbacks _create_callbacks _destroy_callbacks _validation_callbacks _commit_callbacks }
callback_types.each do |callback_type|
models.each do |model|
callbacks << instance_eval(model).send(callback_type)
end;nil