Skip to content

Instantly share code, notes, and snippets.

View joshcarr's full-sized avatar
👁️
Seeing

Josh Carr joshcarr

👁️
Seeing
View GitHub Profile
/*!
* JavaScript - loadGoogleMaps( version, apiKey, language, sensor )
*
* - Load Google Maps API using jQuery Deferred.
* Useful if you want to only load the Google Maps API on-demand.
* - Requires jQuery 1.5
*
* UPDATES by Gavin Foley
* - Tidied JS & made it JSLint compliant
* - Updated script request to Google Maps API to be protocol relative
@joshcarr
joshcarr / gist:9139097
Created February 21, 2014 17:40
Regex for finding HTML tags with content
(?:<tag>)([\s\S]+?)(?:</tag>)

Contract Killer

The popular open-source contract for web designers and developers by Stuff & Nonsense

  • Originally published: 23/12/2008
  • Revised date: 15/12/2013
  • Original post

@joshcarr
joshcarr / vertical-align.css
Created January 13, 2014 19:04
Vertical align anything with just 3 lines of CSS
/* http://zerosixthree.se/vertical-align-anything-with-just-3-lines-of-css/ */
.vertical-align {
position: relative;
top: 50%;
transform: translateY(-50%);
}
/* with vendor prefixes */
.vertical-align {
position: relative;
#!/bin/bash
set -o errexit
# Author: David Underhill
# Script to permanently delete files/folders from your git repository. To use
# it, cd to your repository's root and then run the script with a list of paths
# you want to delete, e.g., git-delete-history path1 path2
#
# retrieved from: http://dound.com/2009/04/git-forever-remove-files-or-folders-from-history/
#
@joshcarr
joshcarr / README.md
Created November 7, 2013 04:26 — forked from mbostock/.block

This example uses d3.geo.bounds to draw a diagonal line for the bounding box for each county.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
#!/usr/bin/env python
import os
import re
import subprocess
import sys
modified = re.compile('^(?:M|A)(\s+)(?P<name>.*)')
CHECKS = [
@joshcarr
joshcarr / gr.sh
Created July 25, 2013 01:06
Runs script, and prints a notification with growl when it finishes
#!/bin/sh
#
# Runs script, and prints a notification with growl when it finishes
#
# Written sometime in 2006, posted 2007/08
#
# With Tips from Ranger Rick, Tim Bunce and Ruben Fonseca
#
# Run the command, including arguments with spaces
@joshcarr
joshcarr / optimizepngs
Last active December 16, 2015 15:29
Runs a directory of PNGs through a quantizer and optimizers and outputs to a compressed directory.
#!/bin/sh
# adapted from: https://github.com/bingalls/webGraphicsMagick/blob/master/compressLossy.sh
COMPRESS_DIR='./compressed' #Creates compressed copies in $COMPRESS_DIR.
#Create dest dir for compressed copies of images
if [ ! -d $COMPRESS_DIR ];then
mkdir $COMPRESS_DIR
else
#read -t15 is bash for timeout of 15 seconds