Skip to content

Instantly share code, notes, and snippets.

View davemo's full-sized avatar
😀

David Mosher davemo

😀
View GitHub Profile
@davemo
davemo / Makefile
Last active April 12, 2017 21:04
makefile with helpful default targets!
VERSION ?= $(shell cat VERSION)
.PHONY: help version clean bump release
.DEFAULT_GOAL := help
build: ## build the app
do stuff
clean: ## clean artifacts
@davemo
davemo / Dockerfile
Created March 22, 2017 20:35
nodenv exits with a 1 value with vanilla docker image with missing deps
FROM ubuntu:xenial
MAINTAINER Test Double <dave@testdouble.com>
RUN apt-get -y update
RUN apt-get -y install git-core
ENV NODENV_ROOT /usr/local/lib/nodenv
RUN git clone https://github.com/nodenv/nodenv.git ${NODENV_ROOT}
RUN git clone https://github.com/nodenv/node-build.git ${NODENV_ROOT}/plugins/node-build
RUN git clone https://github.com/nodenv/nodenv-update.git ${NODENV_ROOT}/plugins/nodenv-update
@davemo
davemo / route_manifest.js
Last active November 24, 2016 10:06
Maybe you want to add a global "resolve" property to all routes in an angular app, this is one way you could achieve that. I would probably still factor out the logic inside my app.config block into some sort of Service abstraction, but this should serve as enough of a general idea.
app.constant("RouteManifest", {
"/login" : {
templateUrl: 'templates/login.html',
controller: 'LoginController'
},
"/home" : {
templateUrl: 'templates/home.html',
controller: 'HomeController'
},
@davemo
davemo / README.md
Created September 13, 2011 22:59
A simple Backbone.js powered Slideshow, with pause/play controls and jump-to controls.

#A simple Slideshow module wrapped in a Backbone View

  • Dependencies ** underscore.js ** backbone.js

Viewable in action in this jsfiddle

@davemo
davemo / jquery.touch.js
Last active November 2, 2016 10:24 — forked from twalling/jquery.touch.js
Zeptos touch events, ported to work inside jQuery, including jQuery Mobiles scroll suppression.
;(function($){
var touch = {},
touchTimeout, tapTimeout, swipeTimeout,
longTapDelay = 750, longTapTimeout
function parentIfText(node) {
return 'tagName' in node ? node : node.parentNode
}
function swipeDirection(x1, x2, y1, y2) {
@davemo
davemo / detect.touch.cs
Created April 19, 2012 21:46
How to detect touch events on a GUITexture in Unity3d
void Update () {
if(Input.touchCount == 1) {
Touch touch = Input.touches[0];
if(touch.phase == TouchPhase.Ended && guiTexture.HitTest(touch.position)) {
appController.SendMessage("nextProduct");
}
}
}
@davemo
davemo / app.coffee
Last active September 15, 2016 08:36
A .coffee file with Reacts JSX, compiles fine in Sublime Text using 'Coffee: Display JavaScript', but won't compile with the coffeescript CLI or the coffeeify transform for browserify. Relevant reading: http://blog.vjeux.com/2013/javascript/react-coffeescript.html and https://groups.google.com/forum/#!msg/reactjs/NHy6UNqm-zU/i6Xr0-jP7nIJ
`/** @jsx React.DOM */`
React = require("react")
$ = require("jquery-browserify")
converter = new Showdown.converter
Comment = React.createClass
render: ->
rawMarkup = converter.makeHtml @props.children.toString()
@davemo
davemo / protokit.js
Created December 4, 2010 00:10
A prototyping kit in progress.
(function($, _) {
$.cil = $.cil || {};
$.cil.protokit = function(opts) {
var self = {};
var defaults = {
boilerplate: false
};
_.extend(defaults, opts);
@davemo
davemo / backbone.sessionStorage.js
Last active April 15, 2016 22:53
Backbone sessionStorage Adapter
/**
* Backbone sessionStorage Adapter
* Based on https://github.com/jeromegn/Backbone.localStorage
*/
(function() {
// A simple module to replace `Backbone.sync` with *sessionStorage*-based
// persistence. Models are given GUIDS, and saved into a JSON object. Simple
// as that.
@davemo
davemo / .gitconfig
Last active April 15, 2016 17:03
.gitconfig
$ cat ~/.gitconfig
[user]
name = David Mosher
email = davidmosher@gmail.com
[core]
autocrlf = input
safecrlf = false
editor = vim
excludesFile = /Users/davidmosher/.gitignore_global
[github]