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
import CryptoJS from "crypto-js"; | |
const LaravelEncrypt = function (key) { | |
this.key = key; | |
} | |
LaravelEncrypt.prototype.decrypt = function (encryptStr) { | |
encryptStr = CryptoJS.enc.Base64.parse(encryptStr); | |
let encryptData = encryptStr.toString(CryptoJS.enc.Utf8); | |
encryptData = JSON.parse(encryptData); |
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 | |
/** | |
* Array map, but maps values to new keys instead of new values | |
* @return array same arrays with keys mapped | |
*/ | |
function array_map_key($callback,$array) | |
{ | |
$out=array_reduce($array, function ($carry,$val) use ($array,$callback){ | |
$key=call_user_func($callback,$val); | |
$carry[$key]=$val; |
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
using System; | |
using System.Globalization; | |
namespace JefersonBueno | |
{ | |
public class Program | |
{ | |
public static string ChangeDate(string date, char op, long value) | |
{ | |
var toAdd = Math.Abs(value); |
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
var url = 'http://www.pdf995.com/samples/pdf.pdf'; | |
var fileName = 'pdf.pdf'; | |
var xhr = new XMLHttpRequest(); | |
xhr.open('GET', url, true); | |
xhr.responseType = 'blob'; | |
xhr.onprogress = function(pe) { | |
console.log('progress'); | |
if (pe.lengthComputable) { | |
console.log((pe.loaded / pe.total) * 100); |
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
# -*- coding: utf-8 -*- | |
from __future__ import unicode_literals | |
import re | |
class NotMatchingException(Exception): | |
pass | |
""" | |
This class represente a route | |
""" |
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
--- | |
METHOD 1 | |
This should roughly sort the items on distance in MySQL, and should work in SQLite. | |
If you need to sort them preciser, you could try using the Pythagorean theorem (a^2 + b^2 = c^2) to get the exact distance. | |
--- | |
SELECT * | |
FROM table | |
ORDER BY ((lat-$user_lat)*(lat-$user_lat)) + ((lng - $user_lng)*(lng - $user_lng)) ASC |
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 async_request($method, $url, $params, array $headers = []) | |
{ | |
$method = strtoupper($method); | |
$data = http_build_query($params); | |
$parts = parse_url($url) + [ |
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
var elixir = require('laravel-elixir'); | |
/* | |
|-------------------------------------------------------------------------- | |
| Elixir Asset Management | |
|-------------------------------------------------------------------------- | |
| | |
| Elixir provides a clean, fluent API for defining some basic Gulp tasks | |
| for your Laravel application. By default, we are compiling the Sass | |
| file for our application, as well as publishing vendor resources. |
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 ($) { | |
var defaults = { | |
cache: false, | |
contentType: false, | |
processData: false, | |
type: 'POST', | |
onProgress: new Function, | |
xhr: function (xhr) { |
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
svg { | |
width: 100px; | |
border-radius: 50%; | |
background:yellowgreen; | |
transform: rotate(-90deg); | |
} | |
circle { | |
fill: none; | |
stroke-width: 32; |
NewerOlder