These are all the JSConf 2014 slides, codes, and notes I was able to cull together from twitter. Thanks to the speakers who posted them and thanks to @chantastic for posting his wonderful notes.
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 http = require('http'); | |
var server = http.createServer(function (req, res) { | |
res.writeHead(200, { 'content-type': 'text/html' }); | |
res.write('<script>console.log("this is the start of the stream...")</script>'); | |
var timer = setInterval(function () { | |
if (!res.connection || !res.connection.writable) { | |
try { res.end(); } catch (e) {} | |
clearInterval(timer); |
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
#!/usr/bin/env coffee | |
fs = require 'fs' | |
sh = require 'execSync' | |
config = JSON.parse fs.readFileSync 'package.json' | |
fs.renameSync 'package.json', 'package.json.real' | |
name = config.name = "#{config.name}-semver" |
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
/*global console:true, phantom:true, slidedeck:true*/ | |
var webpage = require('webpage'), | |
page = webpage.create(), | |
system = require('system'), | |
url = system.args[1] || 'index.html', | |
fs = require('fs'), | |
imageSources = [], | |
imageTags, | |
width = system.args[2] || 1920, |
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
/* | |
Swift Programming Language Guide | |
"A Swift Tour" Solutions | |
https://developer.apple.com/library/prerelease/ios/documentation/Swift/Conceptual/Swift_Programming_Language/GuidedTour.html#//apple_ref/doc/uid/TP40014097-CH2-XID_1 | |
These are the solutions to all the "experiments" in the pre-release Swift Programming Guide | |
(released on the same day Apple announced Swift). A couple of things worth noting: | |
1. Swift syntax, e.g. array declarations, has changed since I releasd these. So this code will | |
probably cause some errors when you paste it into a playground. Should be easy enough to fix |
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 couchbase = require("couchbase"), | |
config = { | |
hosts : ["localhost:8091", "localhost:9000"], | |
bucket : "TapLibz", | |
password : "buzz-the-tower", | |
}; | |
// would be neat to have default connection level | |
// options (place to set observe and expiration, etc) |
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 parser = document.createElement('a'); | |
parser.href = "http://example.com:3000/pathname/?search=test#hash"; | |
parser.protocol; // => "http:" | |
parser.hostname; // => "example.com" | |
parser.port; // => "3000" | |
parser.pathname; // => "/pathname/" | |
parser.search; // => "?search=test" | |
parser.hash; // => "#hash" | |
parser.host; // => "example.com:3000" |
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
#!/usr/bin/env sh | |
## | |
# This is script with usefull tips taken from: | |
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx | |
# | |
# install it: | |
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh | |
# |
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
// This example adapted from Matt Gallagher's "Minimalist Cocoa Programming" | |
// blog article: | |
// http://cocoawithlove.com/2010/09/minimalist-cocoa-programming.html | |
var $ = require('NodObjC') | |
$.import('Cocoa') | |
var pool = $.NSAutoreleasePool('alloc')('init') | |
, app = $.NSApplication('sharedApplication') |
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
define.defs = {}; | |
define.modules = {}; | |
function define(name, fn) { | |
define.defs[name] = fn; | |
} | |
function require(name) { | |
if (define.modules.hasOwnProperty(name)) return define.modules[name]; | |
if (define.defs.hasOwnProperty(name)) { | |
var fn = define.defs[name]; | |
define.defs[name] = function () { throw new Error("Circular Dependency"); }; |
NewerOlder