Skip to content

Instantly share code, notes, and snippets.

View nateps's full-sized avatar

Nate Smith nateps

View GitHub Profile
@nateps
nateps / gist:02d0b0293880905476bd
Created July 12, 2014 00:45
Example ShareJS access control middleware for use with Derby
# Whitelist collections
ALLOW_COLLECTIONS = {
'accounts': true
'users': true
}
module.exports = (shareClient) ->
# Hold on to session object for later use. The HTTP req object is only
# available in the connect event
shareClient.use 'connect', (shareRequest, next) ->
@nateps
nateps / metamorph-bench.html
Created December 25, 2011 01:56
Simple metamorph benchmark
<!DOCTYPE html>
<title></title>
<div id=status></div>
<div id=container style=display:none></div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script>
var src = window.location.hash.substr(1),
@nateps
nateps / gist:1492197
Created December 18, 2011 02:40
DOM range replacement between comment markers
<!DOCTYPE html>
<title></title>
<style>
body { font: 13px/normal arial; }
table, form { margin: 10px; }
th, td { border: 1px solid #aaa; padding: 2px 6px; }
th { background: #eee; }
#inputHtml { width: 250px; }
</style>
@nateps
nateps / gist:1172490
Created August 26, 2011 01:38
Hide the address bar in a fullscreen iPhone or Android web app
<!DOCTYPE html>
<meta charset=utf-8>
<meta name=viewport content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name=apple-mobile-web-app-capable content=yes>
<meta name=apple-mobile-web-app-status-bar-style content=black>
<title>Test fullscreen</title>
<style>
html, body {
margin: 0;
padding: 0;