Skip to content

Instantly share code, notes, and snippets.

View alexwilson's full-sized avatar
🎧
i only speak techno.

Alex Wilson alexwilson

🎧
i only speak techno.
View GitHub Profile
@alexwilson
alexwilson / reverse-symlink.sh
Created July 30, 2017 12:05
reverse-symlink.sh
@alexwilson
alexwilson / eZDeleteUsers.php
Created June 19, 2017 11:16
eZDeleteUsers.php
#!/usr/bin/env php
<?php
include_once('autoload.php');
ini_set("memory_limit", "-1");
ini_set("date.timezone", "Europe/London");
$cli =& eZCLI::instance();
$script =& eZScript::instance();
$script->startup();
@alexwilson
alexwilson / README.md
Last active January 7, 2017 16:30
QuerySelectorAll jQuery-Like Helper
import $$ from '$$'
$$('p').forEach(a => a.innerText = "yolo")
@alexwilson
alexwilson / m_gender_pronouns.cpp
Last active September 27, 2020 21:22
Gender Identity and Preferred Gender Pronoun module for InspIRCd
#include "inspircd.h"
/**
* m_gender_pronouns.cpp
* Introduces two new commands, SETGENDER and SETPRONOUN,
* allowing a user to specify their gender identity and
* preferred gender pronouns.
*
* Copyright (c) 2017 Alex Wilson <a@ax.gy>
*
const SITEMAP_CACHE_KEY = 'sitemap-cached-pages-v1'
self.addEventListener('install', event => {
event.waitUntil(cacheSitemap())
})
const cacheSitemap = _ => caches.open(SITEMAP_CACHE_KEY)
.then(cache =>
cacheSitemap()
.then(urls => urls.map(u => u.toString()))
// Reduce a list by cancelling pairs of values.
// e.g. cancelByPair('LLLRLRLRLR', 'L', 'R') === 'LL'
function cancelByPair(list, firstValue, secondValue) {
// First filter out all of these values, and count them as we go.
let count = 0;
const cancelledList = list.filter(c => {
switch (c) {
case firstValue:
count++
@alexwilson
alexwilson / keybase.md
Created October 18, 2016 10:19
Keybase Verification

Keybase proof

I hereby claim:

  • I am antoligy on github.
  • I am antoligy (https://keybase.io/antoligy) on keybase.
  • I have a public key whose fingerprint is B5E9 8AE7 DDB8 B82E B375 E2CF DE20 36C6 B4D2 F38E

To claim this, I am signing this object:

@alexwilson
alexwilson / ezpublish-sob.php
Created September 23, 2016 14:43
how to curl up into a fetal position and cry
<?php // Why does syntax highlighting need this?
use eZ\Publish\Core\MVC\Symfony\Security\User as EzUser;
use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Session\Session;
$securityContext = $container->get('security.context');
$router = $container->get('router');
$requestStack = $container->get('request_stack');
@alexwilson
alexwilson / matryoshka.scss
Last active September 4, 2016 23:03
Matryoshka Sass micro-framework (nestable)
/**
* Sass import for generating nestable containers.
* The "rest" of the grid is just flex boxes.
*/
*, :after, :before {
box-sizing: inherit;
}
html, body {
padding: 0;
margin: 0;
@alexwilson
alexwilson / EzPublishLegacyConfigurationMapper.php
Last active September 2, 2016 16:38
EzPublish Legacy Configuration Mapper
<?php
namespace EzPublish\AppBundle\EventListener;
use eZ\Publish\Core\MVC\Legacy\Event\PreBuildKernelEvent;
use eZ\Publish\Core\MVC\Legacy\LegacyEvents;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
class LegacyConfigurationMapper implements EventSubscriberInterface
{
/**