This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
UPDATE table SET field = REPLACE(field, "before", "after") WHERE field REGEXP "([pattern])"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!--#if expr="$REMOTE_ADDR = /^200\.182\.35\./" --> | |
<!--#else --> | |
<!--#endif --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# I made this gist to build my shell prompt based in various references on the web | |
# I will try to list the most of references, but sorry if I not put your here - | |
# http://henrik.nyh.se/2008/12/git-dirty-prompt (GIT) | |
# GIT | |
function parse_git_dirty { | |
[[ $(git status 2> /dev/null | tail -n1) != "nothing to commit (working directory clean)" ]] && echo "*" | |
} | |
function parse_git_branch { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -------------------------------------------------------- | |
export APXS2=`which apxs` | |
export CFLAGS="-arch x86_64 -O2" | |
export ARCHFLAGS="-arch x86_64" | |
export EDITOR='mate -w' | |
export CLICOLOR=1 | |
export TERM=xterm-color | |
export LSCOLORS=DxGxcxdxCxegedabagacad | |
export LC_CTYPE=en_US.UTF-8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Rename files in one line | |
# Util for renaming files with prefix or sufix, removing, modifying, etc | |
# First, list files that will be renamed | |
# In sequence, create the command to rename it (using mv command) | |
# Modify the command swapping the string | |
# Send it to /bin/bash | |
ls *_abc.png | awk '{print("mv "$1" "$1)}' | sed 's/_abc/_def/2' | /bin/bash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Make hidden Dock icons transparent | |
defaults write com.apple.Dock showhidden -bool YES | |
killall Dock | |
# Change the location of snapped screenshots | |
mkdir -p ~/Pictures/Screnshots | |
defaults write com.apple.screencapture location ~/Pictures/Screenshots | |
killall Dock | |
# Change your current screenshot format |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function distance($lat1 = 0, $lng1 = 0, $lat2 = 0, $lng2 = 0, $miles = true) | |
{ | |
$pi80 = M_PI / 180; | |
$lat1 *= $pi80; | |
$lng1 *= $pi80; | |
$lat2 *= $pi80; | |
$lng2 *= $pi80; | |
$r = 6372.797; // mean radius of Earth in km | |
$dlat = $lat2 - $lat1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'formula' | |
def mysql_installed? | |
`which mysql_config`.length > 0 | |
end | |
class Php <Formula | |
url 'http://www.php.net/get/php-5.3.3.tar.gz/from/this/mirror' | |
homepage 'http://php.net/' | |
md5 '5adf1a537895c2ec933fddd48e78d8a2' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
zend_extension="/usr/local/Cellar/xdebug/2.1.0/xdebug.so" | |
[xdebug] | |
;xdebug.max_nesting_level=10 | |
xdebug.collect_params=3 | |
xdebug.show_local_vars=5 | |
xdebug.dump.GET=* | |
xdebug.dump.POST=* | |
xdebug.default_enable = On |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<th><%= link_to "Name</th> | |
<th><%= link_to "First</th> | |
<th><%= link_to "Last and pum</th> | |
Selecionar de Name (sem a aspa inicial) até antes do Last (inclusive a aspa inicial) | |
Digitar Command + Option + a | |
O cursor irá par ao final da primeira linha da seleção, |
OlderNewer