Skip to content

Instantly share code, notes, and snippets.

View mAu888's full-sized avatar

Maurício Hanika mAu888

View GitHub Profile

Keybase proof

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:

@mAu888
mAu888 / git-sclean
Created November 1, 2012 12:50
git safe clean
#!/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/')
@mAu888
mAu888 / HTTPRouter.h
Created July 13, 2012 12:45 — forked from Nub/HTTPRouter.h
HTTPRouter for CocoaHTTPServer
//
// 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"
@mAu888
mAu888 / .gitignore
Created April 6, 2012 15:48 — forked from atty303/.gitignore
Initial gitignore for iOS project.
# xcode noise
build/*
*.perspective
*.perspectivev3
*.pbxuser
*.xcworkspace
*.mode1
*.mode2v3
*.mode1v3
xcuserdata
@mAu888
mAu888 / AutocompileLessCoffe.py
Created March 11, 2012 15:30
Autocompile plugin for Sublime Text 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]
@mAu888
mAu888 / gist:1778670
Created February 9, 2012 09:16
Swap two sort fields in one update clause
UPDATE
`table` a, `table` b
SET
a.`sort` = b.`sort`,
b.`sort` = a.`sort`
WHERE
a.`id` = 1 AND b.`id` = 2
@mAu888
mAu888 / gist:1759426
Created February 7, 2012 12:18
Rearrange an order column
-- 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;
@mAu888
mAu888 / gist:1320584
Created October 27, 2011 19:27
.htaccess - mod_rewrite to index.php/your/path
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $1 !^(index\.php)
RewriteRule ^(.*)$ index.php/$1 [L]
@mAu888
mAu888 / gist:1066854
Created July 6, 2011 08:44
Check for parent node jQuery
(function($) {
$.fn.isParentNode = function(expr) {
return $(this).parents().filter(expr).length > 0;
}
})(jQuery);