Skip to content

Instantly share code, notes, and snippets.

View DrewDahlman's full-sized avatar

Drew Dahlman DrewDahlman

View GitHub Profile
$this.bind('touchmove', function(event){
var touchDiffY = event.originalEvent.changedTouches[0].screenY - data.startY;
var x = data.startX - event.originalEvent.touches[0].pageX;
var y = data.startY = touchDiffY;
var r = Math.atan2(y,x);
var angle = Math.round(r*180/Math.PI);
//angle = 360 - Math.abs(angle);
window.onkeydown = function(event){
keyboard.press(event.keyCode);
}
}());
var $panes = $(".waypoint").length-1;
var $currentPane = $(".waypoint").first();
var keyboard = {
press:function(keycode){
console.log(keycode);
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
@DrewDahlman
DrewDahlman / collisionDetection.js
Created May 14, 2013 22:54
Collision Detection
self.check_collision = function(x1, y1, w1, h1, x2, y2, w2, h2) {
w2 += x2;
w1 += x1;
if (x2 > w1 || x1 > w2) return false;
h2 += y2;
h1 += y1;
if (y2 > h1 || y1 > h2) return false;
return true;
}
@DrewDahlman
DrewDahlman / facebook share
Last active December 30, 2015 14:59
Facebook Sharing requires - <script src='http://connect.facebook.net/en_US/all.js'></script>
var shareObj = {
method: 'feed',
link: 'http://LINKEXAMPLE.com',
picture: 'IMAGE URL',
name: 'NAME',
caption: 'EXAMPLE.com',
description: "DESCRIPTION",
};
// FB setup ---------------------------------------------
$ingredientSearch.on 'blur', (event) =>
if (!$(document.activeElement).is($('.tt-dropdown-menu')))
$window.unbind 'keydown'
$ingredientSearch.attr('placeholder',SouthernComfort.translations.drink_maker.add_ingredient)
$("#ingredient_search_area .tt-hint").html('')
$ingredientSearch.val('')
$("#search_icon").html('S').removeClass('active')
setTimeout =>
$("#ingredient_search_area .tt-query").typeahead("setQuery","")
@DrewDahlman
DrewDahlman / example
Last active August 29, 2015 14:13
imgur
$(".preload").each( function(){
var image_path = $(this).data('image')
$(this).imgur({
img: image_path
}, function(el, data){
$(el).css({
'background-image': 'url('+data+)'
})
})
/**
* Copyright 2013-2014, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule React
*/
env EDITOR=nano crontab -e
0 12 1 4 * curl -s http://www.gutenberg.org/cache/epub/84/pg84.txt |say &
@DrewDahlman
DrewDahlman / App
Created June 1, 2015 18:57
Full Screen Kiosk
app.on('ready', function() {
var Screen = require('screen');
var size = Screen.getPrimaryDisplay().size;
var width = size.width;
var height = size.height;
// Create the browser window.