This file contains 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
/* | |
* Copyright (C) 2011, 2012, 2013, 2014 Mail.RU | |
* Copyright (C) 2011, 2012, 2013, 2014 Yuriy Vostrikov | |
* Copyright (C) 2014 Yuriy Sokolov aka funny_falcon | |
* | |
* Redistribution and use in source and binary forms, with or without | |
* modification, are permitted provided that the following conditions | |
* are met: | |
* 1. Redistributions of source code must retain the above copyright | |
* notice, this list of conditions and the following disclaimer. |
This file contains 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::Associations::AssociationCollection | |
def has_finder_sql_with_select? | |
@finder_sql =~ /^\s*select\s/i | |
end | |
def find(*args) | |
options = args.extract_options! | |
# If using a custom finder_sql, scan the entire collection. | |
if has_finder_sql_with_select? |
This file contains 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
DB_NAME=local_database | |
FILE_NAME=dump.sql | |
REMOTE_DB_NAME=remote_database | |
REMOTE_HOST=user@host.com | |
REMOTE_DBUSER=postgres | |
cat <<EOF > $FILE_NAME | |
\c postgres | |
DROP DATABASE $DB_NAME ; | |
CREATE DATABASE $DB_NAME ; |
This file contains 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
BENCH http://localhost:9294/h | |
** SIEGE 2.69 | |
** Preparing 15 concurrent users for battle. | |
The server is now under siege... | |
Lifting the server siege... done. | |
Transactions: 1945 hits | |
Availability: 100.00 % | |
Elapsed time: 19.99 secs | |
Data transferred: 0.01 MB |
This file contains 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 File.dirname(__FILE__) + '/sin.rb' | |
run Sinatra::Application |
This file contains 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 Date | |
module Format | |
class Bag | |
A_FIELDS = %w{year mon mday hour min sec sec_fraction offset zone wday} | |
for fld in A_FIELDS + %w{_comp} | |
attr_accessor fld.to_sym | |
end | |
to_hash = A_FIELDS.map{|fld| "res[:#{fld}] = @#{fld} unless @#{fld}.nil?"}.join("\n") | |
class_eval <<-"END" |
This file contains 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
~/tmp/ruby-sequel$ ruby test_sequel_times.rb | |
user system total real | |
base 6.870000 0.200000 7.070000 ( 7.534538) | |
~/tmp/ruby-sequel$ ruby test_sequel_times.rb home_run | |
user system total real | |
home_run 5.350000 0.160000 5.510000 ( 5.856684) | |
~/tmp/ruby-sequel$ ruby test_sequel_times.rb fix | |
user system total real | |
fix 2.490000 0.150000 2.640000 ( 2.807951) |
This file contains 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 Time | |
class << self | |
def relaxed_rfc3339(date) | |
if /\A\s* | |
(-?\d+)-(\d\d)-(\d\d) | |
[T ] | |
(\d\d):(\d\d):(\d\d) | |
(?:\.(\d+))? | |
(Z|[+-]\d\d(?::?\d\d)?)? | |
\s*\z/ix =~ date |
This file contains 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/load.c b/load.c | |
index 0ff4b60..019ccb9 100644 | |
--- a/load.c | |
+++ b/load.c | |
@@ -18,6 +18,7 @@ VALUE ruby_dln_librefs; | |
#define IS_DLEXT(e) (strcmp((e), DLEXT) == 0) | |
#endif | |
+static int sorted_loaded_features = 1; | |
This file contains 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
# The Computer Language Benchmarks Game | |
# http://shootout.alioth.debian.org/ | |
# | |
# contributed by Karl von Laudermann | |
# modified by Jeremy Echols | |
# modified by Detlef Reichl | |
# modified by Joseph LaFata | |
# modified by Peter Zotov | |
# modified by Brian Ford | |
# modified by Yura Sokolov |
OlderNewer