Skip to content

Instantly share code, notes, and snippets.

@nkint
nkint / 1.js
Created November 6, 2018 08:50 — forked from getify/1.js
tag function for formatting console.log(..) statements
function logger(strings,...values) {
var str = "";
for (let i = 0; i < strings.length; i++) {
if (i > 0) {
if (values[i-1] && typeof values[i-1] == "object") {
if (values[i-1] instanceof Error) {
if (values[i-1].stack) {
str += values[i-1].stack;
continue;
}
import defined from 'defined'
const TO_PX = 35.43307
const DEFAULT_SVG_LINE_WIDTH = 0.03
export function shapesToSVG(shapes, opt = {}) {
const dimensions = opt.dimensions
if (!dimensions) throw new TypeError('must specify dimensions currently')
const decimalPlaces = 5
###
#Step 1 - Generate server certificates etc... (most of this code is horribly ripped off from nodejs docs currently -> http://nodejs.org/docs/latest/api/tls.html)
###
#Assuming your starting from a clean directory
mkdir server
cd server
#generate private key
@nkint
nkint / lazy_set.py
Created February 9, 2011 18:26 — forked from rik0/lazy_set.py
import itertools as it
def setness(f):
        setness.calls = dict()
        def decorator(arg):
                seen = setness.calls.get( arg, set() )
                for i in seen: yield i
                for i in f(arg):
                        if i not in seen:
                                seen.add(i)