Skip to content

Instantly share code, notes, and snippets.

@jonraasch
jonraasch / jQuery.support-transition.js
Created April 21, 2010 14:32
Extends the jQuery.support object to CSS3 transition
// jQuery.support.transition
// to verify that CSS3 transition is supported (or any of its browser-specific implementations)
$.support.transition = (function(){
var thisBody = document.body || document.documentElement,
thisStyle = thisBody.style,
support = thisStyle.transition !== undefined || thisStyle.WebkitTransition !== undefined || thisStyle.MozTransition !== undefined || thisStyle.MsTransition !== undefined || thisStyle.OTransition !== undefined;
return support;
})();
@mathiasbynens
mathiasbynens / appify
Created November 12, 2010 13:46 — forked from subtleGradient/appify
appify — create the simplest possible Mac app from a shell script
#!/bin/bash
if [ "$1" = "-h" -o "$1" = "--help" -o -z "$1" ]; then cat <<EOF
appify v3.0.1 for Mac OS X - http://mths.be/appify
Creates the simplest possible Mac app from a shell script.
Appify takes a shell script as its first argument:
`basename "$0"` my-script.sh
@penguinboy
penguinboy / Object Flatten
Created January 2, 2011 01:55
Flatten javascript objects into a single-depth object
var flattenObject = function(ob) {
var toReturn = {};
for (var i in ob) {
if (!ob.hasOwnProperty(i)) continue;
if ((typeof ob[i]) == 'object') {
var flatObject = flattenObject(ob[i]);
for (var x in flatObject) {
if (!flatObject.hasOwnProperty(x)) continue;
@jamesvl
jamesvl / gist:910325
Created April 8, 2011 17:32
Web server rewrite rules for using klein PHP router

URL-rewriting for klein PHP router

Why rewrite URLs? Check Wikipedia

Apache

Make sure AllowOverride is on for your directory, or put in httpd.conf

# Apache (.htaccess or httpd.conf)

RewriteEngine On

@reedobrien
reedobrien / reset.sh
Created September 7, 2011 01:09
fix "Waiting for other installations to complete." on OSX 10.6 10.7
## fix "Waiting for other installations to complete." on OSX 10.6 10.7
## sometimes a failed installation leaves us unable to
## perform an installation. The following fixes it for me
sudo rm /private/var/db/mds/system/mds.install.lock
sudo reboot
@chrisroos
chrisroos / gpg-import-and-export-instructions.md
Created September 9, 2011 10:49
Instructions for exporting/importing (backup/restore) GPG keys

Every so often I have to restore my gpg keys and I'm never sure how best to do it. So, I've spent some time playing around with the various ways to export/import (backup/restore) keys.

Method 1

Backup the public and secret keyrings and trust database

cp ~/.gnupg/pubring.gpg /path/to/backups/
cp ~/.gnupg/secring.gpg /path/to/backups/
cp ~/.gnupg/trustdb.gpg /path/to/backups/

or, instead of backing up trustdb...

@gourneau
gourneau / gist:1415698
Created December 1, 2011 10:37
PHP List Directories by Date
<?php
//This little PHP script is the most elegant way
//I could find the list directories and
//files with PHP and sort by date
//thanks to StackOverflow
$files = array();
$dir = new DirectoryIterator('.');
foreach ($dir as $fileinfo) {
@connor
connor / .jshintrc.js
Created January 11, 2012 22:20
jshintrc example
// NOTE: I added the .js extension to this gist so it would have syntax highlighting. This file should have NO file extension
{
// Settings
"passfail" : false, // Stop on first error.
"maxerr" : 100, // Maximum error before stopping.
// Predefined globals whom JSHint will ignore.
"browser" : true, // Standard browser globals e.g. `window`, `document`.
@code-affinity
code-affinity / ofx-to-ledger.py
Created January 24, 2012 16:32
Python script for importing OFX files into a ledger-cli file
from __future__ import print_function
from ofxparse import OfxParser
import os
import re
import sys
if len(sys.argv) != 1:
print ('This utility does not take command-line arguments')
exit()
@ScottPhillips
ScottPhillips / .htaccess
Created February 2, 2012 04:30
Common .htaccess Redirects
#301 Redirects for .htaccess
#Redirect a single page:
Redirect 301 /pagename.php http://www.domain.com/pagename.html
#Redirect an entire site:
Redirect 301 / http://www.domain.com/
#Redirect an entire site to a sub folder
Redirect 301 / http://www.domain.com/subfolder/