Skip to content

Instantly share code, notes, and snippets.

View johnhunter's full-sized avatar
🔋
Working on net-zero energy 🔋⚡️📈

John Hunter johnhunter

🔋
Working on net-zero energy 🔋⚡️📈
View GitHub Profile
@johnhunter
johnhunter / gist:1225265
Created September 18, 2011 16:55
Random color hex value
'#' + Math.floor(Math.random() * 0xffffff).toString(16);
@johnhunter
johnhunter / gist:1176741
Created August 28, 2011 14:35
TextMate snippets for JS modules
/*
Module $1
${7:Description of $1.}
@author ${TM_FULLNAME}
created `date +%Y-%m-%d`
*/
var ${1:module} = (function (${2:\$}) {
var ${5:bar};
${4:function foo () { return bar; \}
@johnhunter
johnhunter / table-cell-background.html
Created August 27, 2011 14:36
TextMate snippet: table cell background (html email)
<!--
Don't forget to add:
<html xmlns:v="urn:schemas-microsoft-com:vml">
-->
<!--[if gte mso 9]>
<v:image xmlns:v="urn:schemas-microsoft-com:vml" style='behavior: url(#default#VML);
display: inline-block;
position: absolute;
height: ${1:100}px;
width: ${2:100}px;
@johnhunter
johnhunter / css-drop-base64.php
Created August 25, 2011 13:25
TextMate CSS command: drop base64 encoded
#!/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 / drop-base64.php
Created August 25, 2011 13:22
TextMate command: drop base64 encoded
#!/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 / bash-git-alias.sh
Last active April 23, 2022 10:42
Git Bash aliases
# git aliases
alias gs='git status'
alias ga='git add $1'
alias gb='git branch $1'
alias gcl='git clone $1'
alias gco='git checkout $1'
alias gm='git commit -m $1'
alias gma='git commit -am $1'
alias gph='git push'
alias gpl='git pull'
@johnhunter
johnhunter / bookmarklet-searches.html
Created August 20, 2011 13:54
These bookmarklets provide various search dialogs
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Bookmarklets</title>
<style>
body {
background: #eee;
}
@johnhunter
johnhunter / jquery-ajax-callback-test.html
Created February 21, 2011 17:58
Test case for a possible bug with JQuery 1.5
<!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 / Date.to.js
Created February 16, 2011 11:23
Static Date methods for formatting js Date objects to strings
/*
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.fancybox-1.3.4jh.js
Created February 10, 2011 08:52
Modified version of FancyBox to allow configuration of the dropshadows
/*
* 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)