This file contains 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
// Set API key | |
var my_flickr = $.flickr({ | |
apiKey: '123' | |
}); | |
// Option 1: Inline callbacks | |
my_flickr.photos.getRecent({ | |
size: 's' | |
page: 1, | |
beforeSend: function() { |
This file contains 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
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 |
This file contains 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
// 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> |
This file contains 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 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 { |
This file contains 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 net = require('net'); | |
var server = net.createServer(function (stream) { | |
stream.setTimeout(0); | |
}); | |
server.listen(7000); |
This file contains 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 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++) { |
This file contains 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 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++) { |
This file contains 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 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++) { |
This file contains 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 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++) { |
This file contains 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
// 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; | |
} |
OlderNewer