Skip to content

Instantly share code, notes, and snippets.

View nicopenaredondo's full-sized avatar

Nico R. Penaredondo nicopenaredondo

View GitHub Profile
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 \
@nicopenaredondo
nicopenaredondo / distance-sample.php
Created April 13, 2020 09:31 — forked from LucaRosaldi/distance-sample.php
PHP: Get Distance Between two Geolocated Points (lat/lon)
<?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 />';
}
@nicopenaredondo
nicopenaredondo / node_crypto.js
Created July 16, 2016 14:01 — forked from rojan/node_crypto.js
Encrypt in nodejs and decrypt in php or vice versa
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');
<?php
class BlogController extends Controller
{
/**
* Posts
*
* @return void
*/
public function showPosts()