Skip to content

Instantly share code, notes, and snippets.

View mapkyca's full-sized avatar
💭
Always out numbered, Never out gunned

Marcus Povey mapkyca

💭
Always out numbered, Never out gunned
View GitHub Profile
@mapkyca
mapkyca / .htaccess
Created January 26, 2012 10:49
Apache mod_rewrite rule to pass requests to a PHP page handler, but only if the file or folder doesn't physically exist.
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ path/to/pagehandler.php?page=$1 [QSA]
</IfModule>
@mapkyca
mapkyca / gist:1919586
Created February 26, 2012 23:14
Etch -> Lenny
Notes from upgrade:
Prep:
1) Make sure up to date, aptitude update && aptitude upgrade
2) Reboot
Upgrade:
1) Change sources (etch->lenny)
2) aptitude safe-upgrade & resolve issues
@mapkyca
mapkyca / gist:1922850
Created February 27, 2012 09:50
Lenny -> Squeeze
Prep:
- apt-get update && apt-get upgrade && apt-get dist-upgrade
- Check for holds
dpkg --audit
dpkg --get-selections | grep hold
aptitude & press "g"
- Edit sources.list s/lenny/squeeze
- apt-get update NOTE: Debian docs say don't use aptitude to upgrade.
- apt-get upgrade to to a safe-upgrade
@mapkyca
mapkyca / gist:2008119
Created March 9, 2012 19:04
Excel / Open Office timestamp conversions.
DATE -> SECONDS
---------------
(CELL - DATE (1970,1,1))*86400
TIME -> SECONDS
---------------
@mapkyca
mapkyca / gist:2299663
Created April 4, 2012 08:16
Note To Self: Change the OSX dock title within Java
/*
* To correctly set the doc name of a java App in OSX, use....
*/
System.setProperty("com.apple.mrj.application.apple.menu.about.name", "Foo");
@mapkyca
mapkyca / gist:2420795
Created April 19, 2012 12:52
Quickly remove non-alpha chars from a string
// Quick regexp to remove non-alpha chars from a string. Very handy
$string = preg_replace("/[^a-zA-Z0-9\s]/", "", $string);
@mapkyca
mapkyca / gist:2420796
Created April 19, 2012 12:52
Quickly remove non-alpha chars from a string
// Quick regexp to remove non-alpha chars from a string. Very handy
$string = preg_replace("/[^a-zA-Z0-9\s]/", "", $string);
@mapkyca
mapkyca / gist:2909223
Created June 11, 2012 09:15
Strip ANSI escape codes from text strings
sed -r "s/\x1B\[([0-9]{1,3}((;[0-9]{1,3})*)?)?[m|K]//g"
@mapkyca
mapkyca / gist:3142991
Created July 19, 2012 10:50
Paypal IPN Example Response
Some example paypal response for reference:
array (
'test_ipn' => '1',
'payment_type' => 'instant',
'payment_date' => '03:46:59 Jul 19, 2012 PDT',
'payment_status' => 'Completed',
'address_status' => 'confirmed',
'payer_status' => 'unverified',
'first_name' => 'John',
@mapkyca
mapkyca / jquery_gotchas.md
Created November 8, 2012 14:18
Some JQuery gotchas

JQuery Gotchas

Here are some notes when hacking on jquery, compiled over time.

JQuery Dialogs

  • If your browser scrolls to the top of the screen when the dialog opens and you're opening it from an onclick event on an Anchor tag, make sure you return false in the click event.