Skip to content

Instantly share code, notes, and snippets.

View findzen's full-sized avatar

Justin Taylor findzen

  • Los Angeles, CA
View GitHub Profile
@findzen
findzen / jquery.boilerplate.js
Last active August 29, 2015 13:56
jQuery lightweight plugin boilerplate
/*!
* jQuery lightweight plugin boilerplate
* Original author: @ajpiano
* Further changes, comments: @addyosmani, @findzen
* Licensed under the MIT license
*/
// the semi-colon before the function invocation is a safety
// net against concatenated scripts and/or other plugins
;(function(window, document, undefined) {
'use strict';
// ensure only one instance is running at a time
if (window._fz_wordcloud) return;
window._fz_wordcloud = true;
var MAX_WORDS = 50;
var BASE_FONT_SIZE = 12;
# EditorConfig helps developers define and maintain consistent
# coding styles between different editors and IDEs
# editorconfig.org
root = true
[*]
# Change these settings to your own preference
@findzen
findzen / dolphin_and_seagull.tt
Created September 5, 2015 22:07
Dolphin and seagull example from Teletype Studies Part 5 http://monome.org/docs/modular/teletype/studies-5/
M:
CV 1 N P.NEXT
TR.PULSE A
M ADD 50 RSH PARAM 5
I:
P.N 0
P.L 7
CV.SLEW D 1000
@findzen
findzen / gist:1358706
Created November 11, 2011 18:00
base href
<?php
define('BASE_HREF', '//' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']) . '/');
?>
<base href="<?=BASE_HREF?>" />
@findzen
findzen / .htaccess
Created November 14, 2011 23:58
refer all requests to index.php (Apache)
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteRule ^.*$ ./index.php
@findzen
findzen / Array.max
Created December 7, 2011 22:03
Array.max
// returns max value in array
Array.max = function(array) {
return Math.max.apply(Math, array);
}
@findzen
findzen / Array.shuffle.js
Created December 7, 2011 21:52
Array shuffle
Array.shuffle = function(array) {
var tmp, current, top = array.length;
if(top) while(--top) {
current = Math.floor(Math.random() * (top + 1));
tmp = array[current];
array[current] = array[top];
array[top] = tmp;
}
@findzen
findzen / hash.js
Created January 23, 2012 19:47
hash generator
var hash = function(s){
var n;
if (typeof(s) == 'number' && s === parseInt(s, 10)){
s = Array(s + 1).join('x');
}
return s.replace(/x/g, function(){
var n = Math.round(Math.random() * 61) + 48;
n = n > 57 ? (n + 7 > 90 ? n + 13 : n + 7) : n;
return String.fromCharCode(n);
});
@findzen
findzen / gist:1731354
Created February 3, 2012 17:46
History.js HTML4 / HTML5 parity
// save hash value for HTML5 browsers arriving to site via HTML4 hashed url
// this should be done before $(document).ready and History.js is loaded
window.initHash = window.location.hash;
$(document).ready(function() {
var baseURL = History.getBaseUrl(),
currentURL = History.getState().url,
relativeURL = currentURL.replace( baseURL, '' );
if ( !Modernizr.history && currentURL !== baseURL ) {