Skip to content

Instantly share code, notes, and snippets.

View smokinjoe's full-sized avatar

Joe smokinjoe

View GitHub Profile
@smokinjoe
smokinjoe / gist:4116354
Created November 20, 2012 06:21
joemoticons
( ͡° ͜ʖ ͡°)
(•_•) ( •_•)>⌐■-■ (⌐■_■)
@smokinjoe
smokinjoe / JS hooks n' ladders
Last active December 11, 2015 22:29
Event hook system in JavaScript
var joevent = (function () {
// private vars
// JOE NOTE: add _ to varnames?
var debug = false;
var hooks = {};
// private methods
var _call_hook = function (method, args, context) {
args.push(context); // should this be here or in fire_event() ?
method.apply(window, args);
@smokinjoe
smokinjoe / console.log the fix
Created January 30, 2013 03:11
Google chrome fix for console.log
// google chrome workaround
var log = function () {
console && console.log && console.log.apply(console,arguments);
};
@smokinjoe
smokinjoe / gist:5806462
Created June 18, 2013 15:41
parallax experiments
<!DOCTYPE html>
<html lang="en">
<head>
<!-- http://code.flickr.net/2013/06/04/adventures-in-jank-busting-parallax-performance-and-the-new-flickr-home-page/ -->
<meta charset="utf-8">
<title>Parallax</title>
<style type="text/css">
body {
height: 10000px;
@smokinjoe
smokinjoe / gist:5861897
Created June 25, 2013 20:06
Simple way to create a 'bounce' effect with css's keyframes
.myBounceDiv {
-moz-animation:bounce .40s linear;
-webkit-animation:bounce .40s linear;
}
@-moz-keyframes bounce {
0%{ -moz-transform:scale(0); opacity:0;}
50%{ -moz-transform:scale(1.3); opacity:0.4; }
75%{ -moz-transform:scale(0.9); opacity:0.7;}
100%{ -moz-transform:scale(1); opacity:1;}
@smokinjoe
smokinjoe / ajax_template
Last active December 24, 2015 08:59
AJAX Template
$.ajax({
type: "POST",
url: "/route/to/dealie",
dataType: 'json',
data: {
var1 : var1,
var2 : var2
},
// given a json object with result property
success: function(response) {
@smokinjoe
smokinjoe / html5 boilerplate
Last active February 12, 2022 09:46
basic html5 boilerplate
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Title</title>
<meta name="description" content="The HTML5 Herald">
<meta name="author" content="SitePoint">
@smokinjoe
smokinjoe / js_module
Last active August 29, 2015 14:00
Nice module pattern
// http://yuiblog.com/blog/2007/06/12/module-pattern/
//Self-Executing Anonymous Func: Part 2 (Public & Private)
(function( skillet, $, undefined ) {
//Private Property
var isHot = true;
//Public Property
skillet.ingredient = 'Bacon Strips';
@smokinjoe
smokinjoe / gist:ccf599bf3b0a87055d24
Created May 3, 2014 01:12
function to find the next/prev value in an array (circular)
return function (_array, _id) {
var _result = {};
var _clean_array = _.compact(_array);
_result.next = _clean_array[($.inArray(_id, _clean_array) + 1) % _clean_array.length];
_result.prev = _clean_array[($.inArray(_id, _clean_array) - 1 + _clean_array.length) % _clean_array.length];
return _result;
};
@smokinjoe
smokinjoe / gist:5542209ce4d80b20b75c
Created January 23, 2015 00:41
mithril.js sandbox
<!doctype html>
<title>My Appola</title>
<script src="lodash.js"></script>
<script src="JocalStorage.js"></script>
<script src="mithril.js"></script>
<script>
JocalStorage.init();
// create mithril module
var todo = {};