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
regex=/^([1-9][0-9] +|\([1-9][0-9]\) *)[1-9]\d{2,4}[ .-]?\d{4}$/; | |
strings=[ | |
/* Só numéricos com espaços que casam */ | |
'11 9990000', | |
'11 99990000', | |
'11 999990000', | |
'11 999 0000', | |
'11 9999 0000', | |
'11 99999 0000', |
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
<?php | |
abstract class User | |
{ | |
protected $_name = 'Henrique Moody'; | |
protected $_email = 'henriquemoody@gmail.com'; | |
public function toArray() | |
{ |
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
#!/bin/bash | |
# Uses script and scriptreplay to record and playback virtual terminal. | |
# Copyright (C) 2007 Hean Kuan Ong <mysurface@gmail.com> | |
# | |
# This program is free software; you can redistribute it and/or | |
# modify it under the terms of the GNU General Public License | |
# as published by the Free Software Foundation; either version 2 | |
# of the License, or (at your option) any later version. | |
# | |
# This program is distributed in the hope that it will be useful, |
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
#!/usr/bin/env bash | |
echo "I'll do something" |
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
#!/usr/bin/env bash | |
SOLR_RUNNING=0 | |
SOLR_DIRECTORY="/usr/local/solr" | |
SOLR_LOG="${SOLR_DIRECTORY}/logs/solrd.log" | |
SOLR_LOCK="${SOLR_DIRECTORY}/solrd.pid" | |
touch "${SOLR_LOCK}" | |
SOLR_PID=$(cat ${SOLR_LOCK}) | |
let SOLR_PID=SOLR_PID+0 | |
touch "${SOLR_LOG}" |
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
<?php | |
function writeln($message = '', $stream = STDOUT) | |
{ | |
fwrite($stream, $message . PHP_EOL); | |
} | |
$arg_options = array( | |
'help' => array( | |
'required' => false, |
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
#!/bin/sh | |
command="/usr/local/sublimetext-2/sublime_text" | |
if [ -d "${1}" ] || [ -f "${1}" ] | |
then | |
${command} -a "${1}" 2>/dev/null 1>&2 & | |
else | |
${command} $@ | |
fi |
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
#!/usr/bin/env bash | |
# Usage: {script} OPTIONS | |
# Find content into files. | |
# | |
# -h, --help Displays this help | |
# -a, --action Action to perform: "search", "files" or a sed pattern to | |
# apply to files (default "search") | |
# -d, --directory Directory to search (default ".") | |
# -e, --extension Extensions to search on (default "*") | |
# -x, --exclude Pattern to exclude |
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
<?php | |
// https://wiki.archlinux.org/index.php/Color_Bash_Prompt | |
$colors = array( | |
// regular colors | |
'black' => '0;30', // black | |
'red' => '0;31', // red | |
'green' => '0;32', // green | |
'yellow' => '0;33', // yellow |
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 formatSql($sql) { | |
return preg_replace( | |
'/(select|from|(left |right |natural |inner |outer |cross |straight_)*join|where|limit|update |set|insert |values)/i', | |
"\n$1\n ", str_replace("\n", '', $sql) | |
); | |
} |