Skip to content

Instantly share code, notes, and snippets.

@deian
deian / example.html
Created June 7, 2013 00:04
example of how to do comments
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<script src="http://code.jquery.com/jquery-1.10.1.min.js" type="text/javascript"> </script>
</head>
<body>
<div class="comment" id="post-123">
<blockquote>
Some great comment
<?xml version="1.0"?>
<bindings xmlns="http://www.mozilla.org/xbl" xmlns:html="http://www.w3.org/1999/xhtml">
<binding id="mycode">
<implementation>
<constructor>
alert("XBL script executed.");
</constructor>
</implementation>
</binding>
<PUBLIC:COMPONENT TAGNAME="xss">
<PUBLIC:ATTACH EVENT="ondocumentready" ONEVENT="main()" LITERALCONTENT="false"/>
</PUBLIC:COMPONENT>
<SCRIPT>
function main()
{
alert("HTC script executed.");
}
</SCRIPT>
@deian
deian / key-val-boiler
Created July 3, 2013 19:08
key-value store hails
{-# LANGUAGE OverloadedStrings #-}
module SimpleApp2 (server) where
import Prelude hiding (lookup)
import Data.String
import Control.Monad
import qualified Data.ByteString.Char8 as S8
import qualified Data.ByteString.Lazy.Char8 as L8
import LIO
@deian
deian / chat-app-spec
Last active December 19, 2015 08:09
Chat app description
deian.net/hails-tutorial.html
<iframe src="/messages#last"></iframe>
---------------------------------------------
GET /message |^| --> get all from DB
| | find + next
| | --> html refresh 2; + list messages
| | --> #last
| |
| |
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
</head>
<body>
<div id="log"></div>
<script src="http://code.jquery.com/jquery-1.10.2.min.js"></script>
<script type="text/javascript">
"use strict";
var dcl = require('./dclabels.js');
var l = new dcl.Label([new dcl.Group("yo"),
new dcl.Group(["a","b"]),
new dcl.Group(["yo","no"]),
new dcl.Group(["a"])
])
console.log(l+'')
console.log(l.subsumes(new dcl.Label())+'')
console.log((new dcl.Label()).subsumes(l)+'');
@deian
deian / blocks
Last active December 30, 2015 02:49
blocks & refcount
#include <stdio.h>
#include <Block.h>
typedef void (^voidToVoid) (void);
typedef void (^voidToVoidToVoid) (voidToVoid);
void f(void) {
voidToVoidToVoid a = ^ (voidToVoid b) {
voidToVoid b2 = Block_copy(b);

Keybase proof

I hereby claim:

  • I am deian on github.
  • I am deian (https://keybase.io/deian) on keybase.
  • I have a public key whose fingerprint is A3CA DAA1 144E 5CDE B67F 37B9 5ED1 79BB 628C 02E2

To claim this, I am signing this object:

@deian
deian / gist:f2de2f1c33580ed1b3fd
Created May 25, 2014 01:56
Using OpenPGP.JS to verify signature of a file
"use strict";
var fs = require('fs');
var path = require('path');
var assert = require('assert');
var async = require('async');
var crypto = require('crypto');
var pgp = require('openpgp');