Skip to content

Instantly share code, notes, and snippets.

View remcoder's full-sized avatar
👓
software engineer -- obsessed with 3d printing

Remco Veldkamp remcoder

👓
software engineer -- obsessed with 3d printing
View GitHub Profile
@remcoder
remcoder / heart.less
Created February 10, 2011 22:28
heart shape in LESS css
.love {
.heart(hotpink, 200px);
.transform-rotate(15deg);
}
.heart(@color: red, @size: 100px) {
position: relative;
width: @size;
height: 90px;
@remcoder
remcoder / build_less.py
Created July 24, 2011 13:06
Compile LESS to CSS automatically whenever a file is modified
#!/usr/bin/env python
# determines filename and extension, then delegates compiling the LESS files to lessc via a shell command
import sys, os.path
from subprocess import call
src = sys.argv[1]
base,ext = os.path.splitext(src)
@remcoder
remcoder / QueryString.js
Created April 18, 2012 14:39
access querystring params from javascript
// adapted from: http://stackoverflow.com/questions/901115/get-query-string-values-in-javascript
// wrapped it in a module and only exposing a getter function make the datastructure immutable
// usage: var bla = QueryString.get('loginEnabled')
var QueryString = (function () {
var urlParams = {};
var e,
a = /\+/g, // Regex for replacing addition symbol with a space
r = /([^&=]+)=?([^&]*)/g,
d = function (s) { return decodeURIComponent(s.replace(a, " ")); },
@remcoder
remcoder / typescript.sublime-build
Created October 1, 2012 19:48
Sublime Text 2 build system for Typescript
{
"selector": "source.ts",
"cmd": ["tsc", "$file"],
"file_regex": "^(.+?) \\((\\d+),(\\d+)\\)(: .+)$",
"line_regex": "\\((\\d+),(\\d+)\\)",
"osx": {
"path": "/usr/local/bin:/opt/local/bin"
@remcoder
remcoder / facebook.loadonce.js
Last active December 16, 2015 14:49
Facebook.loadOnce is simple wrapper for the official Facebook JS SDK for promise-based lazy-loading.
/*global $ */
/*
_______ _______ _______ _______ _______ _______ _______ ___ _
| || _ || || || _ || || || | | |
| ___|| |_| || || ___|| |_| || _ || _ || |_| |
| |___ | || || |___ | || | | || | | || _|
| ___|| || _|| ___|| _ | | |_| || |_| || |_
| | | _ || |_ | |___ | |_| || || || _ |
@remcoder
remcoder / game of life with 8x8 bicolor led matrix
Last active September 23, 2016 12:02
I recently got one of those 8x8 LED matrices and I was playing with some Game of Life patterns when I found this pretty repeating pattern. I found it by starting with some random patterns. If you look closely you can see the pattern becoming a mirrored version of itself halfway through. Apparently the pattern doesn't repeat like this on an infin…
/*
I recently got one of those 8x8 LED matrices and I was playing with some Game of Life patterns when I found this pretty repeating pattern. I found it by starting with some random patterns. If you look closely you can see the pattern becoming a mirrored version of itself halfway through. Apparently the pattern doesn't repeat like this on an infinite grid but on this wrapping 8x8 grid it does ;-)
FYI, the LED matrix is a bicolor one (green/red) and has an I2C interface (http://www.adafruit.com/products/902). I'm using the colors as follows:
- newly created cells are green
- cells that are at least 10 generations old are red
- other living cells are yellow (simultaneously green+red)
It's hookup up to my Arduino Uno r3.
@remcoder
remcoder / kitt_scanner.ino
Last active May 23, 2019 01:23
ATTiny85 KITT scanner with 12 LEDs
// A KITT scanner made out of 12 deep red LEDs hooked up to nothing but an ATTiny85.
// It leverages the magic of charlieplexing to enable the ATTiny to drive those 12 LED's with just 4 pins.
//
// video: http://www.youtube.com/watch?v=MYvrKLcG-Vg
const int blue = 0;
const int green = 1;
const int red = 2;
const int white = 3;
@remcoder
remcoder / registerUnderscoreHelpers
Last active August 29, 2015 14:05
Meteor / Blaze: register all of Underscore's methods as template helpers
function registerUnderscoreHelpers() {
for (key in _) {
var prop = _[key];
if (typeof(prop) == 'function' ) {
createUnderscoreHelper(key, prop);
}
}
}
// Spacebars always passes an extra argument to the helper, an
@remcoder
remcoder / welcome
Last active August 29, 2015 14:14
DemocratieLAB Welcome Screen Updates reactively
Classes = new Mongo.Collection(‘classes’);
Classes.insert({
location: "Aa en Hunze",
schoolType: "Basisonderwijs",
route: "42",
active: true
});
<button data-action=continue
@remcoder
remcoder / nodemcu build script
Last active June 20, 2016 14:15
Fast, incremental Lua uploads for nodemcu
Fast, incremental Lua uploads for NodeMCU
INSTALLATION
1. This script requires nodemcu-uploader and gulp to be installed globally:
$ npm install -g gulp
$ npm install -g nodemcu-tool
$ pip install nodemcu-uploader