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 'benchmark' | |
Benchmark.bm do |x| | |
x.report("concatenation") do | |
for i in 0..30000000 do | |
str = "a=" << "10" << ",b=" << "20" << ",c=" << "30" << "." | |
end | |
end | |
x.report("interpolation") do |
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 http = require('http'), | |
faye = require('faye'); | |
var bayeux = new faye.NodeAdapter({ | |
mount: '/auctions', | |
timeout: 45 | |
}); | |
// Handle non-Bayeux requests | |
var server = http.createServer(function(request, response) { |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta http-equiv="Content-type" content="text/html; charset=utf-8"> | |
<title>Auctions Test</title> | |
<script type="text/javascript" charset="utf-8" src="node_modules/faye/faye-browser.js"></script> | |
<script type="text/javascript" charset="utf-8" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.0/jquery.js"></script> | |
<script type="text/javascript" charset="utf-8"> | |
bayeux_client = new Faye.Client('http://localhost:8000/auctions'); |
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
#using rack (delay in seconds) 10 client | |
[85520] diff: -0.12716197967529297 | |
[85518] diff: -0.12726306915283203 | |
[85513] diff: -0.11838006973266602 | |
[85514] diff: -0.11852812767028809 | |
[85515] diff: -0.11935830116271973 | |
[85517] diff: -0.11937212944030762 | |
[85520] diff: -0.12018418312072754 | |
[85519] diff: -0.12038922309875488 | |
[85518] diff: -0.12056493759155273 |
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
[ec2-user@ip-10-170-205-102 ~]$ rackup faye.ru -s thin -E production -p 8080 | |
>> Thin web server (v1.2.11 codename Bat-Shit Crazy) | |
>> Maximum connections set to 1024 | |
>> Listening on 0.0.0.0:8080, CTRL+C to stop | |
/home/ec2-user/.rvm/gems/ruby-1.9.2-p180/gems/eventmachine-0.12.10/lib/eventmachine.rb:375:in `add_oneshot_timer': ran out of timers; use #set_max_timers to increase limit (RuntimeError) | |
from /home/ec2-user/.rvm/gems/ruby-1.9.2-p180/gems/eventmachine-0.12.10/lib/eventmachine.rb:375:in `add_timer' | |
from /home/ec2-user/.rvm/gems/ruby-1.9.2-p180/gems/faye-0.5.5/lib/faye/mixins/timeouts.rb:7:in `add_timeout' | |
from /home/ec2-user/.rvm/gems/ruby-1.9.2-p180/gems/faye-0.5.5/lib/faye/protocol/connection.rb:104:in `begin_deletion_timeout' | |
from /home/ec2-user/.rvm/gems/ruby-1.9.2-p180/gems/faye-0.5.5/lib/faye/protocol/connection.rb:89:in `release_connection!' | |
from /home/ec2-user/.rvm/gems/ruby-1.9.2-p180/gems/faye-0.5.5/lib/faye/protocol/connection.rb:66:in `flush!' |
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 http = require('http'), | |
faye = require('faye'); | |
var bayeux = new faye.NodeAdapter({mount: '/test', timeout: 45}); | |
bayeux.listen(8000); |
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 'faye' | |
client = Faye::Client.new('http://localhost:8000/auctions') | |
EM.run do | |
10.times do |n| | |
client.publish("/#{n}", { | |
msg: 'obladioblada', | |
id: 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
PS1='\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ ' |
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
jQuery.fn.extend({ | |
position: function() { | |
if ( !this[0] ) { | |
return null; | |
} | |
var elem = this[0], | |
// Get *real* offsetParent | |
offsetParent = this.offsetParent(), |
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
#include "AnalogButtons.h" | |
int led_pin = 13; | |
int res_pin = A0; | |
int interrupt_pin = 0; | |
volatile int msec = 1000; | |
#define MODE_EDIT 0 | |
#define MODE_RUN 1 |