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
| # find( | |
| # :select => 'DISTINCT identity_providers.*', | |
| # :joins => [:datasources], | |
| # :conditions => 'datasources.pull' | |
| # ) | |
| SELECT DISTINCT identity_providers.* | |
| FROM identity_providers | |
| INNER JOIN datasources | |
| ON identity_providers.id = datasources.identity_provider_id |
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
| def myvalue | |
| if cached = get_cached(:myvalue) | |
| return cached | |
| else | |
| set_cache(:myvalue, value) | |
| end | |
| end | |
| def get_cached(key) | |
| get cache here |
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 'rubygems' | |
| $:.push File.join(File.dirname(__FILE__), 'redis-rb', 'lib') | |
| require File.join(File.dirname(__FILE__), 'columnstore') | |
| require 'benchmark' | |
| require 'redis' | |
| begin | |
| redis = Redis.new | |
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
| >> puts Benchmark.measure { 100000.times{ 1.is_a?(String) } } | |
| 0.050000 0.000000 0.050000 ( 0.045655) | |
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
| def close | |
| socket.close unless socket.closed? | |
| end | |
| def timeout_retry(time, retries, &block) | |
| timeout(time, &block) | |
| rescue TimeoutError | |
| retries -= 1 | |
| retry unless retries < 0 | |
| 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
| require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') | |
| describe Socialytical::RTable do | |
| before(:each) do | |
| @r = Redis.new | |
| @r.keys('benchmark*').each {|k| @r.delete k } | |
| end | |
| it "should benchmark low dimensionality" do | |
| table = Socialytical::PTable.new( |
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
| var callback = function(movieclip, eye) { | |
| var clip = movieclip; | |
| var i = eye; | |
| return function(e:MouseEvent) { | |
| trace(i); | |
| } | |
| } | |
| var foo = function() { | |
| for (var i = 0; i < count; i++) { |
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
| function foo() { | |
| for (var i = 0; i < count; i++) { | |
| var myObject:MovieClip = new Whatever(); | |
| var assigned_i = i; | |
| myObject.addEventListener(MOUSE_UP, | |
| function(e:MouseEvent) { | |
| trace(assigned_i); | |
| } | |
| ); | |
| } |
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 'rubygems' | |
| require 'benchmark' | |
| require 'activesupport' | |
| class Table | |
| attr_accessor :storage | |
| attr_accessor :dimensions | |
| attr_accessor :indices | |
| def initialize(*dimensions) |
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 'rubygems' | |
| require 'benchmark' | |
| require 'activesupport' | |
| class Table | |
| attr_accessor :storage | |
| attr_accessor :dimensions | |
| def initialize(*dimensions) | |
| @storage = [] |