Skip to content

Instantly share code, notes, and snippets.

View trey's full-sized avatar
🐢
Slow and steady

Trey Piepmeier trey

🐢
Slow and steady
View GitHub Profile
anonymous
anonymous / LESS: center container
Created February 13, 2013 15:48
A LESS mixin I wrote awhile back that easily lets you set a container to position:absolute and center it. Usage: .some-element { .center-container(450px, 100px); }
.center-box(@width: 300px, @height: 200px) {
position:absolute;
top:50%;
left:50%;
width:@width;
height:@height;
margin-top:-(@height / 2);
margin-left:-(@width / 2);
}
#!/bin/bash
# Usage: ./deleteOld "bucketname" "30 days"
s3cmd ls s3://$1 | while read -r line;
do
createDate=`echo $line|awk {'print $1" "$2'}`
createDate=`date -d"$createDate" +%s`
olderThan=`date -d"-$2" +%s`
if [[ $createDate -lt $olderThan ]]
@rustle
rustle / gist:4342288
Created December 20, 2012 01:31
Tower with Kaleidoscope 2 beta

Due to a change in Kaleidoscope 2, Tower 1.4.14 does not work with the latest beta of Kaleidoscope 2 (Build 99 and up) out of the box. We are working with the fine folks at Tower to address this issue.

If you are running 1.4.14, download this script and follow the included instructions:

Kaleidoscope Merge Tool

Future versions of Tower should work as expected without the need for these steps.

@tlberglund
tlberglund / git-loglive
Last active September 18, 2025 07:57
Log Live Git Command
#!/bin/bash
while :
do
clear
git --no-pager log --graph --pretty=oneline --abbrev-commit --decorate --all $*
sleep 1
done
@statico
statico / gist:3172711
Created July 24, 2012 21:15
How to use a PS3 controller on Mac OS X 10.7 (Lion)

How to use a PS3 controller on Mac OS X 10.7 (Lion)

  1. Open Apple menu -> System Preferences -> Bluetooth and disable Bluetooth on Mac as well as any other nearby Macs or devices which will try to pair with and confuse the controller.

  2. Reset PS3 controller by inserting paperclip into pinhole near L2 button.

  3. Connect PS3 controller to Mac with USB cable.

  4. Enable Bluetooth.

@averyvery
averyvery / Guardfile
Created July 3, 2012 21:06
Retina images with Guard
guard 'process', :name => 'shrink-images', :command => 'ruby resize-mobile-images.rb mobileretina' do
watch /^images\/mobileretina\/.+/
end
@ksafranski
ksafranski / Common-Currency.json
Last active December 3, 2025 20:44
Common Currency Codes in JSON
{
"USD": {
"symbol": "$",
"name": "US Dollar",
"symbol_native": "$",
"decimal_digits": 2,
"rounding": 0,
"code": "USD",
"name_plural": "US dollars"
},
@averyvery
averyvery / Guardfile
Created June 14, 2012 21:15
Minifying JS, shrinking retina images down
guard 'compass' do
watch /^.+(\.s[ac]ss)/
end
guard 'process', :name => 'minify-screen-js', :command => 'juicer merge js/all.js -o js/all.min.js --force -s' do
watch /^js\/brianregan\/screen.js/
end
guard 'process', :name => 'minify-mobile-js', :command => 'juicer merge js/mobile.js -o js/mobile.min.js --force -s' do
watch /^js\/brianregan\/mobile.js/
@trey
trey / iphone_website.md
Last active February 20, 2022 21:50
Optimizing a Website for iPhone

This is primarily for making iPhone-only versions of an existing site/application.

Set your Viewport

<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1, minimum-scale=1, maximum-scale=1">

Use Media Queries for linking CSS files

<!-- For iPhone: -->
@jlong
jlong / uri.js
Created April 20, 2012 13:29
URI Parsing with Javascript
var parser = document.createElement('a');
parser.href = "http://example.com:3000/pathname/?search=test#hash";
parser.protocol; // => "http:"
parser.hostname; // => "example.com"
parser.port; // => "3000"
parser.pathname; // => "/pathname/"
parser.search; // => "?search=test"
parser.hash; // => "#hash"
parser.host; // => "example.com:3000"