Skip to content

Instantly share code, notes, and snippets.

View biermeester's full-sized avatar

Rinze de Laat biermeester

View GitHub Profile
@biermeester
biermeester / gist:1992197
Created March 7, 2012 09:34
Determine if the given parameter is a valid (Dutch) social security number, known as Burger Service Nummer.
def is_eleven_proof(bsn):
""" Determine if the given parameter is a valid (Dutch) social security
number, known as Burger Service Nummer.
The parameter may be an integer or a string. Non-digit characters will
be filtered out.
The function returns 'True' if the number is valid and 'False'
otherwise.
"""
if isinstance(bsn, (str, unicode)):
@biermeester
biermeester / multiconf.py
Created September 5, 2012 22:58
Multiconf, defining host dependent Sublime Text plugin configuration values
import socket
import sublime
import re
""" Copyright (C) 2012 Isaac Muse
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CON
@biermeester
biermeester / css_test.ipynb
Created August 13, 2018 12:49
Jupyterlab Notebook used for testing inline CSS styles on HTML tags embedded in Markdown text
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@biermeester
biermeester / css_property_to_typescript.py
Created August 13, 2018 12:52
Script used to help extract data from the Google Caja project
from itertools import groupby
# Caja tag information can be gotten from:
# https://github.com/google/caja/tree/1056be89dad487f9178d89f462fe5cb207c7e604/src/com/google/caja/lang/html
caja_tags = ['a', 'abbr', 'acronym', 'address', 'area', 'article', 'aside', 'audio', 'b', 'bdi', 'bdo', 'big', 'blockquote', 'br', 'button', 'canvas', 'caption', 'center', 'cite', 'code', 'col', 'colgroup', 'command', 'data', 'datalist', 'dd', 'del', 'details', 'dfn', 'dir', 'div', 'dl', 'dt', 'em', 'fieldset', 'figcaption', 'figure', 'font', 'footer', 'form', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'header', 'hgroup', 'hr', 'i', 'iframe', 'img', 'input', 'ins', 'kbd', 'label', 'legend', 'li', 'map', 'mark', 'menu', 'meter', 'nav', 'nobr', 'ol', 'optgroup', 'option', 'output', 'p', 'pre', 'progress', 'q', 's', 'samp', 'section', 'select', 'small', 'source', 'span', 'strike', 'strong', 'sub', 'summary', 'sup', 'table', 'tbody', 'td', 'textarea', 'tfoot', 'th', 'thead', 'time', 'tr', 'track', 'tt', 'u', 'ul', 'var', 'video', 'wbr']
sa
@biermeester
biermeester / pre-commit
Last active August 16, 2018 10:26
Git hook pre-commit script for stripping output and irrelevant metadata from Jupyter notebooks
#!/usr/bin/env python3
"""
Git pre-commit hook script
Strips output from Jupyter Notebooks
"""
import os
import sys