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 Conversation | |
#... | |
after_create :expire_dash_cache | |
def add_new_comments(comments) | |
# Do stuff w/ the new comments... | |
save | |
expire_dash_cache |
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
# Note: not tested at all | |
module Dada | |
attr_accessor :config_reload_timestamp | |
def dalli | |
@dalli ||= Dalli::Client.new(client_args) | |
end | |
def check_config_timestamp |
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
source 'http://rubygems.org' | |
gem 'rails', '3.0.7' | |
gem 'jquery-rails', '0.2.7' | |
gem 'uuid' | |
gem 'bson_ext' | |
gem 'mongo_ext' | |
gem 'mongo_mapper', '0.9.1' | |
gem 'devise' | |
gem 'mm-devise' |
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
ra:~ ryan$ nl scope.c | |
1 int main() { | |
2 int c = 0; | |
3 if (1) { | |
4 int i = 0; | |
5 } | |
6 c = 5; | |
7 i = 10; |
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 'ruby-svd' | |
class MiniPca | |
def self.go | |
var_count = 300 | |
doc_count = 100 | |
m = SVDMatrix.new(doc_count, var_count) | |
doc_count.times do |n| |
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
ruby-1.9.2-p180 :033 > Benchmark.measure { urls.each {|u| req = Typhoeus::Request.new(u); req.on_complete {|resp| puts [resp.code, resp.body.size].map(&:to_s).join(', ') }; hydra.queue(req) }; hydra.run } | |
301, 242 | |
302, 352 | |
301, 337 | |
302, 0 | |
301, 0 | |
200, 3291 | |
301, 350 | |
301, 178 | |
301, 417 |
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
// Ask Ramen 500 question on AJAX error | |
$(document).ajaxComplete(function(e, xhr, opts) { | |
// You may want to also catch 401, 403, 406, 422, etc.... | |
// Talk with your developers to figure out which status codes | |
// need to be monitored. | |
if (xhr.status > 499 && xhr.status < 510) { | |
if (Ramen) { | |
Ramen.event("560ad1f87765626520281000"); | |
} | |
} |
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
sg@max:/tmp/UnixBench$ ./Run | |
gcc -o ./pgms/arithoh -DTIME -Wall -pedantic -ansi -O2 -fomit-frame-pointer -fforce-addr -ffast-math -Wall -Darithoh ./src/arith.c | |
gcc -o ./pgms/register -DTIME -Wall -pedantic -ansi -O2 -fomit-frame-pointer -fforce-addr -ffast-math -Wall -Ddatum='register int' ./src/arith.c | |
gcc -o ./pgms/short -DTIME -Wall -pedantic -ansi -O2 -fomit-frame-pointer -fforce-addr -ffast-math -Wall -Ddatum=short ./src/arith.c | |
gcc -o ./pgms/int -DTIME -Wall -pedantic -ansi -O2 -fomit-frame-pointer -fforce-addr -ffast-math -Wall -Ddatum=int ./src/arith.c | |
gcc -o ./pgms/long -DTIME -Wall -pedantic -ansi -O2 -fomit-frame-pointer -fforce-addr -ffast-math -Wall -Ddatum=long ./src/arith.c | |
gcc -o ./pgms/float -DTIME -Wall -pedantic -ansi -O2 -fomit-frame-pointer -fforce-addr -ffast-math -Wall -Ddatum=float ./src/arith.c | |
gcc -o ./pgms/double -DTIME -Wall -pedantic -ansi -O2 -fomit-frame-pointer -fforce-addr -ffast-math -Wall -Ddatum=double ./src/arith.c | |
gcc -o ./pgms/hanoi -DTIME -Wall -pedantic -ansi -O2 -fomi |
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
sg@max:/tmp/UnixBench$ ./Run | |
gcc -o ./pgms/arithoh -DTIME -Wall -pedantic -ansi -O2 -fomit-frame-pointer -fforce-addr -ffast-math -Wall -Darithoh ./src/arith.c | |
gcc -o ./pgms/register -DTIME -Wall -pedantic -ansi -O2 -fomit-frame-pointer -fforce-addr -ffast-math -Wall -Ddatum='register int' ./src/arith.c | |
gcc -o ./pgms/short -DTIME -Wall -pedantic -ansi -O2 -fomit-frame-pointer -fforce-addr -ffast-math -Wall -Ddatum=short ./src/arith.c | |
gcc -o ./pgms/int -DTIME -Wall -pedantic -ansi -O2 -fomit-frame-pointer -fforce-addr -ffast-math -Wall -Ddatum=int ./src/arith.c | |
gcc -o ./pgms/long -DTIME -Wall -pedantic -ansi -O2 -fomit-frame-pointer -fforce-addr -ffast-math -Wall -Ddatum=long ./src/arith.c | |
gcc -o ./pgms/float -DTIME -Wall -pedantic -ansi -O2 -fomit-frame-pointer -fforce-addr -ffast-math -Wall -Ddatum=float ./src/arith.c | |
gcc -o ./pgms/double -DTIME -Wall -pedantic -ansi -O2 -fomit-frame-pointer -fforce-addr -ffast-math -Wall -Ddatum=double ./src/arith.c | |
gcc -o ./pgms/hanoi -DTIME -Wall -pedantic -ansi -O2 -fomi |
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
# Part 1 at https://gist.github.com/ryana/7e64954d8dd15c858f30 | |
def push_data_to_knowtify | |
api_token = "SEKRIT" | |
headers = {'Authorization' => "Token token=#{api_token}", 'Content-Type' => "application/json"} | |
url_base = "http://www.knowtify.io/api/v1" | |
endpoint = "/contacts/upsert" | |
data = { | |
contacts: [ | |
{ |