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
| lib_dir = File.expand_path(File.join(File.dirname(__FILE__), 'lib')) | |
| $LOAD_PATH.unshift(lib_dir) unless $LOAD_PATH.include?(lib_dir) |
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
| # | |
| # Rakefile with a C Library with the following tree: | |
| #├── library | |
| #│ ├── something.c | |
| #│ └── something.h | |
| #├── specifications | |
| #│ ├── all_specifications.c | |
| #│ ├── all_specifications.o | |
| #│ ├── something_spec.c | |
| #│ └── something_spec.o |
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
| // dict.h | |
| typedef struct dictEntry { | |
| void *key; | |
| void *val; | |
| struct dictEntry *next; | |
| } dictEntry; | |
| typedef struct dictht { | |
| dictEntry **table; |
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
| /* Hash Tables Implementation. | |
| * | |
| * This file implements in memory hash tables with insert/del/replace/find/ | |
| * get-random-element operations. Hash tables will auto resize if needed | |
| * tables of power of two in size are used, collisions are handled by | |
| * chaining. See the source code for more information... :) | |
| * | |
| */ | |
| #include <stdlib.h> |
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
| >> env = RVM::Environment.new('1.9.2') | |
| >> env.env_contents | |
| => "export PATH=\"/Users/tomas/.rvm/gems/ruby-1.9.2-p0/bin:/Users/tomas/.rvm/gems/ruby-1.9.2-p0@global/bin:/Users/tomas/.rvm/rubies/ruby-1.9.2-p0/bin:/Users/tomas/.rvm/bin:$PATH\"\nRUBY_VERSION='ruby-1.9.2-p0'\nexport RUBY_VERSION\nGEM_HOME='/Users/tomas/.rvm/gems/ruby-1.9.2-p0'\nexport GEM_HOME\nGEM_PATH='/Users/tomas/.rvm/gems/ruby-1.9.2-p0:/Users/tomas/.rvm/gems/ruby-1.9.2-p0@global'\nexport GEM_PATH\nBUNDLE_PATH='/Users/tomas/.rvm/gems/ruby-1.9.2-p0'\nexport BUNDLE_PATH\nMY_RUBY_HOME='/Users/tomas/.rvm/rubies/ruby-1.9.2-p0'\nexport MY_RUBY_HOME\nIRBRC='/Users/tomas/.rvm/rubies/ruby-1.9.2-p0/.irbrc'\nexport IRBRC\nrvm_ruby_string='ruby-1.9.2-p0'\nexport rvm_ruby_string\nunset rvm_gemset_name\nunset MAGLEV_HOME\n" |
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
| ###### One way | |
| ActiveRecord::Base.record_timestamps = false | |
| # set timestamps manually | |
| ActiveRecord::Base.record_timestamps = true | |
| ###### Other way |
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 'mkmf' | |
| extension_name = 'relation_table' | |
| dir_config(extension_name) | |
| # Source files with header and *.c and *.o files | |
| # | |
| RELATION_HEADER_PATH = File.expand_path(File.join(File.dirname(__FILE__), '..', 'source')) | |
| RELATION_HEADER_FLAG = "-I #{RELATION_HEADER_PATH}" |
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
| Simple Query | |
| 10.000 Queries 0.320000 0.000000 0.320000 ( 0.333302) | |
| 100.000 Queries 3.090000 0.010000 3.100000 ( 3.115193) | |
| 1.000.000 Queries 30.850000 0.080000 30.930000 ( 31.036174) | |
| Add some little complexity =p | |
| 10.000 Queries 0.550000 0.000000 0.550000 ( 0.551271) | |
| 100.000 Queries 5.550000 0.020000 5.570000 ( 5.643197) | |
| 1.000.000 Queries 55.670000 0.180000 55.850000 ( 56.547011) |
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
| open('some_file', "r:UTF-8") do |file| | |
| puts file.external_encoding.name | |
| p file.internal_encoding | |
| file.each do |line| | |
| p [line.encoding.name, line] | |
| 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
| 10.000 Queries 0.030000 0.000000 0.030000 ( 0.031400) | |
| 100.000 Queries 0.300000 0.010000 0.310000 ( 0.307062) | |
| 1.000.000 Queries 3.070000 0.060000 3.130000 ( 3.150164) | |
| A Little more complexity =p | |
| 10.000 Queries 0.090000 0.000000 0.090000 ( 0.086945) | |
| 100.000 Queries 0.840000 0.020000 0.860000 ( 0.857581) | |
| 1.000.000 Queries 8.360000 0.200000 8.560000 ( 8.568261) |