Skip to content

Instantly share code, notes, and snippets.

View abloom's full-sized avatar

Andrew Bloom abloom

  • Turquoise Health
  • Chicago Il
View GitHub Profile
@abloom
abloom / test.js
Created April 8, 2011 18:01 — forked from x1024/gist:794143
var http = require('http'),
should = require('should'),
io = require('socket.io'),
decode = require('.npm/socket.io/0.6.8/package/lib/socket.io/utils').decode,
encode = require('.npm/socket.io/0.6.8/package/lib/socket.io/utils').encode,
WebSocket = require('.npm/socket.io/0.6.8/package/support/node-websocket-client/lib/websocket.js').WebSocket;
exports['Socket.IO mocking'] = function(assert){
var _server = require('http').createServer(function(){});
// A mock client object.
return filter.map do |f|
o = @overlords.find{ |o| o.name == f }
raise "Invalid filter: #{f}" unless o
o
end
vs
return filter.map do |f|
@overlords.find{ |o| o.name == f } or raise "Invalid filter: #{f}"
#!/usr/bin/env ruby
require 'logger'
require 'rest_client'
$stdout.sync = true
$stdin.sync = true
path = "/usr/local/var/log/ejabberd/auth.log"
file = File.open(path, File::WRONLY | File::APPEND | File::CREAT)
Creating Firefox profile in '/Users/abloom/Library/Application Support/Firefox/Profiles/b0ef4sie.xultestrunner'
Running tests...
2011-01-20 08:13:03.939 firefox-bin[25902:903] *** __NSAutoreleaseNoPool(): Object 0x268d9e0 of class NSCFString autoreleased with no pool in place - just leaking
2011-01-20 08:13:03.943 firefox-bin[25902:903] *** __NSAutoreleaseNoPool(): Object 0x2691000 of class NSPathStore2 autoreleased with no pool in place - just leaking
2011-01-20 08:13:03.944 firefox-bin[25902:903] *** __NSAutoreleaseNoPool(): Object 0x2691490 of class NSPathStore2 autoreleased with no pool in place - just leaking
2011-01-20 08:13:03.945 firefox-bin[25902:903] *** __NSAutoreleaseNoPool(): Object 0x2691570 of class NSPathStore2 autoreleased with no pool in place - just leaking
2011-01-20 08:13:03.945 firefox-bin[25902:903] *** __NSAutoreleaseNoPool(): Object 0x20806d0 of class NSPathStore2 autoreleased with no pool in place - just leaking
2011-01-20 08:13:03.946 firefox-bin[25902:903] *** __NSAutoreleaseNoPool
void delay(unsigned long int cycles) {
do (cycles--);
while (cycles != 0);
}
state = P1IN & BIT4;
if (state && (currentState != state)) { // P1.4 hi
currentState = state;
currentMessage = currentChar = (char *) message2;
} else if (!state && (currentState != state)) { // P1.4 lo
currentState = state;
currentMessage = currentChar = (char *) message1;
}
for (;;) {
switch(*currentChar) {
case '#':
printHash();
break;
case ' ':
delay(SPACE_DELAY);
break;
case '\0':
currentChar = (char *) currentMessage - 1; // -1 since we += 1 below
#include <msp430x20x3.h>
#define UNIT_DELAY 100000
#define DOT_DELAY UNIT_DELAY
#define DASH_DELAY (UNIT_DELAY * 3)
#define LETTER_DELAY (UNIT_DELAY * 3)
#define SPACE_DELAY (UNIT_DELAY * 7)
#define ON 1
#define OFF 0
#define LED1 BIT0
#!/usr/bin/env ruby
require 'logger'
$stdout.sync = true
$stdin.sync = true
path = "/usr/local/var/log/ejabberd/auth.log"
file = File.open(path, File::WRONLY | File::APPEND | File::CREAT)
file.sync = true
class Rack::Request
def host_with_port
if forwarded = @env["HTTP_X_FORWARDED_HOST"]
forwarded.split(/,\s?/).last
else
@env['HTTP_HOST'] || "#{@env['SERVER_NAME'] || @env['SERVER_ADDR']}:#{@env['SERVER_PORT']}"
end
end
def host