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
/** | |
* Encodes multi-byte Unicode string into utf-8 multiple single-byte characters | |
* (BMP / basic multilingual plane only). | |
* | |
* Chars in range U+0080 - U+07FF are encoded in 2 chars, U+0800 - U+FFFF in 3 chars. | |
* | |
* Can be achieved in JavaScript by unescape(encodeURIComponent(str)), | |
* but this approach may be useful in other languages. | |
* | |
* @param {string} unicodeString - Unicode string to be encoded as 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
$login = 'hjk3kj3h534h53kj4j345'; | |
$password = '3k45jh3k4j5h3k4j5h34kh5k34'; | |
$url = 'https://apic1.hml.stelo.com.br/'; | |
$encode = base64_encode("$login:$password"); | |
$ch = curl_init(); | |
curl_setopt($ch, CURLOPT_URL,$url); | |
curl_setopt($ch, CURLOPT_TIMEOUT, 30); //timeout after 30 seconds | |
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); |
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 | |
echo "Installing meld..." | |
apt-get install meld -y -qq | |
echo "Meld [OK]" | |
echo "Creating meld custom script..." | |
rm ~/.config/git_meld_diff.sh | |
touch ~/.config/git_meld_diff.sh | |
echo "#!/bin/bash" >> ~/.config/git_meld_diff.sh |
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
<IfModule mod_rewrite.c> | |
RewriteEngine on | |
RewriteCond %{REQUEST_URI} !^/blog.* | |
RewriteCond %{REQUEST_URI} !-f | |
RewriteRule ^$ app/webroot/ [L] | |
RewriteCond %{REQUEST_URI} !^/blog.* | |
RewriteCond %{REQUEST_URI} !-d | |
RewriteRule (.*) app/webroot/$1 [L] |
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 | |
# Just copy and paste the lines below (all at once, it won't work line by line!) | |
# MAKE SURE YOU ARE HAPPY WITH WHAT IT DOES FIRST! THERE IS NO WARRANTY! | |
function abort { | |
echo "$1" | |
exit 1 | |
} | |
set -e |
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 | |
/** | |
* @todo CakePHP Permissions Array by Kevin Wentworth (Saco Design, Inc.) | |
* @todo Handles retrieving all ACL Permissions and storing them in an array. | |
* @todo Comments and bug reports welcome at kevin at sacode sign dot com | |
* | |
* @licensed Licensed under UYOR (Use at Your Own Risk) | |
* @link http://www.mainelydesign.com/blog/view/getting-all-acl-permissions-in-one-lookup-cakephp-1-3#null | |
*/ |
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 | |
class Minhamodel extends AppModel{ | |
//Primeira opção, caso nunca mude o "alias" da model | |
public $virtualFields = array( | |
'data_formatada'=>"DATE_FORMAT(Minhamodel.data,'%d/%m/%Y')", | |
); | |
//Alternativa caso mude o "alias" da model, melhor opção | |
public function __construct($id=false,$table=null,$ds=null){ |
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
# when I tried to start postgres, I had an error telling me there were no postgres clusters created | |
# so I had to create one using the `pg_createcluster` command, like the following | |
pg_createcluster 9.1 main --start | |
#after creating the cluster, it will start the server because of `--start` | |
#so I had to change to postgresql user | |
sudo su - postgres | |
#to change it's pasword, doing `psql -d <database_name> -U <username> | |
psql -d postgres -U postgres |
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 | |
//Primeiramente o controller usuarios, que é onde vou utilizar os selects de cidades e estados | |
class UsuariosController extends AppController { | |
public function cadastro() { | |
$this->set('estados', $this->Estado->find('list')); | |
} | |
} | |
//No controller CidadesController: |
NewerOlder