Skip to content

Instantly share code, notes, and snippets.

View tomlane's full-sized avatar
🏠
Working from home

Tom Lane tomlane

🏠
Working from home
View GitHub Profile
@tomlane
tomlane / gist:1894276
Created February 23, 2012 18:41
JS logic 101
//Javascript Logic 101
//make "that" have the value of true (boolean)
that = true
//check if "that" is false
if (!that) { //returns false. (it is not true that the value is set to false)
//do something
}
@tomlane
tomlane / gist:1373898
Created November 17, 2011 17:53
Page Visibility API Example
<!-- video pauses when tab is not in view. Uses Page Visibility API. -->
<html>
<head>
<title>Page Visibility API</title>
</head>
<body>
<p>Credit for video: http://ptaff.ca/orage_montreal/?lang=en_CA </p>
<video>
<source src="1696_lightnings.ogg" type="video/ogg">
</video>
@tomlane
tomlane / nodejs-http-server
Created October 29, 2011 19:02
A Well commented http server written in node.
/*
A well commented http server written in node.
Written by: Tom Lane, http://github.com/tomlane
All Public Work by Tom Lane is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 2.0 UK: England & Wales License.
*/
//calling the required http and fs modules
var http = require('http');