Skip to content

Instantly share code, notes, and snippets.

#include <Keyboard.h>
const int PEDAL_PIN = 2;
int pedalVal = LOW;
char keyToSend = 'm';
void setup() {
Serial.begin(9600);
pinMode(PEDAL_PIN, INPUT);
Keyboard.begin();
" copy all this into a vim buffer, save it, then...
" source the file by typing :so %
" Now the vim buffer acts like a specialized application for mastering vim
" There are two queues, Study and Known. Depending how confident you feel
" about the item you are currently learning, you can move it down several
" positions, all the way to the end of the Study queue, or to the Known
" queue.
" type ,, (that's comma comma)
@EnotionZ
EnotionZ / url_param.js
Last active December 22, 2016 14:41
Get URL Parameter
var getURLParameter = function(name) {
var valStr = decodeURIComponent( (RegExp(name + '=' + '(.+?)(&|$)').exec(location.search)||[0,null])[1]);
return valStr === 'null' ? null : valStr;
};
// url param map
var urlParams = location.search.substr(1).split('&').reduce(function(map, item) {
item = item.split('=');
map[item[0]] = item[1];
return map;
@EnotionZ
EnotionZ / gulpfile.js
Created April 4, 2016 02:00
Gulpfile for browserify + babelify + watchify
/**
"devDependencies": {
"babel-preset-es2015": "~6.6.0",
"babel-preset-react": "~6.5.0",
"babelify": "~7.2.0",
"browserify": "~4.2.0",
"gulp": "~3.9.0",
"gulp-notify": "~1.4.0",
"gulp-util": "~2.2.19",
"react": "~0.14.8",
@EnotionZ
EnotionZ / RasPi-blinkToggle.js
Created August 10, 2012 06:08
Cycle voltage on Raspberry Pi gpio header in node
var gpio = require('gpio');
var header4, header17, intervalTimer;
header4 = gpio.export(4);
header17 = gpio.export(17, {
ready: function() {
intervalTimer = setInterval(function() {
header4.set();
setTimeout(function() { header4.reset(); }, 500);
}, 1000);
@EnotionZ
EnotionZ / ieversion.js
Created October 6, 2010 18:18
IE-version sniffing
// capture x.x portion and store as a number, returns NaN if not IE
var IE = /MSIE (\d+\.\d+);/.test(navigator.userAgent) ? parseFloat(RegExp.$1) : NaN;
@EnotionZ
EnotionZ / .bash_profile
Created June 28, 2010 14:51
Just my bash file
function parse_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/'
}
# Displays git branch next to directory path
function proml {
local BLUE="\[\033[0;34m\]"
local RED="\[\033[0;31m\]"
local LIGHT_RED="\[\033[1;31m\]"
local GREEN="\[\033[0;32m\]"
@EnotionZ
EnotionZ / interfaceDeveloper.js
Created May 8, 2010 18:40
An implementation of the interface system in Javascript that takes a design form similar to other popular object-oriented languages such as Java, C# and PHP.
/* An implementation of the interface system in Javascript that takes a design form
similar to other popular object-oriented languages such as Java, C# and PHP. */
Function.prototype.implements = function(){
var class = this;
if(arguments.length < 1) {
throw new Error("Expecting interface as argument but found none.");
}
for (var i =0; i<arguments.length; i++){