Skip to content

Instantly share code, notes, and snippets.

View Colouratura's full-sized avatar

Abish Colouratura

  • Detroit, Michigan
  • 05:31 (UTC -04:00)
View GitHub Profile
const templatr = function Templatr ()
{
'use strict';
const tokens = {
L_BRACE: '{',
R_BRACE: '}',
T_EQUAL: '=',
T_PIPE: '|'
};
/**
* Class constructor for a plugin manager
*
* Provides the ability to load and seal plugins on demand per instance
* incase one would want to have different settings per server.
*
* @return {PluginManager}
*/
const PluginManager = function () {
this.prefix = '@';
/**
* WatchNewPage.js
*
* This script allows one to set a process to watch for newly created pages
* on a wiki. When one is found it is subsequently recorded and a desktop
* notification dispatched to notify the user.
*
* Author: Colouratura
*/
( function ( $ ) {
var conflicts = [
[ 'Monster', 'Ghosts', 'Demon/Devil', 'Beings', 'Gods', 'Cryptids' ],
[ 'Books', 'Diary/Journal', 'Items/Objects' ],
[ 'Lost Episodes', 'Television' ],
[ 'Pokemon', 'Zelda', 'Video Games' ],
[ 'Holders', 'Ritual' ],
[ 'Holders', 'Items/Objects' ],
[ 'Holders', 'Places' ],
[ 'HPL', 'Lovecraftian', 'Suggested Reading' ]
@Colouratura
Colouratura / contractify.js
Last active July 25, 2017 02:53
A contract library for JS supporting pre- and post-conditions
/**
* Contractify
* Simple, safe, sealed contracts for JavaScript
*
* Contracts are a way of checking the arguments of a function as well as its result against
* a strictly defined set of pre- and post-conditions. Doing so helps to ensure that a function
* is passed arguments it expects and well as passes out a result the caller expects.
*
* In doing this Contractify allows you to supply a function that will be called before and after
* execution in which you can define the rules input and output must conform to.
@Colouratura
Colouratura / cobalt.js
Created August 7, 2017 01:17
A small lisp-like markdown language for chats
class Cobalt {
parse(expr) {
if (!typeof expr === 'string') throw new TypeError(`Type of expr is '${typeof expr}', expected string`);
this.__tags = [ 'color', 'strike', 'underline', 'bold', 'italic' ];
return this.__parenthesize(this.__tokenize(expr));
}
__parenthesize(str, lst) {
const QuickTools = {
actions: {}
};
QuickTools.findUserLinks = function () {
let links = $('#mw-content-text a');
links = links.toArray()
.filter((link) => link.href.includes('User:'));
return links;
@Colouratura
Colouratura / dove.es5.js
Last active October 2, 2017 00:57
DoveModal - A simple modal builder for Wikia scripts
'use strict';
var DoveModal = function DoveModal() {
var schema = arguments[0];
this._schema = schema;
this._handlers = [];
this._uniques = [];
this._inputs = [];
this._renderedSchema = null;
this._schemaID = null;
this.rendered = false;
@Colouratura
Colouratura / Zion.js
Last active October 4, 2017 21:48
The script loader for Wikia that lets you use ES6 like an actual person
(function (window, document, mw) {
var ZION = function () {
this._scripts = [];
this.loaded = this.loaded();
return this;
};
ZION.prototype._getScriptURL = function (script) {
var split = script.split(':');
var CheckAdoptions = function () {
this._adoptions = [];
this._concerns = [];
return this;
};
CheckAdoptions.prototype.__fetchAdoptionsList = function () {
if (this._adoptions.length > 0) {
this._adoptions = [];
this._concerns = [];