Skip to content

Instantly share code, notes, and snippets.

View gvn's full-sized avatar
🥀
technopagan is the term

Gavin Suntop gvn

🥀
technopagan is the term
View GitHub Profile
@gvn
gvn / binding.js
Created June 19, 2012 23:53
event binding pattern
window.Component = {
init: function () {
var self = this;
self.events.parent = self;
self.callbacks = {};
},
events: {
actionHappened: function (event) {
var self = this.parent;
@gvn
gvn / somen-tempeh-broccoli
Created July 11, 2012 02:58
Somen with Tempeh and Broccoli
Somen with Tempeh and Broccoli
- Tempeh brick
- Broccoli florets
- Canola oil
- 1 tbsp Maple Syrup
- 1 tbsp Tamari
- 1 tbsp Water
- 1/4 tsp liquid smoke
- Somen noodles (1 bundle broken in half)
@gvn
gvn / jsproto.js
Created August 15, 2012 20:48
JS Prototype Fun
Function.prototype.times = function (times) {
while (times) {
this.call();
times--;
}
}
@gvn
gvn / Makefile
Created December 3, 2012 00:59
Arduino Makefile Starter
BOARD_TAG = uno
ARDUINO_PORT = /dev/cu.usb*
ARDUINO_LIBS =
include /usr/local/arduino/Arduino.mk
@gvn
gvn / arduino-sublime.md
Created December 3, 2012 18:55
Building and Uploading Arduino Sketches in Sublime Text 2 (OSX)

Building and Uploading Arduino Sketches in Sublime Text 2 (OSX)

  • Download this Makefile

  • Install YAML and SerialPort Perl libraries

Using Terminal:

sudo cpan >

@gvn
gvn / grunt.sublime-build
Created December 26, 2012 20:16
Sublime Text 2 : Grunt Build System
{
"cmd": ["grunt", "--no-color"],
"selector": ["source.js", "source.less", "source.json"]
}
@gvn
gvn / objectCreate.js
Last active December 11, 2015 18:58
Illustrated side effect of modifying children of object properties on prototypes. IMO: Object.create() should have a deep copy option.
var Person = function () {};
Person.prototype.name = 'Person';
Person.prototype.config = {
arms: 2
};
Person.prototype.metadata = {
type: 'Person'

In a repeating sequence of integers the sum of any group of concurrent integers of the same length as the pattern will always be the same.

IE:

1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 ...

5 + 1 + 2 + 3 + 4 = 15
1 + 2 + 3 + 4 + 5 = 15
4 + 5 + 1 + 2 + 3 = 15

@gvn
gvn / onehandword.js
Last active December 15, 2015 11:09
Generate random words that can be typed with one hand.
function randomWord(hand, length) {
var chooseVowel = !!Math.round(Math.random()),
word = '';
while (length) {
if (chooseVowel) {
word += hand.vowels[Math.floor(Math.random() * hand.vowels.length)];
} else {
word += hand.consonants[Math.floor(Math.random() * hand.consonants.length)];
}
@gvn
gvn / gist:5427031
Last active December 16, 2015 11:19
How To Join Multiple Video Files (OSX)

How To Join Multiple Video Files (OSX)

Dependencies

  • Homebrew
  • mencoder (brew install mplayer --use-gcc)
cat video1.avi video2.avi > output.avi
mencoder -forceidx -oac copy -ovc copy output.avi -o output_final.avi