Skip to content

Instantly share code, notes, and snippets.

View edwardhotchkiss's full-sized avatar

Edward Hotchkiss edwardhotchkiss

View GitHub Profile
@edwardhotchkiss
edwardhotchkiss / Makefile
Created March 5, 2014 23:30
ATtiny85 avr-gcc / avrdude Makefile
DEVICE = attiny85
CLOCK = 8000000
PROGRAMMER = stk500v1
PORT = /dev/tty.usbmodem1421
BAUD = 19200
FILENAME = main
COMPILE = avr-gcc -Wall -Os -DF_CPU=$(CLOCK) -mmcu=$(DEVICE)
all: usb clean build upload
@edwardhotchkiss
edwardhotchkiss / a.js
Created December 10, 2013 20:28 — forked from mrvisser/a.js
var events = require('events');
var b = require('./b');
var emitter = module.exports = new events.EventEmitter();
module.exports.init = function(callback) {
b.init(function() {
emitter.emit('done');
});
};
/**
* @library wrapper.js
* @author Edward Hotchkiss <edward@candidblend.la>
* @contributor Avi Deitcher <avi@deitcher.net>
* @description wraps any function/module/object/lib within an
* AMD-compliant definition if possible, otherwise binding to `window`
* @license MIT
*/
@edwardhotchkiss
edwardhotchkiss / syntax.css
Created March 9, 2012 04:34 — forked from scotu/solarized.css
Solarized Light Pygments CSS / Jekyll
.highlight {
background-color: #efefef;
padding: 7px 7px 7px 10px;
border: 1px solid #ddd;
-moz-box-shadow: 3px 3px rgba(0,0,0,0.1);
-webkit-box-shadow: 3px 3px rgba(0,0,0,0.1);
box-shadow: 3px 3px rgba(0,0,0,0.1);
margin: 20px 0 20px 0;
overflow: hidden;
/**
* Uses MongooseJS to Connect to MongoDB
* .Maps out all collections within
*/
var mongoose = require('mongoose')
, MONGO_DB = 'mongodb://localhost/test';
mongoose.connect(MONGO_DB);
@edwardhotchkiss
edwardhotchkiss / graphics_magick_center_image_on_canvas.js
Created October 31, 2012 03:32
Use GM Module (Graphics Magick) for Node.js to center an image on a white background canvas
var gm = require('gm');
var canvasWidth = 248;
var canvasHeight = 389;
gm(__dirname + '/original.jpg').size(function(error, size) {
if (error) {
console.error(error);
@edwardhotchkiss
edwardhotchkiss / calculatePaddedNewAspectRatio.js
Created October 26, 2012 19:02
Calculate new Width/Height of a Video or Image based on current width and height, then add padding to update to desired aspect ratio returning a new aspect ratio (say 16:9 or 4:3 etc) set of dimensions.
/**
* @method calculatePaddedNewAspectRatio
* @param {Number} rW New Aspect Ratio Width
* @param {Number} rH New Aspect Ratio Height
* @param {Number} cW Current Width
* @param {Number} cH Current Height
* @return {Object} Aspect ratio correct .width and .height
**/
@edwardhotchkiss
edwardhotchkiss / angular_app.js
Created May 25, 2012 03:22
Jekyll Live Search with AngularJS (blog)
/**
* Setup Module with `highlight` filter
*/
var JekyllApp = angular.module('JekyllApp', [], function($routeProvider) {
});
JekyllApp.filter('highlight', function() {
return function(text, filter) {
@edwardhotchkiss
edwardhotchkiss / action.js
Created May 25, 2012 02:48
node.js list all mongodb databases
/**
* Uses MongooseJS to Connect to MongoDB
* .Maps out all collections within
*/
var mongoose = require('mongoose')
, MONGO_DB = 'mongodb://localhost/test';
mongoose.connect(MONGO_DB);
@edwardhotchkiss
edwardhotchkiss / Gruntfile.js
Created March 1, 2013 04:02
Grunt 0.4.0 with LESS, Uglify, Concat, CSSMin, Watch production ready file.
/*!
* @description Grunt@!!!!!
*/
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
uglify: {