Skip to content

Instantly share code, notes, and snippets.

View ThisIsMissEm's full-sized avatar

Emelia Smith ThisIsMissEm

View GitHub Profile
var db = require("db-orm");
// Import the Email type from the context of the database.
var Email = db.types("Email");
// setup our database:
db.configure({
type: "redis",
host: "127.0.0.1",
Last login: Thu Aug 5 12:50:55 on ttys001
gem ~/: gem install rails --prerelease
Successfully installed activesupport-3.0.0.rc
Successfully installed activemodel-3.0.0.rc
Successfully installed rack-mount-0.6.9
Successfully installed tzinfo-0.3.22
Successfully installed abstract-1.0.0
Successfully installed erubis-2.6.6
Successfully installed actionpack-3.0.0.rc
Successfully installed arel-0.4.0
<!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>
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)");
// 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"

[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.

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',
@ThisIsMissEm
ThisIsMissEm / slow.js
Created January 27, 2011 03:52 — forked from ry/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");
}
@ThisIsMissEm
ThisIsMissEm / domTrees.js
Created April 28, 2011 09:01 — forked from jed/bookmarklet.js
dom tree caching performance: array v. linked list
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() {
@ThisIsMissEm
ThisIsMissEm / naf.js
Created July 2, 2012 19:07 — forked from getify/naf.js
requestNextAnimationFrame() and cancelNextAnimationFrame()
// requires raf.js (polyfil)
(function(){
var ids = {};
function requestId(){
var id;
while (!id || ids.hasOwnProperty(id)){
id = Math.floor(Math.random() * 1E9);
};