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
/** | |
* Get instance names of an object | |
* | |
* Returns instances | |
*/ | |
function getInstancesOf() | |
{ | |
var instances = []; | |
for(var v in window) { |
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 swipeFunc = function() { | |
this._swipe_direction = ['left','right']; | |
this._y_diff = -1; | |
this._x_diff = -1; | |
this._x_min_length = 30; | |
this.touches = { | |
'touchstart': {'entered':false,'x':-1, 'y':-1}, | |
'touchmove' : {'entered':false,'x':-1, 'y':-1}, | |
'touchend' : false, | |
'direction' : 'undetermined' |
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 unicode2utf8($c) | |
{ | |
$output=""; | |
if($c < 0x80) | |
{ | |
return chr($c); | |
} | |
else if($c < 0x800) | |
{ |
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
/** | |
* Class Colors. | |
* Pallete Generator Helper. | |
*/ | |
class Colors implements \Iterator, \ArrayAccess | |
{ | |
const COL_MIN_AVG = 64; | |
const COL_MAX_AVG = 192; |
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
-- Direct SELECT version | |
SELECT | |
FROM_BASE64(JSON_UNQUOTE(JSON_EXTRACT(CONVERT(FROM_BASE64(email) USING utf8), '$.iv'))) AS iv, | |
JSON_UNQUOTE(JSON_EXTRACT(CONVERT(FROM_BASE64(email) USING utf8), '$.value')) AS value, | |
FROM_BASE64('mysecretkey') AS pkey, | |
AES_DECRYPT(FROM_BASE64(JSON_UNQUOTE(JSON_EXTRACT(CONVERT(FROM_BASE64(email) USING utf8), '$.value'))), FROM_BASE64('mysecretkey'), FROM_BASE64(JSON_UNQUOTE(JSON_EXTRACT(CONVERT(FROM_BASE64(email) USING utf8), '$.iv')))) AS decrypted | |
-- Function version | |
CREATE FUNCTION `LARAVEL_DECRYPT`( |
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
CREATE DEFINER=`%`@`%` FUNCTION `LARAVEL_DECRYPT`( | |
`encstr` TEXT, | |
`raw_key` VARCHAR(255) | |
) | |
RETURNS varchar(255) CHARSET utf8 COLLATE utf8_unicode_ci | |
LANGUAGE SQL | |
DETERMINISTIC | |
READS SQL DATA | |
SQL SECURITY DEFINER |
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
// Simple upload from http://laravel-tricks.com/tricks/vuejs-simple-upload | |
<template> | |
<div> | |
<small>Change/Upload</small> | |
<input type="file" @change="onFileChange"> | |
<button class="btn btn-success btn-xs" @click="upload">Upload</button> | |
</div> | |
</template> |
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 convertMemorySize($strval, string $to_unit = 'b') | |
{ | |
$strval = strtolower(str_replace(' ', '', $strval)); | |
$val = floatval($strval); | |
$to_unit = strtolower(trim($to_unit))[0]; | |
$from_unit = str_replace($val, '', $strval); | |
$from_unit = empty($from_unit) ? 'b' : trim($from_unit)[0]; | |
$units = 'kmgtph'; // (k)ilobyte, (m)egabyte, (g)igabyte and so on... |
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 Model_CSVReader | |
* | |
* Parse and read CSV files as a stream keeping a low memory footprint | |
*/ | |
class Model_CSVReader | |
{ |
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
location /foo/ { | |
proxy_pass https://site.com/; | |
proxy_redirect off; | |
proxy_set_header Host site.com; | |
proxy_ssl_session_reuse off; | |
proxy_ssl_server_name on; | |
proxy_set_header X-Real-IP $remote_addr; | |
proxy_set_header X-Forwarded-For $remote_addr; | |
proxy_set_header Accept-Encoding ""; | |
sub_filter "https://site.com" "https://reflected.to/foo"; |
OlderNewer