This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Object | |
def pose_as(klass) | |
namespace = klass.to_s.split("::") | |
klass = namespace.pop | |
if namespace.any? | |
eval <<-EOT | |
module ::#{namespace.join("::")} | |
send(:remove_const, :"#{klass}") | |
#{klass} = #{self} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'benchmark' | |
$require_level = 0 | |
module Kernel | |
alias require_without_timing require | |
def require(path) | |
result = seconds = nil | |
begin | |
$require_level += 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Module | |
def method_added(symbol) | |
p caller if symbol == :h | |
end | |
end | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ActiveRecord::ConnectionAdapters::AbstractAdapter | |
def called_by(original_caller) | |
str = original_caller.reject { |info| !info.match /#{Rails.root}/ }.first | |
str.gsub(Rails.root,'') | |
end | |
def log_info(sql, name, ms) | |
if @logger && @logger.debug? | |
name = '%s (%.1fms) %s' % [name || 'SQL', ms, called_by(caller)] | |
@logger.debug(format_log_entry(name, sql.squeeze(' '))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[mysqld] | |
max_allowed_packet = 16M | |
innodb_file_per_table | |
query_cache_size = 32M | |
innodb_additional_mem_pool_size = 256M | |
innodb_buffer_pool_size = 512M | |
innodb_log_buffer_size = 256M | |
innodb_log_file_size = 256M | |
#bulk_insert_buffer_size = 256M | |
innodb_flush_method = O_DSYNC |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/ext/perftools.c b/ext/perftools.c | |
index e6f97f1..ace2e01 100644 | |
--- a/ext/perftools.c | |
+++ b/ext/perftools.c | |
@@ -159,6 +159,8 @@ static VALUE Isend; | |
case VM_FRAME_MAGIC_CFUNC: | |
self = cfp->self; | |
#ifdef HAVE_METHOD_H | |
+ if (! cfp->me) break; | |
+ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
New file: inline_levenshtein | |
inline do |builder| | |
builder.add_link_flags '-lruby' | |
builder.c_raw <<-EOT | |
long minimum(long a,long b,long c) | |
/*Gets the minimum of three values*/ | |
{ | |
long min=a; | |
if(b<min) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(in /Users/thieso/zips/plat_forms_2011) | |
+----------------------+-------+-------+---------+---------+-----+-------+ | |
| Name | Lines | LOC | Classes | Methods | M/C | LOC/M | | |
+----------------------+-------+-------+---------+---------+-----+-------+ | |
| Controllers | 471 | 384 | 14 | 50 | 3 | 5 | | |
| Helpers | 41 | 38 | 0 | 5 | 0 | 5 | | |
| Models | 522 | 416 | 11 | 45 | 4 | 7 | | |
| Libraries | 30 | 27 | 1 | 3 | 3 | 7 | | |
| Integration tests | 64 | 49 | 3 | 1 | 0 | 47 | | |
| Functional tests | 592 | 478 | 8 | 1 | 0 | 476 | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function calculate_total($haehnchen_preis, $haehnchen_anzahl) { | |
$mein_profit = 100; | |
return $haehnchen_preis * $haehnchen_anzahl + $mein_profit; | |
} | |
?> |
OlderNewer