Skip to content

Instantly share code, notes, and snippets.

View mrtnbroder's full-sized avatar
🕶️
λ

Martin Broder mrtnbroder

🕶️
λ
View GitHub Profile
gulp = require("gulp")
gulpUtil = require("gulp-util")
exec = require("child_process").exec
sys = require("sys")
gulpCoffee = require("gulp-coffee")
gulpConcat = require("gulp-concat")
gulpLess = require("gulp-less")
gulpLivereload = require("gulp-livereload")
gulpWatch = require('gulp-watch')
0.008 secs: processImages
assetgraph-sprite: Canvas not found, skipping
0.000 secs: spriteBackgroundImages
events.js:72
throw er; // Unhandled 'error' event
^
Error: spawn ENOENT
at errnoException (child_process.js:988:11)
at Process.ChildProcess._handle.onexit (child_process.js:779:34)
<div ng-include src="templateBasedOnWidth"></div>
@mrtnbroder
mrtnbroder / gist:7dd45b05f38d51c9ad76
Created January 28, 2015 18:54
Simple Event Dispatcher
var EventSystem = (function() {
var self = this;
self.queue = {};
var EventSystem = {
trigger: function (event, data) {
var queue = self.queue[event];
@mrtnbroder
mrtnbroder / gist:c6325d1d5fde59f57ce1
Last active August 29, 2015 14:17
find nodes with subpixel height
var nodes = document.querySelectorAll('*');
var heights = _.filter(nodes, function(node) {
var height = parseFloat(node.style.height);
if ((height % 1) !== 0 && !isNaN(height)) {
return true;
}
return false;
});
@mrtnbroder
mrtnbroder / gist:5dde44c4fdc7690a60da
Created May 18, 2015 13:26
get distance between two coordinates
function distance(obj) {
var R = 6371; // km
var dLat = (obj.lat2 - obj.lat1) * Math.PI / 180;
var dLon = (obj.lon2 - obj.lon1) * Math.PI / 180;
var lat1 = obj.lat1 * Math.PI / 180;
var lat2 = obj.lat2 * Math.PI / 180;
var a = Math.sin(dLat / 2) * Math.sin(dLat / 2) +
Math.sin(dLon / 2) * Math.sin(dLon / 2) * Math.cos(lat1) * Math.cos(lat2);
var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
import Rx from 'rx'
import request from 'superagent'
export function getCurrentPosition(geolocationOptions = {enableHighAccuracy: true, timeout: 8000}) {
if (!window.navigator && !window.navigator.geolocation) {
throw new TypeError('geolocation not available')
}
return new Rx.AnonymousObservable((observer) => {
@mrtnbroder
mrtnbroder / gist:6183473
Last active December 20, 2015 19:29
why?
// this happens when the view get's removed
if ($.MapWrapper != null) { // Alloy <View id="Wrapper">, wraps the map
$.MapWrapper.remove($.MapView); // the map <View ns="ns="Ti.Map" id="MapView">
$.MapWrapper = $.MapView = null;
$.destroy();
}
// Detect autoplay
// ---------------
// This script detects whether the current browser supports the
// autoplay feature for HTML5 Audio elements, and it sets the
// `AUTOPLAY` variable accordingly.
// Used in the Meteor app [PicDinner](http://picdinner.com)

Contract Killer

The popular open-source contract for web designers and developers by Stuff & Nonsense

  • Originally published: 23/12/2008
  • Revised date: 15/12/2013
  • Original post