Skip to content

Instantly share code, notes, and snippets.

View methodmissing's full-sized avatar

Lourens Naudé methodmissing

View GitHub Profile
static void free_mysqlres(struct mysql_res* resp)
{
if (resp->freed == Qfalse) {
mysql_free_result(resp->res);
store_result_count--;
}
xfree(resp);
}
module Rails
# The Plugin class should be an object which provides the following methods:
#
# * +name+ - Used during initialisation to order the plugin (based on name and
# the contents of <tt>config.plugins</tt>).
# * +valid?+ - Returns true if this plugin can be loaded.
# * +load_paths+ - Each path within the returned array will be added to the <tt>$LOAD_PATH</tt>.
# * +load+ - Finally 'load' the plugin.
#
# These methods are expected by the Rails::Plugin::Locator and Rails::Plugin::Loader classes.
def initialize(direction, migrations_path, target_version = nil)
raise StandardError.new("This database does not yet support migrations") unless Base.connection.supports_migrations?
Base.connection.initialize_schema_migrations_table
@direction, @migrations_path, @target_version = direction, migrations_path, target_version
end
desc "Raises an error if there are pending migrations"
task :abort_if_pending_migrations => :environment do
if defined? ActiveRecord
pending_migrations = ActiveRecord::Migrator.new(:up, 'db/migrate').pending_migrations
if pending_migrations.any?
puts "You have #{pending_migrations.size} pending migrations:"
pending_migrations.each do |pending_migration|
puts ' %4d %s' % [pending_migration.version, pending_migration.name]
end
module Rake
class Task
def remove_prerequisite(task_name)
name = task_name.to_s
@prerequisites.delete(name)
end
end
end
213-138-231-67:matzruby lourens$ sudo ./instrument/gc.d -c "./ruby instrument/gc.rb"
ELAPSED TIME DISTRIBUTION,
calloc
value ------------- Distribution ------------- count
2048 | 0
4096 |@@@@@@@@ 182
8192 | 1
16384 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 678
32768 | 0
213-138-231-67:matzruby lourens$ sudo ./instrument/gc.d -c "./ruby instrument/gc.rb"
Password:
ELAPSED TIME DISTRIBUTION,
unregister_address
value ------------- Distribution ------------- count
2048 | 0
4096 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1
8192 | 0
mri:
thread:
thread_switch:
- char: 'Thread Status'
- int: 'Restore'
cache:
clear_cache:
clear_cache_by_class:
- char: 'Class'
clear_cache_by_id:
mri:
thread:
thread_switch:
- char: 'Thread Status'
- int: 'Restore'
cache:
clear_cache:
clear_cache_by_class:
- char: 'Class'
clear_cache_by_id:
rb_memerror:
ruby_xmalloc:
- long: 'Allocation Size'
ruby_xcalloc:
- long: 'Number'
- long: 'Allocation Size'
ruby_xrealloc:
- pointer: 'Address'
- long: 'Allocation Size'
ruby_xfree: