Why rewrite URLs? Check Wikipedia
Make sure AllowOverride is on for your directory, or put in httpd.conf
# Apache (.htaccess or httpd.conf)
RewriteEngine On
| // 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; | |
| })(); |
| #!/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 |
| 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; |
Why rewrite URLs? Check Wikipedia
Make sure AllowOverride is on for your directory, or put in httpd.conf
# Apache (.htaccess or httpd.conf)
RewriteEngine On
| ## 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 |
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.
cp ~/.gnupg/pubring.gpg /path/to/backups/
cp ~/.gnupg/secring.gpg /path/to/backups/
cp ~/.gnupg/trustdb.gpg /path/to/backups/
| <?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) { |
| // 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`. |
| 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() |
| #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/ |