I hereby claim:
- I am mau888 on github.
- I am mau (https://keybase.io/mau) on keybase.
- I have a public key whose fingerprint is 5D02 CA6C 1659 38ED BDF9 B7B0 0619 60CE 175C 0D35
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
# Put this into your `~/.bashrc` and `source ~/.bashrc` | |
function expandurl { | |
# -s Only output | |
# -I HEAD request | |
# -L Follow redirects. Combined with -I will print headers from all intermediate redirects | |
REDIRECTS=$(curl -sIL $1 | grep ^Location); | |
if [[ -z $REDIRECTS ]]; then | |
echo "Location: ${1}"; | |
else |
(function($) { | |
$.fn.isParentNode = function(expr) { | |
return $(this).parents().filter(expr).length > 0; | |
} | |
})(jQuery); |
RewriteEngine on | |
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteCond %{REQUEST_FILENAME} !-d | |
RewriteCond $1 !^(index\.php) | |
RewriteRule ^(.*)$ index.php/$1 [L] |
-- Rearrange a sort column on a table with one UPDATE clause, e.g. after multiple items have been deleted | |
SET @sort_counter = 0; | |
UPDATE table SET sort_column = (@sort_counter := @sort_counter + 1) ORDER BY sort_column ASC; |
UPDATE | |
`table` a, `table` b | |
SET | |
a.`sort` = b.`sort`, | |
b.`sort` = a.`sort` | |
WHERE | |
a.`id` = 1 AND b.`id` = 2 |
import sublime, sublime_plugin, commands, os | |
class LESSCompileOnSave(sublime_plugin.EventListener): | |
def on_post_save(self, view): | |
path = os.environ["PATH"] | |
if(path.find('/usr/local/bin') == -1): | |
os.environ["PATH"] = path + ':/usr/local/bin' | |
file_name = os.path.basename(view.file_name()) | |
base_name = os.path.splitext(file_name)[0] |
# xcode noise | |
build/* | |
*.perspective | |
*.perspectivev3 | |
*.pbxuser | |
*.xcworkspace | |
*.mode1 | |
*.mode2v3 | |
*.mode1v3 | |
xcuserdata |
// | |
// HTTPRouter.h | |
// DynamicServer | |
// | |
// Created by Zachry Thayer on 5/9/12. | |
// Copyright (c) 2012 Zachry Thayer. All rights reserved. | |
// | |
#import "HTTPConnection.h" | |
#import "HTTPMessage.h" |
#!/bin/bash | |
# Place this script under /usr/bin or /usr/local/bin | |
# and make it executable with sudo chmod +x /path/to/the/script/git-sclean | |
# | |
# Run git sclean from terminal and be happy! | |
# Dry-run git clean | |
git clean -n | |
CLEARFILES=$(git clean -n | wc -l | sed 's/[^0-9]*\([0-9]*\)[^0-9]*/\1/') |