Skip to content

Instantly share code, notes, and snippets.

Kris Walker kixxauth

Block or report user

Report or block kixxauth

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@kixxauth
kixxauth / backbone-one.js
Created Nov 19, 2012
Backbone.js Single Event Listener Registration
View backbone-one.js
Backbone.Events.one = function (events, callback, context) {
var self = this;
function wrapper() {
self.off(events, wrapper, context);
callback.apply(this, arguments);
}
this.on(events, wrapper, context);
};
@kixxauth
kixxauth / broken.html
Created Oct 11, 2012
Good Modal Dialogs
View broken.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Sane Modal</title>
<meta name="viewport" content="width=device-width">
<link rel="stylesheet" href="positioned.css">
</head><body>
<div id="base-layer">
View sane-modal.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Sane Modal</title>
<meta name="viewport" content="width=device-width">
</head><body>
<!-- All "normal" content goes in the base layer -->
<div id="base-layer">
@kixxauth
kixxauth / better-javascript.js
Created Mar 31, 2012
JavaScript Objects and Promises
View better-javascript.js
//
// Typical Prototype composure in JS; This is the classical way of creating and
// using objects in JS.
//
// "Super" or "Parent" object prototype
function Cat(color) {
this.color = color;
this.saying = 'meowwww';
}
@kixxauth
kixxauth / base.html
Created Jun 27, 2011
Conditional HTML root tag based on browser
View base.html
<!doctype html>
{# <!-- paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither/ --> #}
<!--[if lt IE 7 ]> <html class="no-js ie6" lang="en"> <![endif]-->
<!--[if IE 7 ]> <html class="no-js ie7" lang="en"> <![endif]-->
<!--[if IE 8 ]> <html class="no-js ie8" lang="en"> <![endif]-->
<!--[if IE 9 ]> <html class="no-js ie9" lang="en"> <![endif]-->
<!--[if !(IE)]><!--> <html class="no-js" lang="en"> <!--<![endif]-->
<head>
<style>/* This works just as well in a stylesheet, of course */
@kixxauth
kixxauth / test_request.js
Created Jun 26, 2011
Make a request to an http server
View test_request.js
// Call this script with a http URL as the single argument:
// node test_request.js http://www.google.com
var http = require('http');
var url = require('url');
parsed = url.parse(process.argv[2]);
var opts = {
port: 80,
@kixxauth
kixxauth / node-static-hang.coffee
Created Jun 25, 2011
Hanging responses from Node-static
View node-static-hang.coffee
# This is a factory function which creates a middleware handler
# for serving static files.
#
# We have to use staticServer.serveFile() instead of .serve() because
# we are dynamically rewriting the file path based on the name of the
# application asking for the file.
resourceHandler = (opts) ->
staticServer = new static.Server(STATIC_PATH)
@kixxauth
kixxauth / namespaced-events.coffee
Created May 30, 2011
Namespaced and "stateful" event emitter.
View namespaced-events.coffee
###
# Kris Walker <kixxauth@gmail.com>
# Copyright 2011 Licensed under the MIT License http://opensource.org/licenses/mit-license.php
#
# Namespaced and Stateful events
# * Event names are namespaced
# * Event name specificity is separated by a dot "."
# * Event names get more specific from left to right.
#
@kixxauth
kixxauth / struct.js
Created May 6, 2011
Data structure for Royal Node
View struct.js
/**
* DAG node
* --------
*/
var tabbar =
[
{ name: "tabname",
title: "Title",
thumbnail: "Icon",
resource_type: "list, movie, image, ...",
@kixxauth
kixxauth / long-polling.html
Created Apr 11, 2011
A Node.js http long polling server for HTTP streaming.
View long-polling.html
<!DOCTYPE html>
<html>
<style type="text/css">
body {
font-size: 18px;
background: #000;
color: #fff;
}
#container {
width: 600px;
You can’t perform that action at this time.