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 | |
/** | |
* <p>Searches all the columns names in the given query, backticks are ignored</p> | |
* <p>Works on wide range of fields:</p> | |
* - column | |
* - column alias | |
* - column AS alias | |
* - table.column | |
* - table.column alias |
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
/** | |
* A improved type verification function that avoid problems with instanceof and typeof, works with literals and across frames | |
* for JavaScript natives objects only | |
* | |
* @author Pedro Sanção <dev at sancao dot co> | |
* @license GNU GPL v2 | |
* | |
* @see http://stackoverflow.com/questions/203739/why-does-instanceof-return-false-for-some-literals?rq=1 | |
* @see http://stackoverflow.com/questions/14391506/instanceof-operator-fails-when-passing-an-object-through-windows | |
*/ |
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
/** | |
* Convert pixels to other units of measurement, according to device DPI | |
* | |
* @author Pedro Sanção <dev at sancao dot co> | |
* @license MIT | |
*/ | |
var unitConvert = (function(){ | |
var precision = 0 | |
, _setPrecision = function(p) { | |
precision = p; |
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 | |
/** | |
* Parses the PHP's $_FILES array when multiple file input is used, it will | |
* return an array as each file was from a different input. It also works | |
* when multiple and single inputs are mixed | |
* | |
* @author Pedro Sanção <pedro at sancao do co> | |
* @license MIT Licence | |
*/ |
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 | |
if [ $1 == "-d" ]; then | |
if [ ! -r $2 ]; then | |
echo 'supply a valid input file to decrypt' | |
exit 1 | |
fi | |
openssl rsautl -decrypt -inkey $HOME/.ssh/id_rsa -in $2 2> /dev/null | |
exit 0 | |
fi |
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
# generate CSR for multiple domains: | |
# https://www.endpoint.com/blog/2014/10/30/openssl-csr-with-alternative-names-one | |
# configuration for /etc/apache2/conf-available/ssl-params.conf | |
# full totorial available on | |
# https://www.digitalocean.com/community/tutorials/how-to-create-a-self-signed-ssl-certificate-for-apache-in-ubuntu-16-04 | |
# from https://cipherli.st/ | |
# and https://raymii.org/s/tutorials/Strong_SSL_Security_On_Apache2.html |
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 | |
protected $routeMiddleware = [ | |
//... | |
'locale' => \APP\Http\Middleware\LocaleRedirect::class, | |
//... | |
]; |
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
for (var i = 0, months = {}, d = new Date((new Date()).getFullYear(), 0, 1); i < 12; d.setMonth(++i)) { | |
months[d.toLocaleDateString('default', {month: 'long'}).replace(/^\w/, c => c.toUpperCase())] = ('0' + (i + 1)).substr(-2); | |
} | |
// inspecionar requisição anterior | |
var suffix = '______________/__'; | |
var token = '____________'; | |
var pages = 50; | |
var page = 1; | |
var data = []; |
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
const https = require('https') | |
const querystring = require('querystring') | |
exports.showdata = (req, res) => { | |
const data = '___________________' | |
const captchaSecret = '________________________________' | |
const allowedOrigins = ['______________________________'] | |
const verifyData = querystring.stringify({ | |
secret : captchaSecret, |
OlderNewer