Skip to content

Instantly share code, notes, and snippets.

View kevinmarx's full-sized avatar

Kevin Marx kevinmarx

  • Microsoft
  • Minneapolis
  • 20:10 (UTC -05:00)
View GitHub Profile
date frequency
4-8-19 173299
4-1-19 221179
3-25-19 238580
3-18-19 280574
3-11-19 284225
3-4-19 359185
2-25-19 410427
2-18-19 358718
2-11-19 239783

Keybase proof

I hereby claim:

  • I am kevinmarx on github.
  • I am kevinmarx (https://keybase.io/kevinmarx) on keybase.
  • I have a public key ASA-K5n3U9f8Z7AeO7eQW6v_rSub_0YU0lHxP8DAENi1WQo

To claim this, I am signing this object:

@kevinmarx
kevinmarx / color_clock.ino
Created February 19, 2015 15:03
Color Clock for Arduino
#include <Wire.h>
#include "RTClib.h"
#include <Adafruit_NeoPixel.h>
#define PIN 5
#define NUMPIXELS 8
RTC_Millis rtc;
Adafruit_NeoPixel pixels = Adafruit_NeoPixel(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);
int second;
DateTime now;
@kevinmarx
kevinmarx / node-red-workspace
Created February 10, 2015 20:24
Node-Red Workspace
[{"id":"1a6950c5.e596af","type":"bean","name":"Next Bus","uuid":"","connectiontype":"constant","connectiontimeout":"0"},{"id":"5ae1cb18.a51e34","type":"sentiment","name":"","x":504,"y":333,"z":"24232079.dbdce","wires":[["df520a61.20adf8","672c16c9.98d3e8"]]},{"id":"9c9fdf29.63602","type":"bean led","name":"","bean":"1a6950c5.e596af","x":933,"y":338,"z":"24232079.dbdce","wires":[]},{"id":"df520a61.20adf8","type":"debug","name":"","active":true,"console":"false","complete":"false","x":694,"y":423,"z":"24232079.dbdce","wires":[]},{"id":"8c524fac.73adb","type":"inject","name":"","topic":"","payload":"I am so happy!","payloadType":"string","repeat":"","crontab":"","once":false,"x":320,"y":307,"z":"24232079.dbdce","wires":[["5ae1cb18.a51e34"]]},{"id":"f4ac7367.0b539","type":"inject","name":"","topic":"","payload":"I am so angry!","payloadType":"string","repeat":"","crontab":"","once":false,"x":324,"y":372,"z":"24232079.dbdce","wires":[["5ae1cb18.a51e34"]]},{"id":"50827230.af7d8c","type":"inject","name":"","topic":"
asdf
@kevinmarx
kevinmarx / gist:6594480
Last active December 23, 2015 06:29
Git flags for showing state in bash
export PS1="\e[36;40m\W\e[0m \e[35;40m\$(__git_ps1 ' (%s)') \e[0m\]\n\$ "
# for more info, http://git.kernel.org/?p=git/git.git;a=blob;f=contrib/completion/git-completion.bash;hb=HEAD
# __git_ps1 flags
# show * if there are untracked changes and + if staged and uncommitted changes
export GIT_PS1_SHOWDIRTYSTATE=1
# show $ if there are stashed changes
export GIT_PS1_SHOWSTASHSTATE=1
# show % if there are untracked files
export GIT_PS1_SHOWUNTRACKEDFILES=1
@kevinmarx
kevinmarx / how_to_train_your_robot.md
Last active December 22, 2015 01:59
I am giving a talk at the local Node user group on building a life embetterment robot. This is my current outline.

How To Train Your Robot

Not that kind of robot

This kind of robot

What is this robot you speak of?

Enter: Hubot

@kevinmarx
kevinmarx / topic.js
Last active December 21, 2015 07:19
topic helper for handlebars templates.
var Handlebars = require('handlebars')
var _ = require('underscore')
/*
* Adds support for passing items into a context as variables
*
* USAGE: {{#topic this foo=bar baz=qux}}
* USAGE: {{#topic foo=bar}} no need for a context, this will create a new context object
*/
@kevinmarx
kevinmarx / chunk.js
Last active December 19, 2015 18:18
Method for chunking arrays into a 2 dimensional array.
function(array, chunk) {
return [].concat.apply([],
array.map(function(elem, i) {
return i % chunk ? [] : [array.slice(i, i + chunk)]
})
)
}
@kevinmarx
kevinmarx / js-dateMethods.js
Last active December 18, 2015 03:38
Some nice methods to add on to the js date interface
Date.prototype.stdTimeOffset = function() {
var jan = new Date(this.getFullYear(), 0, 1) // july and jan are currently in/out of DST in every timezone.
var jul = new Date(this.getFullYear(), 6, 1)
return Math.max(jan.getTimezoneOffset(), jul.getTimezoneOffset())
}
Date.prototype.isDST = function() {
return this.getTimezoneOffset() < this.stdTimeOffset()
}