Skip to content

Instantly share code, notes, and snippets.

import {
Dictionary,
} from "typescript-collections";
/**
* This data structure is effectively a Set but it is optimized for
* retrieving the instance associated with the set's identity key.
*
* If an instance implements this interface, the function will be used to
* create it's key value by the default implementation. Otherwise a custom

An example of a simple form

Consider the following markup:

<form class="root" state:theme=dark state:compact>
  <div class="input-area">
    <label for="username" class="label">Username:</label>
    <input id="username" class="input" type="text">
  </div>
@namespace "http://www.w3.org/1999/xhtml";
html {
display: block;
}
head {
display: none;
}
import * as parse5 from "parse5";
import * as postcss from "postcss";
import * as CSSselect from "css-select";
import * as specificity from "specificity";
import * as propParser from "css-property-parser";
type Document = parse5.AST.HtmlParser2.Document;
type Node = parse5.AST.HtmlParser2.Node;
type ParentNode = parse5.AST.HtmlParser2.ParentNode;
type HtmlElement = parse5.AST.HtmlParser2.Element;
import { assert } from "chai";
export function isDefined<X>(value: X | undefined): {and: (cb: (defValue: X) => any) => void } {
if (value) {
return {
and: function(cb: (v: X) => void) {
cb(value);
}
};
} else {
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@chriseppstein
chriseppstein / syntax_ambiguity.scss
Last active November 3, 2015 23:16
This file is both a legal .scss and a legal .sass file but they compile to different results.
.foo
//
{ color: red; }
/*
color: blue
//
*/
@chriseppstein
chriseppstein / vile.txt
Created September 4, 2015 19:43
I trained a markov chain on gamergate and generated new tweets. These are the results.
Designer she just beat her Rival at Drafting for the response! ADORABLE ! WTF this is a staple in most cuisine.
Good on him Please forgive me, I must have really hurt LMFAO! *Shifty Eyes* Hehe *Wink* Nice to meet you! Active Angel as the H1PD.
Art lands in my day we had a dream about the sandstorm? The word people are thinking about us. Google result?
Got back from school~ You know whats that means~ Porn! #GGinDC stuff looks fun. We already have them on ice.
Fucked Hard And Deep -.. It Works! Actually, wouldn't mind using my 360 controller a bit better.
@function up-to($list, $index) {
$l: ();
@each $e in $list {
@if length($l) < $index {
$l: append($l, $e, list-separator($list));
}
}
@return $l;
}
@chriseppstein
chriseppstein / Directory Structure
Last active August 29, 2015 14:24
Simple Eyeglass Assets Example
.
├── assets
│   ├── images
│   │   ├── foo
│   │   │   └── image1.png
│   │   └── unused.gif
│   ├── js
│   │   └── app.js
│   └── scss
│   └── app.scss