Skip to content

Instantly share code, notes, and snippets.

Avatar

Emelia Smith ThisIsMissEm

View GitHub Profile
View index.html
<!DOCTYPE html>
<html>
<head>
<script src="http://fb.me/react-0.14.3.js"></script>
<script src="http://fb.me/react-dom-0.14.3.js"></script>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
<style id="jsbin-css">
.item, .item-selected {
@ThisIsMissEm
ThisIsMissEm / requireDir.js
Created Jul 4, 2012 — forked from TheDeveloper/requireDir.js
Node.js require directory
View requireDir.js
var fs = require('fs');
var Path = require('path');
function requireDir(dir){
var modules = {};
fs.readdirSync(dir).map(function(name){
return Path.join(dir, name);
}).filter(function(path){
return fs.statSync(path).isFile();
@ThisIsMissEm
ThisIsMissEm / naf.js
Created Jul 2, 2012 — forked from getify/naf.js
requestNextAnimationFrame() and cancelNextAnimationFrame()
View naf.js
// requires raf.js (polyfil)
(function(){
var ids = {};
function requestId(){
var id;
while (!id || ids.hasOwnProperty(id)){
id = Math.floor(Math.random() * 1E9);
};
@ThisIsMissEm
ThisIsMissEm / domTrees.js
Created Apr 28, 2011 — forked from jed/bookmarklet.js
dom tree caching performance: array v. linked list
View domTrees.js
function Node1(node) {
this.node = node;
var children = node.childNodes,
i = this.length = children.length;
while (i--) this[i] = new Node1(children[i]);
}
Node1.prototype.count = function() {
View slow.js
var fs = require('fs');
fs.unlinkSync('/tmp/__blah');
var s = fs.WriteStream("/tmp/__blah");
for (var i = 0; i < 1024 * 1024; i++) {
s.write("a");
}
View stream.js
this.Server.prototype.stream = function (pathname, files, buffer, res, callback) {
(function streamFile(files, offset) {
var file = files.shift();
if (file) {
// Stream the file to the client
fs.createReadStream(path.join(pathname || '.', file), {
flags: 'r',
encoding: 'binary',
View gist:650822

[Placeholder]

We’re very happy to announce today the Async CTP for Visual Basic and C#.

Async CTP homepage: http://msdn.com/vstudio/async
Installer: http://go.microsoft.com/fwlink/?LinkId=203690
Async discussion forums: http://social.msdn.microsoft.com/Forums/en-US/async/threads
Asynchronous programming is something that helps make your UI more responsive, especially in applications that interact with databases or network or disk. It’s also used to make ASP servers scale better.

Until now, asynchronous programming has also been prohibitively hard, “not worth the investment”-hard. But with the Async CTP we’ve made asynchronous programming easy enough that developers should routinely consider asynchrony for most of their applications.

View gist:604007
// HOWTO: load LABjs itself dynamically!
// inline this code in your page to load LABjs itself dynamically, if you're so inclined.
(function (global, oDOC, handler) {
var head = document.getElementsByTagName("head")
, sOnLoad = "onload"
, sReadyState = "readyState"
, sDomContentLoaded = "DOMContentLoaded"
, sLoaded = "loaded"
, sComplete = "complete"
View gist:525784
var sys = require("sys")
, fs = require("fs")
, path = require("path")
, http = require("http")
, ws = require('../lib/ws');
var server = http.createServer(function(req, res){
if( req.url.indexOf("favicon") > -1 ){
sys.log("HTTP: "+req.socket.remotePort+", inbound request, served nothing, (favicon)");
View gist:525776
<!doctype html>
<html>
<head>
<title>
<%= title %>
</title>
<link href="//fonts.googleapis.com/css?family=Yanone+Kaffeesatz:200,300,400,700" rel="stylesheet" type="text/css">
<link rel="stylesheet" href="/stylesheets/generic.css" type="text/css" />
<link rel="stylesheet" href="/stylesheets/visualize.css" type="text/css" />
<script src="http://code.jquery.com/jquery-latest.js"></script>