Skip to content

Instantly share code, notes, and snippets.

@nw
nw / userTable.js
Last active August 29, 2015 14:08
add users table
$(function(){
var table = $('#users');
var tbody = table.find('tbody');
var nameField = $('#name');
var emailField = $('#email');
var addButton = $('#add');
var clearAll = $('#clearAll');
@nw
nw / move.html
Created October 30, 2014 01:56
mouse move
<!doctype html>
<html>
<head>
<style>
body {
height: 4000px;
}
@nw
nw / index.html
Created October 28, 2014 01:50
racecar
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title>Racecar</title>
<link rel="stylesheet" href="racecar.css"/>
</head>
<body>
<div class="container">
@nw
nw / tabs.html
Last active August 29, 2015 14:07
tabs
<html>
<head>
<style>
body {
background: #ccc;
}
.tab-wrapper {
width: 50%;
@nw
nw / hilow.html
Created October 15, 2014 03:06
hi low game (html)
<html>
<head>
<style>
body {
background: #ccc;
}
#container {
@nw
nw / hilow.js
Created October 15, 2014 02:21
hi low game
var num;
var guesses = 0;
function newGame(min, max) {
num = getRandomInt(min, max);
guesses = 0;
}
function guess(myGuess){
guesses++;
var all_games =
[ [ [ 'X', 'X', 'X' ],
[ 'X', 'O', 'O' ],
[ 'X', 'O', 'O' ] ],
[ [ 'X', 'X', 'X' ],
[ 'X', 'O', 'O' ],
[ 'O', 'X', 'O' ] ],
<html>
<head>
<style>
body {
padding: 0;
margin: 0;
}
new Todo('todo');
function Todo(id){
this.items = [];
this.el = $(id);
@nw
nw / superhack.js
Created November 23, 2010 02:22 — forked from creationix/superhack.js
// Add a handy super call for all objects
MyBaseClass.prototype.super = function () {
var parent = this.__proto__.__proto__;
var caller = arguments.callee.caller;
var fn;
if (caller.prototype === this.__proto__) {
return parent.constructor.apply(this, arguments);
} else {
// This is probably quite slow, but it doesn't seem to affect
// performance too much in real tests.