Skip to content

Instantly share code, notes, and snippets.

@tuupola
tuupola / index.php
Last active March 4, 2019 09:47
Use JWT Authentication middleware with ZF Expressive
<?php
use Zend\Expressive\AppFactory;
use Firebase\JWT\JWT;
use Slim\Middleware\JwtAuthentication;
chdir(dirname(__DIR__));
require "vendor/autoload.php";
$app = AppFactory::create();
@b-b3rn4rd
b-b3rn4rd / function_v1.php
Last active March 28, 2018 19:06
Convert adjacency list into tree without recursion and second array.
<?php
function array_to_tree(array $array, $parent_id = 0)
{
$array = array_combine(array_column($array, 'id'), array_values($array));
foreach ($array as $k => &$v) {
if (isset($array[$v['parent_id']])) {
$array[$v['parent_id']]['children'][$k] = &$v;
}
@mloberg
mloberg / File.Upload.js
Created November 6, 2011 04:23
MooTools Ajax File Upload
/*
name: [File.Upload, Request.File]
description: Ajax file upload with MooTools.
license: MIT-style license
author: Matthew Loberg
requires: [Request]
provides: [File.Upload, Request.File]
credits: Based off of MooTools-Form-Upload (https://github.com/arian/mootools-form-upload/) by Arian Stolwijk
@Olical
Olical / Documentation.md
Created September 22, 2011 12:07
Preloader.js - Preload all assets, ideally for a game, using MooTools

About

This class allows you to preload all of your images, sounds, videos, JSON, JavaScript and CSS files with one call. It provides you with progress reports and lets you know when everything is done.

It requires MooTools and MooTools More with the Assets and Request.JSONP boxes ticked. I have attached a copy of the required MooTools More version to this gist.

Example

You can find an example here on jsFiddle.