Skip to content

Instantly share code, notes, and snippets.

m = function () {
var events = [this._id];
if (this.tags) {
this.tags.forEach( function (z) {
emit( z, {count:1, events: events} );
});
}
}
r = function (key, values) {
m = function () {
var events = [this._id];
this.tags.forEach( function (z) {
emit( z, {count:1, events: events} );
});
}
r = function (key, values) {
var total = 0;
events = [];
@josefsalyer
josefsalyer / https_problem.js
Created December 29, 2010 21:11
https connection problem
client = http.createClient( 443, "go.urbanairship.com", true );
request = client.request( "GET", "/api/device_tokens/", { 'Host': "go.urbanairship.com", 'Authorization' : MASTERAUTH } );
request.end();
return request.on('error', function(e){ console.log("request error: " + e.stack ); });
return request.on('close', function() { console.log("CLOSED"); });
return request.on('response', function(response) {
sys.debug("RESPONSE");
return response.on('data', function(chunk) {
sys.debug("GOT DATA");
if (module === require.main) {
inspect = function(obj) {
return sys.debug(sys.inspect(obj, 5));
};
debugcb = function(err, results) {
inspect(err);
return inspect(results);
};
for (i=0;i<=100;i++) {
exports.upcomingEpisodesInLineup("DISH770", "183931", debugcb)
@josefsalyer
josefsalyer / notes
Created October 31, 2011 15:16
notes
10:9a:dd:b9:83:3e Hernan
7C:6D:62:D2:E4:0D Hernan's iPad
90:27:e4:fb:3a:7c Frederico
Frank
https://github.com/moredip/Frank
http://blog.thepete.net/2010/07/frank-automated-acceptance-tests-for.html
http://vimeo.com/21860134
@josefsalyer
josefsalyer / q.mdown
Created November 4, 2011 13:23
pangrams

Description:

The sentence 'A quick brown fox jumps over the lazy dog' contains every single letter in the alphabet. Such sentences are called pangrams. You are to write a program, which takes a sentence, and returns all the letters it is missing (which prevent it from being a pangram). You should ignore the case of the letters in sentence, and your return should be all lower case letters, in alphabetical order. You should also ignore all non US-ASCII characters.In case the input sentence is already a pangram, print out the string NULL

Input sample:

Your program should accept as its first argument a filename. This file will contain several text strings, one per line. Ignore all empty lines. eg.

A quick brown fox jumps over the lazy dog

A slow yellow fox crawls under the proactive dog

@josefsalyer
josefsalyer / sum_of_numbers.md
Created November 29, 2011 19:04
Sum of numbers

Sum of Digits

Description:

Given a positive integer, find the sum of its constituent digits.

Input sample:

The first argument will be a text file containing positive integers, one per line. e.g.

@josefsalyer
josefsalyer / main.c
Created December 12, 2012 02:52
struct your stuff
//
// main.c
// StructuredObjects
//
// Created by john salyer on 12/4/12.
// Copyright (c) 2012 Josef Salyer. All rights reserved.
//
#include <stdio.h>
//#include <stdbool.h> //this is what you use if you are just using C, but we're not
@josefsalyer
josefsalyer / backtomath.c
Created February 6, 2013 03:12
I split out the modf call into it's own line so you can more clearly see what it's doing - splitting the double at the decimal point.
//
// main.c
// Back to Math classes
//
// Created by Curt on 2/5/13.
// Copyright (c) 2013 Curt. All rights reserved.
//
#include <stdio.h>
#include <math.h>