Skip to content

Instantly share code, notes, and snippets.

View veloxy's full-sized avatar
🤷‍♂️
What's happening?

Kevin Vandenborne veloxy

🤷‍♂️
What's happening?
View GitHub Profile
'use strict';
let aws = require('aws-sdk');
let s3 = new aws.S3({apiVersion: '2006-03-01'});
module.exports.cacheControl = (event) => {
// Bucket name & File path
const bucket = event.Records[0].s3.bucket.name;
const key = decodeURIComponent(event.Records[0].s3.object.key).replace(/\+/g, ' ');
@veloxy
veloxy / composer.json
Created July 12, 2016 07:18 — forked from jaytaph/composer.json
Using the Symfony security component as standalone
{
"name": "jaytaph/security-example",
"require": {
"symfony/security-core": "~2.8"
},
"authors": [
{
"name": "Joshua Thijssen",
"email": "jthijssen@noxlogic.nl"
}
"extra": {
"installer-paths": {
"./customdir/": ["monolog/monolog"]
}
}
@veloxy
veloxy / main.js
Created March 9, 2016 11:59 — forked from nishanths/main.js
Electron tray: Drag and Drop events demo
var app = require('app');
var Menu = require('menu');
var Tray = require('tray');
var appIcon = null;
app.on('ready', function(){
// image is null, so image will not be shown in menu bar
// so click around on the system menu bar to locate the space where the tray icon is
appIcon = new Tray(null);
@veloxy
veloxy / index.php
Created November 30, 2015 19:24
Name generator based on markov process
<?php
function generateMarkovTable($names = [])
{
$table = [];
foreach ($names as $name) {
$letters = str_split($name);
foreach ($letters as $key => $letter) {
$letter = strtolower($letter);
if (!array_key_exists($key + 1, $letters)) {
<?php
namespace Kunstmaan\FixturesBundle\Provider;
use Doctrine\ORM\EntityManager;
class NodeTranslation
{
private $nodeTransRepo;
@veloxy
veloxy / ogone_status_codes
Created May 13, 2014 12:14
Ogone Status Codes, more formats can be found here https://github.com/veloxy/ogone-status-codes
0: Invalid Ogone payment
1: Payment canceled by client
2: Payment declined by acquirer
4: Payment pending at Ogone with reference
41: Waiting for client payment
5: Payment authorized by acquirer with reference
51: Waiting for authorization
52: Authorization not known
55: Stand-by
59: Authorized to capture manually
@veloxy
veloxy / gist:9134425
Created February 21, 2014 13:41
Create chunks of variable sizes
<?php
if (!function_exists('array_chunk_uneven')) {
function array_chunk_uneven(array $array, array $sizes)
{
while (list($key, $size) = each($sizes)) {
$chunks[] = array_slice($array, 0, $size);
$array = array_values(array_slice($array, $size, count($array)));
if ($array && $key == (count($sizes) - 1)) {
reset($sizes);
@veloxy
veloxy / gist:9134387
Last active August 29, 2015 13:56
String to array
<?php
function stringToArray($key)
{
$result = array();
$parts = explode('.', $key);
$current = &$result;
for ($i = 0, $max = count($parts); $i < $max; $i++) {
if (!isset($current[$parts[$i]])) {
$current[$parts[$i]] = array();
@veloxy
veloxy / Generate Combinations
Created November 8, 2011 20:07
Generate Combinations
<?php
function array_outer($f, array $array1) {
$res = array();
$arrays = $array1;
foreach ($arrays as $a) {
if (empty($a))
return $res;
}