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
FROM php:7.3-fpm-alpine | |
# Install dev dependencies | |
RUN apk add --no-cache --virtual .build-deps \ | |
$PHPIZE_DEPS \ | |
curl-dev \ | |
imagemagick-dev \ | |
libjpeg-turbo \ | |
libjpeg-turbo-dev \ | |
libjpeg \ |
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 | |
/* These are two points in New York City */ | |
$point1 = array('lat' => 40.770623, 'long' => -73.964367); | |
$point2 = array('lat' => 40.758224, 'long' => -73.917404); | |
$distance = getDistanceBetweenPoints($point1['lat'], $point1['long'], $point2['lat'], $point2['long']); | |
foreach ($distance as $unit => $value) { | |
echo $unit.': '.number_format($value,4).'<br />'; | |
} |
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
{ | |
"rules": { | |
".read": "auth != null", | |
".write": "auth != null", | |
"MobileAppVersion": { | |
".read": "true" | |
}, | |
"queue": { | |
".read": "true", | |
"tasks": { |
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
{ | |
"editor.multiCursorModifier": "ctrlCmd", | |
"editor.snippetSuggestions": "top", | |
"editor.formatOnPaste": true, | |
"editor.fontFamily": "Fira Code", | |
"editor.fontLigatures": true, | |
"emmet.triggerExpansionOnTab": true, | |
"php.suggest.basic": false, | |
"editor.autoIndent": true, | |
"emmet.includeLanguages": { |
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
private function csvToArray($filename='', $delimiter=',') | |
{ | |
$rows = array_map('str_getcsv', file($filename)); | |
$header = array_shift($rows); | |
$csv = array(); | |
foreach ($rows as $row) { | |
if(count($row) != count($header)) { | |
dd($row); | |
} |
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
private function csvToArray($filename='', $delimiter=',') | |
{ | |
$rows = array_map('str_getcsv', file($filename)); | |
$header = array_shift($rows); | |
$csv = array(); | |
foreach ($rows as $row) { | |
if(count($row) != count($header)) { | |
dd($row); | |
} |
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
_processInstructionItems(employerId, programs) | |
{ | |
return new Promise((resolve, reject) => { | |
let self = this; | |
let listOfPrograms = []; | |
_.forEach(programs, item => { | |
Program.find(item.id).then(programData => { | |
this._processProgramItemCode(employerId, item, programData).then(programItem => { | |
listOfPrograms.push(programItem) | |
}) |
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 crypto = require('crypto'); | |
var key = 'MySecretKey12345'; | |
var iv = '1234567890123456'; | |
var cipher = crypto.createCipheriv('aes-128-cbc', key, iv); | |
var decipher = crypto.createDecipheriv('aes-128-cbc', key, iv); | |
var text = 'plain text'; | |
var encrypted = cipher.update(text, 'utf8', 'binary'); | |
encrypted += cipher.final('binary'); | |
hexVal = new Buffer(encrypted, 'binary'); |
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
#!/usr/bin/env bash | |
if [ -z $1 ] | |
then | |
echo "serve www.domain.com /path" | |
exit 1 | |
fi | |
if [ -z $2 ] | |
then |
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 codeGenerator($length) | |
{ | |
$az = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZMULTIPAY'; | |
$azr = rand(0, 51); | |
$azs = substr($az, $azr, 10); | |
$stamp = hash('sha256', time()); | |
$mt = hash('sha256', mt_rand(5, 20)); | |
$alpha = hash('sha256', $azs); |
NewerOlder