Skip to content

Instantly share code, notes, and snippets.

import ChildElement from './my-element/components/child-element'
// registerElement exists on any DOM element which provides namespacing
document.body.registerElement('my-element', Blink);
class Blink extends HTMLElement {
constructor() {
this.addEventListener('click', this.win);
// This is namespaced inside of my-element because that is where it is registered.
* {
margin: 0;
padding: 0;
}
body {
margin: 30px auto;
width: 450px;
background-color: #efefef;
color: #35a;
function Person(name) {
this.name = name;
this.greet = function() {
console.log('Hello ' + this.name);
}
this.setName = function(name) {
this.name = name;
}
@jargv
jargv / incr.hs
Created April 27, 2012 19:24
Accumulating string values across in a map
import Data.IORef
import qualified Data.Map as M
import Control.Monad(forever)
prompt msg = putStr msg >> getLine
main = do
ref <- newIORef M.empty
forever $ do