Skip to content

Instantly share code, notes, and snippets.

@tifroz
tifroz / meteor diagnosis
Created September 13, 2012 22:45
meteor diagnosis (ubuntu dev)
curl -k https://raw.github.com/gist/3717981/20c856d150342529662bf05912467470979fa689 | /bin/sh
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
107 323 107 323 0 0 1372 0 --:--:-- --:--:-- --:--:-- 6094
===
Meteor version 0.4.0 (8f4045c1b9)
v0.6.18
---
/bin/sh: /usr/lib/meteor/meteor: not found
v0.6.17
@tifroz
tifroz / gist:2053246
Created March 16, 2012 22:20
json2html (v0.0.1) - sample output
<body>
<div class="expand clearfix even">
<div class="">
<div>
<div class="clearfix even collapse">
<div class="collapsible level1" onclick="j2h.toggleVisibility(this);return false">
[a_table]
</div>
<div class="content">
<table>
@tifroz
tifroz / Unpredictable order of parameter
Created March 30, 2011 23:54
node-seq: code to reproduce 'Unpredictable order of parameter'
#The Coffee-script version#
Seq = require('seq')
Seq() .par('one',->setTimeout((=>this(null,1)),5000))
.par('two',->setTimeout((=>this(null,2)),100))
.seq((one, two)->console.log('one: '+one+', two:'+two))
#The JS version#
@tifroz
tifroz / seq infinite loop
Created March 30, 2011 00:21
Cut & paste in node REPL to reproduce the infinite loop error
var Seq = require('seq')
Seq().par(function(){console.log('par1');this()}).catch(function(){console.log('catch1')}).seq(function(){console.log('seq1');this(new Error('err'))}).catch(function(){console.log('catch2')});
@tifroz
tifroz / PushNotification.m
Created March 19, 2011 23:42
APN processing
#import "PushNotification.h"
#import "JSON.h"
@implementation PushNotification
@synthesize notificationMessage;
@synthesize registerSuccessCallback;
@synthesize registerErrorCallback;
/**
* Generates a new UUID and passes it to the given callback function.
*
* Uses the a command-line uuid generator. Caches UUIDs to avoid
* unneccessary spawning of new processes.
*
* You can easily adjust the script used to create the UUID. By
* default I am using the OSSP uuid program, which is available in
* most linux distro's package managers (e.g. `sudo apt-get install
* uuid` on ubuntu).