Skip to content

Instantly share code, notes, and snippets.

@aaoliveira
aaoliveira / git_meld_install.sh
Created April 27, 2016 16:49 — forked from MarcosX/git_meld_install.sh
Install Meld as the default git diff tool. Must be executed as sudo
#!/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
@aaoliveira
aaoliveira / auth.php
Created September 13, 2016 23:40 — forked from anonymous/auth.php
Exemplo autenticação http basic
$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);
@aaoliveira
aaoliveira / utf8-regex.js
Created September 30, 2016 00:39 — forked from chrisveness/utf8-regex.js
Utf8 string encode/decode using regular expressions
/**
* 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.