View LRU.v1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class LRUElement { | |
constructor (data, master, index) { | |
this.data = data; | |
this.master = master; | |
this.index = index; | |
this.lastAccess = new Date(); | |
} | |
get value () { | |
return this.data; |
View kvo.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function initWatchProperty (obj, key) { | |
if (obj['$$watchers$$' + key]) | |
return; | |
Object.defineProperty(obj, key, { | |
get: function () { | |
return this['$$' + key]; | |
}, | |
set: function (val) { | |
var old = this['$$' + key]; |
View gist:a94e6c0c95cff41c8a10
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var http = require('http'); | |
var server = http.createServer(onRequest); | |
function onRequest (req, res) { | |
res.writeHead(403, 'You are forbidden to visit this page due to Qujing\'s parental control.'); | |
res.write('You are forbidden to visit this page due to Qujing\'s parental control.'); | |
res.end(); | |
} |
View inline-phrases.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<style> | |
ul, li { padding: 0; margin: 0; } | |
ul { width: 400px; } | |
li { | |
display: inline; | |
font-family: "Charis SIL"; | |
font-style: italic; | |
} |
View initGuard.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var fs = require('fs'); | |
function guardInit (init) { | |
var delayedCalls = []; | |
var status = 'not initialized'; | |
return function () { | |
if (status == 'initializing') | |
return delayedCalls.push(arguments); | |
if (status == 'initialized') |
View gist:52658490bc4bb2f4ad37
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html lang="cmn-Hans-CN"> | |
<head> | |
<style type="text/css"> | |
#block { | |
width: 10em; | |
margin-left: 5em; | |
text-align: justify; | |
-webkit-hyphens: auto; | |
} | |
i { |
View canvas-compress
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<style> | |
#picture-select { | |
display: block; | |
} | |
#canvas { |
View WillBeBack
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE DeriveDataTypeable, TemplateHaskell, TypeFamilies, FlexibleInstances, FlexibleContexts, InstanceSigs #-} | |
module Data.VCodePool where | |
import Data.Data (Data, Typeable) | |
import Data.SafeCopy (base, deriveSafeCopy, SafeCopy(..)) | |
import Control.Applicative ((<$>), (<*>)) | |
import Control.Monad.Reader (ask) | |
import Control.Monad.State (get, put) |
View trim-and-spacing.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<style> | |
html { | |
font-family: Helvetica; | |
} | |
body { | |
width: 30em; | |
margin: auto; | |
} | |
p { | |
width: 581px; |
View demo.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE OverloadedStrings #-} | |
{-# LANGUAGE NoMonomorphismRestriction #-} | |
{-# LANGUAGE UnicodeSyntax #-} | |
import Prelude hiding (putStrLn) | |
import Data.Text.Lazy.IO (putStrLn) | |
import Control.Monad.Writer | |
-- Monoid Instance -- |
OlderNewer