Skip to content

Instantly share code, notes, and snippets.

View glen-84's full-sized avatar

Glen glen-84

  • Cape Town, South Africa
View GitHub Profile
@glen-84
glen-84 / LazySaveHandler.php
Last active December 16, 2015 17:28
Lazy session handler for ZF2
<?php
namespace Apex\Session;
use Zend\Session\SaveHandler\SaveHandlerInterface;
/**
* Based on https://github.com/adamfranco/lazy_sessions/blob/master/lazy_sessions.php
*
* @author Glen
@font-face {
font-family: 'icomoon';
src: url(data:application/x-font-ttf;charset=utf-8;base64,AAEAAAALAIAAAwAwT1MvMg8SDgQAAAC8AAAAYGNtYXAPfuIIAAABHAAAAExnYXNwAAAAEAAAAWgAAAAIZ2x5ZuM5hHAAAAFwAAABXGhlYWQEEsiwAAACzAAAADZoaGVhBgsDyQAAAwQAAAAkaG10eAluACUAAAMoAAAAIGxvY2EBPADgAAADSAAAABJtYXhwAAoAFgAAA1wAAAAgbmFtZVcZpu4AAAN8AAABRXBvc3QAAwAAAAAExAAAACAAAwQAAZAABQAAApkCzAAAAI8CmQLMAAAB6wAzAQkAAAAAAAAAAAAAAAAAAAABEAAAAAAAAAAAAAAAAAAAAABAAADw2gPA/8AAQAPAAEAAAAABAAAAAAAAAAAAAAAgAAAAAAACAAAAAwAAABQAAwABAAAAFAAEADgAAAAKAAgAAgACAAEAIPDa//3//wAAAAAAIPDX//3//wAB/+MPLQADAAEAAAAAAAAAAAAAAAEAAf//AA8AAQAAAAAAAAAAAAIAADc5AQAAAAABAAAAAAAAAAAAAgAANzkBAAAAAAEAAAAAAAAAAAACAAA3OQEAAAAAAQAAAQACSQJJABMAAAEUBwEGIyInASY1NDc2MyEyFxYVAkkL/wALDg8L/wALCwsPAgAOCwsCJQ8L/wALCwEACw8OCwsLCw4AAQAAANsCSQIlABMAAAEUBwYjISInJjU0NwE2MzIXARYVAkkLCw7+AA8LCwsBAAsPDgsBAAsBAA8LCwsLDw8LAQALC/8ACw8AAQAlAJIBbgLbABMAAAERFAcGIyInASY1NDcBNjMyFxYVAW4LCw8PC/8ACgoBAAsPDwsLArf+AA8LCwsBAAsPDwsBAAoKCw8AAQAAAJIBSQLbABMAAAEUBwEGIyInJjURNDc2MzIXARYVAUkL/wALDg8LCwsLDw4LAQA
var gulp = require("gulp");
var browserSync = require("browser-sync").create();
var swagger = require("swagger-parser");
var fs = require("fs");
gulp.task("serve", function() {
browserSync.init({
open: false,
server: {
baseDir: "./",
// Note: The definitions below are incomplete, they are just used to satisfy the TypeScript compiler for now.
declare module "glob2base" {
var glob2base: any;
export = glob2base;
}
declare module "gulp" {
var gulp: any;
export = gulp;
@glen-84
glen-84 / letter-to-dc.txt
Last active May 21, 2016 16:23
Letter to DC
Hi,
I'm noticing that a disturbing number of package managers[1] and other software projects[2] are making use of JSON as a
configuration format, which is starting to bother me (probably more than it should), since JSON is a data serialization
format, and was not intended for this purpose (as I understand it).
Have you considered writing a new specification for a format that is more suited to such uses? Something similar to
JSON5 or YAML. YAML is pretty cool, but people don't like/use it because (I assume):
1. It has a stupid name.
<template>
<require from="./select2-custom-attribute"></require>
<require from="./debug"></require>
<h1>Standard Select</h1>
<select value.bind="selectedThings" style="width: 100%">
<option repeat.for="thing of things" model.bind="thing">${thing.name}</option>
</select>
<h1>Select2</h1>
@glen-84
glen-84 / app.html
Created March 5, 2017 15:52 — forked from plwalters/app.html
DI inheritance
<template>
<h1>Dialog Repro</h1>
<button click.delegate="submit()">Open Dialog</button>
</template>
@glen-84
glen-84 / app.html
Last active August 21, 2017 17:25 — forked from jdanyow/app.html
Aurelia set select options and value
<template>
<h1>Instructions</h1>
<ol>
<li>Click the "Set value" button (selected option changes correctly)</li>
<li>Increment number to 3</li>
<li>Click the "Set options and value" button (selected option is not set correctly)</li>
</ol>
<select value.bind="matchGame.winner.id">
@glen-84
glen-84 / gg-number-array.ts
Created February 13, 2019 10:59
Number array custom attribute
import {autoinject, bindingMode, customAttribute} from "aurelia-framework";
/**
* Ensures that array elements are numbers.
*
* TODO: Using this custom attribute because value converters and binding behaviors are not working well with
* multi-select elements. See https://github.com/aurelia/binding/issues/611.
*/
@autoinject
@customAttribute("gg-number-array", bindingMode.twoWay)
@glen-84
glen-84 / index.ts
Created April 20, 2021 09:53
Koa middleware for Rendertron.
import axios from "axios";
import type {IncomingMessage} from "node:http";
import type {Middleware} from "koa";
/**
* A default set of user agent patterns for bots/crawlers that do not perform
* well with pages that require JavaScript.
*/
export const botUserAgents = [
// spell-checker:disable