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
# -*- coding: utf-8 -*- | |
$:.unshift File.dirname(__FILE__) | |
require 'yaml' | |
require 'bundler' | |
require 'rgl/adjacency' | |
require 'rgl/bidirectional' | |
#load all necessary environment related things | |
def loadenv | |
config = YAML.load_file('config.yml') |
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
%self total self wait child calls name | |
3.65 0.405 0.254 0.000 0.151 3001 Mongo::Cursor#initialize | |
3.53 0.791 0.246 0.000 0.545 12001 *Mutex#synchronize | |
3.51 0.904 0.245 0.000 0.660 3000 Mongo::Collection#find | |
3.44 0.240 0.240 0.000 0.000 8116 <Class::IO>#select | |
2.95 0.775 0.205 0.000 0.570 3001 Mongo::Collection#initialize | |
2.52 0.226 0.175 0.000 0.051 9003 BSON::ByteBuffer#put_binary | |
2.05 0.546 0.143 0.000 0.403 3001 Mongo::Networking#read_documents | |
1.82 0.466 0.126 0.000 0.340 8116 Mongo::TCPSocket#read | |
1.77 1.552 0.123 0.000 1.429 16075 *Class#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
function foo(i) { | |
if (i < 0) | |
return; | |
document.writeln('begin:' + i); | |
foo(i - 1); | |
document.writeln('end:' + i); | |
} | |
foo(3); |
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
for i in `find app/views/devise/ -name '*.erb'` ; do html2haml -e $i ${i%erb}haml ; rm $i ; done |
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
arr = [1,2,3,4,5,6] | |
arr[1..2] | |
arr[1,2] |
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 BufferLoader(context, urlList, callback) { | |
this.context = context; | |
this.urlList = urlList; | |
this.onload = callback; | |
this.bufferList = new Array(); | |
this.loadCount = 0; | |
} | |
BufferLoader.prototype.loadBuffer = function(url, index) { | |
// Load buffer asynchronously |
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 initialize(options={}) | |
options.each do |key, value| | |
key = key.to_s | |
FriendRecommenderDB.class_eval do | |
attr_accessor key | |
end | |
send("#{key}=", value) | |
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
def get_linefunc(self, start_p, end_p): #just for 2nd euclidian space | |
x1, y1 = start_p[0], start_p[1] | |
x2, y2 = end_p[0], end_p[1] | |
a = 0 if ((x2-x1) == 0) else (y2-y1)/(x2-x1) | |
b = -1 | |
c = x1*a - y1 | |
return {'a':a, 'b':b, 'c':c} |
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
source 'https://rubygems.org' | |
gem 'active_model_serializers', git: 'git://github.com/rails-api/active_model_serializers.git' | |
gem 'ember-rails', git: 'git://github.com/emberjs/ember-rails.git' # so we get the pre version | |
gem 'rack-mini-profiler', git: 'git://github.com/SamSaffron/MiniProfiler' | |
gem 'vestal_versions', git: 'git://github.com/zhangyuan/vestal_versions' | |
gem 'message_bus', path: 'vendor/gems/message_bus' | |
gem 'rails_multisite', path: 'vendor/gems/rails_multisite' | |
gem 'simple_handlebars_rails', path: 'vendor/gems/simple_handlebars_rails' |
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
rand(36**length).to_s(36) |