Skip to content

Instantly share code, notes, and snippets.

Starbeamrainbowlabs sbrl

Block or report user

Report or block sbrl

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@sbrl
sbrl / JsonStorageBox.php
Last active Sep 21, 2019
[JsonStorageBox.php]
View JsonStorageBox.php
<?php
/*
███████ ████████ ██████ ██████ █████ ██████ ███████ ██████ ██████ ██ ██
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
███████ ██ ██ ██ ██████ ███████ ██ ███ █████ ██████ ██ ██ ███
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
███████ ██ ██████ ██ ██ ██ ██ ██████ ███████ ██████ ██████ ██ ██
*/
@sbrl
sbrl / StorageBox.php
Last active Sep 21, 2019
[StorageBox.php] A key-value data store, backed by SQLite3.
View StorageBox.php
<?php
/*
███████ ████████ ██████ ██████ █████ ██████ ███████ ██████ ██████ ██ ██
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
███████ ██ ██ ██ ██████ ███████ ██ ███ █████ ██████ ██ ██ ███
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
███████ ██ ██████ ██ ██ ██ ██ ██████ ███████ ██████ ██████ ██ ██
*/
View cucumber.js
"use strict";
async function pipe(initial_value, ...funcs) {
let current = initial_value;
for(let func of funcs) {
current = func(current);
// If it's thenable, then it's probably a Promise
if(typeof current.then == "function")
current = await current;
}
@sbrl
sbrl / SvgWriter.mjs
Last active Jun 10, 2019
[SVGWriter.mjs] SVGWriter.cs, ported to Javascript. Uses the xml-writer npm package.
View SvgWriter.mjs
"use strict";
import XMLWriter from 'xml-writer';
import Rectangle from './Rectangle.mjs';
import Vector2 from './Vector2.mjs';
/*
* Simplifies the process for creating an SVG dynamically.
* Originally written for MusicBoxConverter, but lifted, reused, and extended for FloatingIslands.
@sbrl
sbrl / CLI.mjs
Last active Mar 16, 2019
[CLI.mjs] A CLI template for Node.js #template
View CLI.mjs
#!/usr/bin/env node
// Requires Ansi.mjs, which can be found here: https://gist.github.com/8c0bb5e172438b6e62dd48587cfeba84#file-ansi-mjs
import Ansi from './Ansi.mjs';
// 1: Setup
const ansi = new Ansi();
const settings = {
@sbrl
sbrl / Ansi.mjs
Last active Mar 27, 2019
[Ansi.mjs] VT100 ANSI escape sequence generator in JS. Ported from the C# version.
View Ansi.mjs
"use strict";
/**
* Generates various VT100 ANSI escape sequences.
* Ported from C#.
* @licence MPL-2.0 <https://www.mozilla.org/en-US/MPL/2.0/>
* @source https://gist.github.com/a4edd3204a03f4eedb79785751efb0f3#file-ansi-cs
* @author Starbeamrainbowlabs
* GitHub: @sbrl | Twitter: @SBRLabs | Reddit: u/Starbeamrainbowlabs
***** Changelog *****
@sbrl
sbrl / xsend.py
Last active Jan 7, 2019
[xsend.py] A cleaned-up version of http://xmpppy.sourceforge.net/examples/xsend.py. Requires the "xmpppy" package - which is installable via pip.
View xsend.py
#!/usr/bin/env python3
# $Id: xsend.py,v 1.8 2006/10/06 12:30:42 normanr Exp $
# Edited & cleaned up by Starbeamrainbowlabs <feedback@starbeamrainbowlabs.com>
import sys
import os
import time
import xmpp
@sbrl
sbrl / NightInk.php
Created Dec 5, 2018
[NightInk/PHP] A teeny-tiny templating engine. This implementation is in PHP.
View NightInk.php
<?php
namespace SBRL;
/**
* A teeny-tiny templating engine.
* @author Starbeamrainbowlabs
* @version v0.2
* @lastModified 23rd August 2018
* @license https://www.mozilla.org/en-US/MPL/2.0/ Mozilla Public License 2.0
@sbrl
sbrl / plaintext-convert.sh
Created Nov 26, 2018
Converter for pirate/bookmark-archiver that converts a plain-text list of urls into something it can understand.
View plaintext-convert.sh
#!/bin/bash
set -o errexit
set -o nounset
##############
# This program converts a plain-text list of urls to the
# bookmark-archiver HTML format.
#
# Requirements: curl, xidel
# Usage:
@sbrl
sbrl / ParseCSV.mjs
Created Sep 13, 2018
Quick CSV Parser that converts CSV files into an array of JS Objects.
View ParseCSV.mjs
"use strict";
/**
* Parses the source CSV into an array of objects.
* @param {string} source The source CSV to parse.
* @returns {[object]} An array of objects. The keys are taken from the csv header.
*/
export default function ParseCSV(source, parse_numbers) {
// TODO: Add support for commas in quotes here
let parsed_lines = source.trim().split(/\r?\n/).map((line) => line.split(","));
You can’t perform that action at this time.