Skip to content

Instantly share code, notes, and snippets.

Avatar

John Hunter johnhunter

View GitHub Profile
@johnhunter
johnhunter / jQuery.reduce.js
Created Oct 27, 2010
jQuery.reduce - a jQuery plugin for functional programming
View jQuery.reduce.js
/*
jQuery.reduce - a jQuery plugin for functional programming
@author John Hunter
created 2010-09-17
use: $.reduce(arr, fnReduce, valueInitial);
fnReduce is called with arguments: [valueInitial, value, i, arr]
reduce will never be jQuery core - its not prototype :p (http://dev.jquery.com/ticket/1886)
*/
(function ($) {
@johnhunter
johnhunter / jQuery.browser-fork.js
Created Oct 27, 2010
Set browser forking classes on the html element
View jQuery.browser-fork.js
/*
Set browser forking classes on html element. Can be executed as soon as jQuery is loaded.
@dependency jQuery 1.4
flags are: webkit, opera, msie, mozilla, (safari flag not used), os-win, os-mac
*/
(function(flags, app) {
$.each($.browser, function(k, v) {
if (v === true && k !== 'safari') flags.push(k);
});
os('Win', 'os-win');
@johnhunter
johnhunter / jQuery.equalHeights.js
Created Oct 27, 2010
jQuery plugin that ensures html elements share the same height
View jQuery.equalHeights.js
/*
jQuery.equalHeights Plugin
@author John Hunter
@dependency jQuery 1.4.x
EqualHeights version 2.0 (2010-09-07 johnhunter.info)
Based on an idea copyright (c) 2008 Rob Glazebrook (cssnewbie.com)
use: $('#selector').equalHeights({minHeight: 200});
see defaults object for options
@johnhunter
johnhunter / jquery.fancybox-1.3.4jh.js
Created Feb 10, 2011
Modified version of FancyBox to allow configuration of the dropshadows
View jquery.fancybox-1.3.4jh.js
/*
* FancyBox - jQuery Plugin
* Simple and fancy lightbox alternative
*
* Examples and documentation at: http://fancybox.net
*
* Copyright (c) 2008 - 2010 Janis Skarnelis
* That said, it is hardly a one-person project. Many people have submitted bugs, code, and offered their advice freely. Their support is greatly appreciated.
*
* Version: 1.3.4 (11/11/2010)
@johnhunter
johnhunter / Date.to.js
Created Feb 16, 2011
Static Date methods for formatting js Date objects to strings
View Date.to.js
/*
Module Date.to - Static Date methods for formatting js Date objects to strings.
@author John Hunter
created 2010-03-30
use: Date.to.ddmmyyyy(new Date(), '^') => '30^03^2010'
*/
Date.to = (function () {
@johnhunter
johnhunter / jquery-ajax-callback-test.html
Created Feb 21, 2011
Test case for a possible bug with JQuery 1.5
View jquery-ajax-callback-test.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>ajax-error</title>
</head>
<body>
<pre id="output"></pre>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.js"></script>
<script>
@johnhunter
johnhunter / bookmarklet-searches.html
Created Aug 20, 2011
These bookmarklets provide various search dialogs
View bookmarklet-searches.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Bookmarklets</title>
<style>
body {
background: #eee;
}
View bash-git-alias.sh
alias ga='git add $1'
alias gb='git branch $1'
alias gcl='git clone $1'
alias gco='git checkout $1'
alias gd='git diff $1'
alias gdc='git diff --cached'
alias gl='git log --pretty=format:"%Cgreen%h %Creset %s %Cblueby %an (%ar) %Cred %d" --graph'
alias gm='git commit -m $1'
alias gma='git commit -am $1'
alias gp='git push'
@johnhunter
johnhunter / drop-base64.php
Created Aug 25, 2011
TextMate command: drop base64 encoded
View drop-base64.php
#!/usr/bin/env php
<?php
# John Hunter <https://github.com/johnhunter>
$path = getenv('TM_DROPPED_FILE');
$path_parts = pathinfo($path);
$info = getimagesize($path);
@johnhunter
johnhunter / css-drop-base64.php
Created Aug 25, 2011
TextMate CSS command: drop base64 encoded
View css-drop-base64.php
#!/usr/bin/env php
<?php
# John Hunter <https://github.com/johnhunter>
$path = getenv('TM_DROPPED_FILE');
$path_parts = pathinfo($path);
$info = getimagesize($path);
You can’t perform that action at this time.