View countdown-timer.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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>Countdown Timer</title> | |
<style> | |
body, html { | |
display: flex; | |
align-items: center; | |
justify-content: center; |
View Main.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 PolyKinds, KindSignatures, MultiParamTypeClasses #-} | |
module Main where | |
class Category (arr :: k -> k -> *) where | |
id :: arr t t | |
(.) :: arr b c -> arr a b -> arr a c | |
instance Category (->) where | |
id x = x |
View monads.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 Container(val) { | |
this.val = val | |
} | |
// Functor's `fmap` in Haskell | |
Container.prototype.map = function(f) { | |
return new Container(f(this.val)); | |
}; | |
// Monad's `>>=` (pronounced bind) in Haskell |
View textnode-innerhtml.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
/** | |
* Proof of concept ESLint rule for warning about potential | |
* XSS vulnerabilities caused by mixing innerHTML/text node | |
* property access. | |
* | |
* More here: http://benv.ca/2012/10/2/you-are-probably-misusing-DOM-text-methods/ | |
*/ | |
'use strict'; | |
var WARNING_MSG = |
View arrayEq.coffee
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
arrayEq = (a, b) -> | |
if a is b | |
# 0 isnt -0 | |
a isnt 0 or 1/a is 1/b | |
else if a instanceof Array and b instanceof Array | |
return no unless a.length is b.length | |
return no for el, idx in a when not arrayEq el, b[idx] | |
yes | |
else | |
# NaN is NaN |
View bind.coffee
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
unless Function::bind? | |
Function::bind = (scope, args...) -> | |
target = this | |
if typeof target isnt "function" then throw new TypeError | |
bound = -> | |
unless this intanceof bound | |
return target.apply scope, [args..., arguments...] | |
F = -> | |
F.prototype = target.prototype | |
self = new F |