Skip to content

Instantly share code, notes, and snippets.

@FND
FND / bar.json
Last active August 29, 2015 13:56
promises aggregation with AngularJS
{ "name": "Bravo" }
@FND
FND / index.html
Created June 13, 2014 06:41
CSP test case
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Test Case</title>
</head>
<body>
<h1>Hello World</h1>
@FND
FND / jawsmith.py
Last active August 29, 2015 14:12
MHD test case for chunked transfer encoding (https://github.com/FND/mhd/issues/3)
import asyncio
from random import randint
from mhd.server import start_server
EOL = b"\n"[0] # XXX: hacky
LIPSUM = b"""
@FND
FND / README.md
Last active August 29, 2015 14:22
CLI slide show
$ ./slideshow sample

Keys

  • b: previous
  • n: next
  • q: quit
@FND
FND / oauth2.md
Last active August 29, 2015 14:26
OAuth 2 permissions delegation
  1. USER visits APP

     GET https://example.org
    
  2. APP links to PROVIDER login

  3. USER follows PROVIDER link, logging in if necessary

     GET https://provider.com/login
    

{ response_type=code, client_id, redirect_uri=https://example.org/auth }

#!/usr/bin/env bash
# DEBUG
item="foo bar lorem ipsum"
item="foo bar t:2009-02-26 lorem ipsum"
item="foo bar t:2009-02-27 lorem ipsum"
item="foo bar t:2009-02-28 lorem ipsum"
# check for threshold
if [[ $item = *t:* ]]; then # check for threshold marker
/**
* Checks that the given expression throws an exception of the expected type, with an optional message.
*
* @example raises( function() { return foo.bar; }, "TypeError", "invalid property access raises TypeError exception" );
*
* @param Function expression
* @param String expected exception type
* @param String message (optional)
*/
function raises(expression, expected, message) {
/***
simplified version of the ListNavMacro:
http://svn.tiddlywiki.org/Trunk/contributors/FND/plugins/ListNavMacro.js
!Usage
{{{
<<listnav tiddler>>
}}}
<<listnav [[ColorPalette]]>>
***/
/*
* make Bespin use the local file system for storage
*
* requires jquery.file.save and jquery.file.load:
* http://trac.tiddlywiki.org/browser/Trunk/core/jquery/plugins/
*/
(function() {
// provide jQuery functionality required by file-system code
//{{{
config.macros.toggleReadOnly = {
label: "toggle",
tooltip: "toggle read-only mode",
handler: function(place, macroName, params, wikifier, paramString, tiddler) {
createTiddlyButton(place, this.label, this.tooltip, this.toggle);
},
toggle: function() {