Skip to content

Instantly share code, notes, and snippets.

View andyhullinger's full-sized avatar

Andy Hullinger andyhullinger

  • Medill School of Journalism, Media, Integrated Marketing Communications
  • Evanston, Illinois
  • 19:48 (UTC -05:00)
View GitHub Profile
@andyhullinger
andyhullinger / OSX Dock Spacers
Last active August 29, 2015 13:56
Simple OSX terminal command to ad blank spacers to your dock so that you can 'pretty' how you organize your Mac App icons. Simply repeat the command to create additional spacers. You'll have to "force-restart" your dock to see the newly created spacers, that's what the (killall) command is for.
defaults write com.apple.dock persistent-apps -array-add '{"tile-type"="spacer-tile";}'
killall Dock
@andyhullinger
andyhullinger / OSX Get Image Dimensions
Created February 11, 2014 02:07
Another OSX Terminal tip I use all the time. Simple cd into a folder full of images and use the Mac's (scriptable image processing system) to read out the pixel dimensions of all the images.
sips -g pixelWidth -g pixelHeight *
@andyhullinger
andyhullinger / OSX Add Retina Suffix
Created February 11, 2014 02:12
A nify one-line OSX Terminal command to add the Retina @2x suffix to a folder full of .png files. Just cd into the folder and run this command.
for f in *.png; do NEW=${f%.png}@2x.png; mv ${f} "${NEW}"; done;
@andyhullinger
andyhullinger / OSX Spin up a Simple PHP Server
Created June 24, 2014 17:34
Quick and dirty local web server for simple testing of php (handy for verifying includes)
php -S localhost:8000

Convert SVG polyline to path

Replace all instances of <polyline with <path and points=" with d="M.

 <?xml version="1.0" encoding="utf-8"?>
 <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
 <svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="1000px" height="1000px" viewBox="0 0 1000 1000" enable-background="new 0 0 1000 1000" xml:space="preserve">
-<polyline fill="#FFFFFF" stroke="#000000" stroke-miterlimit="10" points="100.712,141.534 582.904,227.835 425.37,478.521
+
@andyhullinger
andyhullinger / OSX Simple batch image resizing
Created November 19, 2014 17:10
OSX Simple batch image resizing
sips -Z 1024 *.png
A cap "Z" to retain aspect ratio
Provide longest dimension in pixels to fit image to
Use wildcard.ext to batch all files of same type

#Batch convert folder of jpeg or png files cd into image folder and generate new folder of converted images

mkdir jpegs; sips -s format jpeg *.* --out jpegs

mkdir pngs; sips -s format png *.* --out pngs

@andyhullinger
andyhullinger / gist:0f4e1736a42258134b19
Created October 10, 2015 12:12
Remove all .DS_Store files
find . -name '*.DS_Store' -type f -delete
@andyhullinger
andyhullinger / gist:d87ac9ca6a9bca45740a
Created November 19, 2015 09:29
WGET grab all linked images from a webpage
wget localhost:8000 -E -H -p -nd
//export codepen to local folder open in python -m SimpleHTTPServer and use this to grab linked images
var keys = [UIKeyCommand]()
override func viewDidLoad() {
super.viewDidLoad()
//configureGameControllers()
for digit in "abcdefghijklmnopqrstuvwxyz"
{
keys.append(UIKeyCommand(input: String(digit), modifierFlags: nil, action: Selector("keyPressed:")))
}