This file contains hidden or 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 | |
class Validate { | |
public $message = array(); | |
public $validate; | |
public function rules($data) { | |
foreach($data as $key => $value) { |
This file contains hidden or 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
sudo npm cache clean -f | |
sudo npm install -g n | |
sudo n stable |
This file contains hidden or 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
// Exemplo de requisição GET | |
var ajax = new XMLHttpRequest(); | |
// Seta tipo de requisição e URL com os parâmetros | |
ajax.open("GET", "minha-url-api.com/?name=Henry&lastname=Ford", true); | |
// Envia a requisição | |
ajax.send(); | |
// Cria um evento para receber o retorno. |
This file contains hidden or 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
grep -H -i conteudoProcurado * |
This file contains hidden or 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
//helper cep | |
if ( ! function_exists('buscar_endereco')) | |
{ | |
function buscar_endereco($cep) | |
{ | |
$cep = str_replace('.', '', $cep); | |
$cep = str_replace('-', '', $cep); | |
$url = 'http://republicavirtual.com.br/web_cep.php?cep='.urlencode($cep).'&formato=query_string'; |
This file contains hidden or 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 valida($cep) { | |
$cep = trim($cep); | |
$avaliaCep = ereg("^[0-9]{5}-[0-9]{3}$", $cep); | |
if(!$avaliaCep) { | |
echo "CEP inválido"; | |
} | |
else | |
{ | |
echo "CEP Válido"; |
This file contains hidden or 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 | |
// address to map | |
$map_address = ""; | |
$url = "http://maps.googleapis.com/maps/api/geocode/json?sensor=false&address=".urlencode($map_address); | |
$lat_long = get_object_vars(json_decode(file_get_contents($url))); | |
// pick out what we need (lat,lng) | |
$lat_long = $lat_long['results'][0]->geometry->location->lat . "," . $lat_long['results'][0]->geometry->location->lng; |
This file contains hidden or 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
# install necesary i386 libraries | |
$ sudo apt-get install libgtk2.0-0:i386 libstdc++6:i386 libxml2:i386 libxslt1.1:i386 libcanberra-gtk-module:i386 gtk2-engines-murrine:i386 libqt4-qt3support:i386 libgnome-keyring0:i386 libnss-mdns:i386 libnss3:i386 | |
# make keyring visible for Adobe Air | |
$ sudo ln -s /usr/lib/i386-linux-gnu/libgnome-keyring.so.0 /usr/lib/libgnome-keyring.so.0 | |
$ sudo ln -s /usr/lib/i386-linux-gnu/libgnome-keyring.so.0.2.0 /usr/lib/libgnome-keyring.so.0.2.0 | |
# Download Adobe Air | |
cd ~/Downloads | |
wget http://airdownload.adobe.com/air/lin/download/2.6/AdobeAIRSDK.tbz2 |