Skip to content

Instantly share code, notes, and snippets.

View ThisIsMissEm's full-sized avatar

Emelia Smith ThisIsMissEm

View GitHub Profile
// Set API key
var my_flickr = $.flickr({
apiKey: '123'
});
// Option 1: Inline callbacks
my_flickr.photos.getRecent({
size: 's'
page: 1,
beforeSend: function() {
def get_options(args)
options = {}
args.each {|arg|
arg.scan(/^(?:(?:|-)(?:-(no)?)?)-(\w+)(?:=(\w+))?$/) {|bool,key,value|
key = "no-"+key if !value.nil? && !bool.nil?
options[key] = value.nil? && bool.nil? || (value || bool.nil?)
}
}
options
end
// Copyright 2009 Ryan Dahl <ry@tinyclouds.org>
#include <v8.h>
#include <node.h>
#include <node_os.h>
#include <sys/types.h>
#include <sys/time.h>
#include <stdlib.h>
#include <unistd.h>
#include <assert.h>
var sys = require('sys')
, http = require("http")
, spawn = require('child_process').spawn;
var filename = process.ARGV[2];
if (!filename){
sys.puts("Usage: node watcher.js filename");
process.exit(1);
} else {
var net = require('net');
var server = net.createServer(function (stream) {
stream.setTimeout(0);
});
server.listen(7000);
var child_process = require('child_process'),
sys = require('sys'),
net = require('net'),
netBinding = process.binding('net');
var fd = netBinding.socket('tcp4');
netBinding.bind(fd, 8080);
netBinding.listen(fd, 128);
for (var i = 0; i < 4; i++) {
var child_process = require('child_process'),
sys = require('sys'),
net = require('net'),
netBinding = process.binding('net');
var fd = netBinding.socket('tcp4');
netBinding.bind(fd, 8080);
netBinding.listen(fd, 128);
for (var i = 0; i < 4; i++) {
var child_process = require('child_process'),
sys = require('sys'),
net = require('net'),
netBinding = process.binding('net');
var fd = netBinding.socket('tcp4');
netBinding.bind(fd, 8080);
netBinding.listen(fd, 128);
for (var i = 0; i < 4; i++) {
var child_process = require('child_process'),
sys = require('sys'),
net = require('net'),
netBinding = process.binding('net');
var fd = netBinding.socket('tcp4');
netBinding.bind(fd, 8080);
netBinding.listen(fd, 128);
for (var i = 0; i < 4; i++) {
// my little html string builder
buildHTML = function(tag, html, attrs) {
// you can skip html param
var h = document.createElement(tag);
var attrs = attrs || {};
if (arguments.length == 2 && !((html) instanceof HTMLElement) && typeof(html) == "object") {
attrs = html;
html = null;
}