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
module Accountable | |
class Transaction < ::ActiveRecord::Base # to ensure not clashing with Accountable::ActiveRecord::Macro | |
has_many :credits | |
has_many :debits | |
end | |
end | |
module Accountable | |
module Accounts | |
class Base < ::ActiveRecord::Base #see above |
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
>> pounds = 1.5 | |
=> 1.5 | |
>> ounces = (1 - "0.#{pounds.to_s.split('.').last}".to_f) * 16 | |
=> 8.0 |
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
unless Object.const_defined? 'WillPaginate' | |
module ActiveRecord | |
class Base | |
class << self | |
def paginate( options = {} ) | |
find( :all, options.except( :page, :per_page ) ) | |
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 ApplicationController < AC::Base | |
def with_etags( *etag, &block ) | |
etag = supplement_etag!( etag ).compact | |
logger.info "** Etag source: #{etag.inspect}" | |
response.last_modified = last_modified_for_etag( etag ).sort.last || now | |
logger.info "** Response Last Modified: #{response.last_modified}" | |
response.etag = etag | |
logger.info "** Response Etag: #{response.etag.inspect}" | |
if request.fresh?(response) |
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
ActiveRecord::ConnectionAdapters::MysqlAdapter.class_eval do | |
def execute(sql, name = nil) #:nodoc: | |
if @connection.respond_to?(:async_query) | |
log(sql, "Async #{name || ''}") { @connection.async_query(sql) } | |
else | |
log(sql, name) { @connection.query(sql) } | |
end | |
rescue ActiveRecord::StatementInvalid => exception | |
if exception.message.split(":").first =~ /Packets out of order/ |
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
/* Return 0 if there is data to be read */ | |
my_bool vio_poll_read(Vio *vio,uint timeout) | |
{ | |
#ifndef HAVE_POLL | |
return 0; | |
#else | |
struct pollfd fds; | |
int res; | |
DBUG_ENTER("vio_poll"); |
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
/* <MYSQL_ROOT>/vio/vio.c */ | |
/* Copyright (C) 2000 MySQL AB | |
This program is free software; you can redistribute it and/or modify | |
it under the terms of the GNU General Public License as published by | |
the Free Software Foundation; version 2 of the License. | |
This program is distributed in the hope that it will be useful, | |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
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
macbook-pros-computer:Ruby lourens$ sudo dtrace -n 'syscall:::entry/execname == "ruby"/{ @[execname, probefunc] = count() }' | |
dtrace: description 'syscall:::entry' matched 427 probes | |
^C | |
ruby execve 1 | |
ruby exit 1 | |
ruby fork 1 | |
ruby getdtablesize 1 | |
ruby kill 1 | |
ruby mkdir 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
# modified <RAILS_ROOT/script/console overloading the irb executeable ( assumes script/irb ) | |
#!/usr/bin/env ruby | |
ARGV << "--irb=#{File.dirname(__FILE__)}/irb" | |
require File.dirname(__FILE__) + '/../config/boot' | |
require 'commands/console' | |
#<RAILS_ROOT>/script/irb or elsewhere | |
#!/usr/bin/env ruby |
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
module ActiveSupport | |
class BufferedLogger | |
def <<( message ) | |
info( message ) | |
end | |
end | |
end | |
OlderNewer