Skip to content

Instantly share code, notes, and snippets.

View jkz's full-sized avatar

Jesse Zwaan jkz

View GitHub Profile
@jkz
jkz / autolessc.py
Created October 7, 2012 04:04
Python script for automated compilation of .less files
#!/usr/bin/python
"""
Python script for automated compilation of .less files
Author: Jesse the Game
Usage: python autolessc.py <infile> <outfile>
Parse infile for dependencies, then compile less code into the outfile.
From then on, the script periodically check for modifications on dependencies
@jkz
jkz / foo.py
Created October 28, 2012 03:53
restlibpatch.py
from .http import statuses
def Foo(Resource):
def get(request):
try:
something = api.do_something()
except api.Timeout:
request.response['So'] = 'many' # with the response attached to the request
request.response_headers['options'] = 'available' # or just the headers
@jkz
jkz / lego.less
Last active December 11, 2015 05:49
Less mixins for fancy 3D-like effect on text, boxes and icons.
#lego {
.X(@n, @greedy: false) {#raster > .X(@n, @greedy)}
.Y(@n, @greedy: false) {#raster > .Y(@n, @greedy)}
.Z(@n, @start, @var: true) {#shadow-stack > .Z(@n, @start, @var)}
// Walls (push an area up or down)
////////////////////////////////////////////////////////////
.wall(@n, @color, @side-color) when not (@side-color) {
background-color: @color;
#shadow-stack > .box(@n, @color, @side-color);
@jkz
jkz / gist:5462209
Last active December 16, 2015 16:19
Wordpress [raw][/raw] tag, to ignore autoformatting
/*
* taken from http://www.wprecipes.com/disable-wordpress-automatic-formatting-on-posts-using-a-shortcode
*
* [raw] tag allows for raw html in pages as shortcode.
*/
function my_formatter($content) {
$new_content = '';
$pattern_full = '{(\[raw\].*?\[/raw\])}is';
$pattern_contents = '{\[raw\](.*?)\[/raw\]}is';
$pieces = preg_split($pattern_full, $content, -1, PREG_SPLIT_DELIM_CAPTURE);
@jkz
jkz / gist:11152955
Created April 21, 2014 19:05
I try to require sub-directories from a node module without success.
/moduleA
index.js
require('coffee-script/register')
require('./src')
extensions.js
require('coffee-script/register')
require('./src/extensions')
/src
@jkz
jkz / README.md
Last active August 29, 2015 14:18 — forked from mbostock/.block

For continuous data such as time series, a streamgraph can be used in place of stacked bars. This example also demonstrates path transitions to interpolate between different layouts. Streamgraph algorithm, colors, and data generation inspired by Byron and Wattenberg.

@jkz
jkz / TOTAL_NUMBER_OF_UNIQUE_ENGLISH_LOST_MY_NAME_BOOKS.js
Last active October 28, 2015 14:34
TOTAL_NUMBER_OF_UNIQUE_ENGLISH_LOST_MY_NAME_BOOKS
/* eslint semi: [2, "never"] */
var STORY_COUNT = 45 // [34, 48, 48, 31, 45, 36, 43, 38, 40, 34]
var HELPERS = range(0, 3)
var LENGTHS = range(3, 12)
var ALPHABET = 26 // Needs per country
var HELPER_COUNT = 3
var DIVERSITY = 6 // OR: [6, 6, 2, 2, 2, 2, 2, 2, 2, 2]
function range(start, end) {
@jkz
jkz / makefile
Created February 13, 2016 07:25
CXX = clang++
VERSION =
EXEC = sketch
FLAGS = -Wall -Werror -Wextra
LDDFLAGS = -L/usr/local/opt/opencv3/lib
LIBS = -lopencv_core.3.0 -lopencv_imgproc.3.0 -lopencv_imgcodecs.3.0
CPPFLAGS = -I/usr/local/opt/opencv3/include
OBJS = sketch.o
build: $(OBJS)