Skip to content

Instantly share code, notes, and snippets.

Avatar

Simon Lydell lydell

View GitHub Profile
View chars.json
[
[" ",1988063],
["e",1162450],
["a",888755],
["t",832684],
["i",762070],
["n",746426],
["o",728126],
["r",667531],
["s",655854],
@lydell
lydell / index.js
Last active Aug 29, 2015
convert-source-map-simple
View index.js
var sourceMap = require("source-map")
function convert(map) {
var simpleMap = shallowCopy(map)
// Prevent the source-map module from joining sources with the sourceRoot (if
// any), so that we can find the indexes of in the `sources` property.
delete simpleMap.sourceRoot
simpleMap.mappings = {}
@lydell
lydell / tokenize.coffee
Created Dec 19, 2014
Simple tokenizer function (for js-tokens and css-tokens)
View tokenize.coffee
###
Tokenizes `string` into an array of tokens, using `regex` such as [js-tokens]
or [css-tokens].
[js-tokens]: https://github.com/lydell/js-tokens
[css-tokens]: https://github.com/lydell/css-tokens
###
tokenize = (string, regex) ->
regex.lastIndex = 0
@lydell
lydell / bigrams-all.json
Created Aug 23, 2015
English bigram and character pair frequencies from Michael Dickens in JSON format
View bigrams-all.json
[
["e ",2357988],
[" t",2060528],
["th",1810335],
[" a",1554503],
["he",1523680],
["s ",1435225],
["in",1318298],
["t ",1268890],
["d ",1188359],
View test.html
<!doctype html>
<title>test</title>
<style>
a:hover::after {
content: ':hover';
}
a:focus::after {
content: ':focus';
}
a:active::after {
@lydell
lydell / convert.py
Last active Jan 20, 2016
“J.R.R. Tolkien's The Hobbit” (“The Hobbit” trilogy fan edit) subtitle converter
View convert.py
# Written by Simon Lydell 2016. This file is in the public domain.
#
# To print instructions, run `python3 convert.py`.
import datetime
import re
def parse_file(file_name):
@lydell
lydell / base64.css
Created Sep 4, 2016
Embedded source map support test
View base64.css
.base64 { font-weight: bold; }
/*# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJtYXBwaW5ncyI6IkFBQUEiLCJzb3VyY2VzIjpbInN1Y2Nlc3MuY3NzIl0sIm5hbWVzIjpbXX0= */
View LessCrazy.elm
module Main exposing (..)
import Html exposing (Html, div, button, text)
import Html.App
import Html.Events exposing (onClick)
main : Program Never
main =
Html.App.beginnerProgram
@lydell
lydell / .eslintrc.js
Created Sep 27, 2016
eslint-brunch + eslint-config-standard
View .eslintrc.js
module.exports = {
extends: 'eslint-config-standard',
}
View .stylelintrc.js
module.exports = {
extends: 'stylelint-config-standard',
}