Skip to content

Instantly share code, notes, and snippets.

View falexandre's full-sized avatar
😎

Fábio Luis Alexandre falexandre

😎
View GitHub Profile
<?php
/**
* Bcrypt hashing class
*
* @author Thiago Belem <contato@thiagobelem.net>
* @link https://gist.github.com/3438461
*/
class Bcrypt {
@falexandre
falexandre / gist:bccba45927d4aaa5d02a
Created June 2, 2014 10:28
Key e settings sublime
[
{ "keys": ["ctrl+shift+d"], "command": "find_under_expand" },
{ "keys": ["ctrl+d"], "command": "duplicate_line" },
{ "keys": ["ctrl+alt+c"], "command": "toggle_comment", "args": { "block": false } },
{ "keys": ["ctrl+shift+c"], "command": "color_pick" },
{ "keys": ["ctrl+up", "ctrl+up"], "command": "ftp_sync_current" },
{ "keys": ["ctrl+down", "ctrl+down"], "command": "ftp_sync_down_current" },
{
"keys": ["ctrl+alt+j"], "command": "js_format",
"context": [{"key": "selector", "operator": "equal", "operand": "source.js,source.json"}]
#!/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
// Declares an object
var layout = {};
// Mount function
layout.mount = function (origin, data)
{
// Receives HTML content
<?php
function indent_json ($json)
{
$result = '';
$pos = 0;
$strLen = strlen($json);
$indentStr = "\t";
$newLine = "\n";
$prevChar = '';
// add the filter to your application module
angular.module('yourAppName', ['filters']);
/**
* Truncate Filter
* @Param string
* @Param int, default = 10
* @Param string, default = "..."
* @return string
*/
function CalcRadiusDistance(lat1, lon1, lat2, lon2) {
var RADIUSMILES = 3961,
RADIUSKILOMETERS = 6373,
latR1 = this.deg2rad(lat1),
lonR1 = this.deg2rad(lon1),
latR2 = this.deg2rad(lat2),
lonR2 = this.deg2rad(lon2),
latDifference = latR2 - latR1,
lonDifference = lonR2 - lonR1,
a = Math.pow(Math.sin(latDifference / 2), 2) + Math.cos(latR1) * Math.cos(latR2) * Math.pow(Math.sin(lonDifference / 2), 2),
daAyx
-----
A [Pen](http://codepen.io/anon/pen/daAyx) by [Captain Anonymous](http://codepen.io/anon) on [CodePen](http://codepen.io/).
[License](http://codepen.io/anon/pen/daAyx/license).
@falexandre
falexandre / cep.php
Last active August 29, 2015 14:21 — forked from guisehn/cep.php
<?php
function cep_dados($cep)
{
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://www.buscacep.correios.com.br/servicos/dnec/consultaLogradouroAction.do');
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
@falexandre
falexandre / snippet.js
Last active August 29, 2015 14:23 — forked from necolas/snippet.js
/*
* Updated to use the function-based method described in http://www.phpied.com/social-button-bffs/
* Better handling of scripts without supplied ids.
*
* N.B. Be sure to include Google Analytics's _gaq and Facebook's fbAsyncInit prior to this function.
*/
(function(doc, script) {
var js,
fjs = doc.getElementsByTagName(script)[0],