Skip to content

Instantly share code, notes, and snippets.

View sbrl's full-sized avatar

Starbeamrainbowlabs sbrl

View GitHub Profile
@sbrl
sbrl / github-dark.css
Created June 15, 2018 10:51
[Ghostwriter: GitHub Dark] The default GitHub theme for Ghostwriter, but with the lights turned off. #css
/*
* Copyright (c) 2013 Chris Patuzzo <[email protected]>
*
* The "github.css" Style Sheet by Chris Patuzzo <[email protected]>
* is available from http://www.github.com/tuzz.
*/
/*
* Copyright (c) 2014-2016 wereturtle
*
* Modifications made to the hr element style.
@sbrl
sbrl / ApplySettings.mjs
Last active April 14, 2020 13:45
ApplySettings.mjs #port
"use strict";
/**
* Recursively overwrites 1 settings object with another.
* Ported from PHP: https://gist.github.com/00f1b9b1fd6ca0610b780587f11ede4e#file-applysettings-php
* @param {object} def The default settings object to overwrite.
* @param {object} custom The settings to use when overwriting.
*/
function apply_settings(def, custom) {
// If the default doesn't exist, then return the custom
@sbrl
sbrl / Triangle.cs
Created March 10, 2018 23:00
[Triangle.cs] Forked from Rectangle.cs, this is a class that represents, yep, you guessed it, a triangle.
using System;
namespace SBRL.Utilities
{
/// <summary>
/// Represents an isosceles / equilateral Triangle in 2D space.
/// </summary>
/// <remarks>
/// Features the ability to return its bounding box as a Rectangle - the struct
/// this struct was forked from.
@sbrl
sbrl / slugify.php
Created March 5, 2018 21:31
[slugify] A simple slugifier in PHP. Makes any string safe for inclusion in filenames / paths, urls, and more!
<?php
/**
* Normalises and removes any unknown characters from a string, making it safe
* for use as a filename.
* @param string $string The string to slugificate.
* @param integer $maxlength The maximum desired length of the resultant string.
* @return string The slugified string.
*/
function slugify($string, $maxlength = 50) {
@sbrl
sbrl / TomlConfig.php
Last active January 15, 2019 16:41
[TomlConfig.php] A variant on my JsonConfig PHP class that uses Toml instead.
<?php
namespace SBRL;
use \stdClass;
use \Yosymfony\Toml\Toml;
use \Yosymfony\Toml\TomlBuilder;
/**
* Handles the loading and saving of settings from a toml file.
@sbrl
sbrl / peppermint
Last active April 23, 2021 00:42
A Simple CLI for Pepperminty Wiki. In development to test Pepperminty Wiki's machine friendlyness :D #cli
#!/usr/bin/env bash
##########################
### Colour Definitions ###
#### ANSI color codes ####
RS="\033[0m" # reset
HC="\033[1m" # hicolor
UL="\033[4m" # underline
INV="\033[7m" # inverse background and foreground
FBLK="\033[30m" # foreground black
@sbrl
sbrl / Vector2.cs
Last active March 20, 2018 20:03
[Vector2.cs] A half-port of my particularly useful Vector.js to C♯. Doesn't currently implement all the methods that Vector.js has, but I'll add them as I need them. #microlibrary
using System;
namespace SBRL.IO.Svg
{
/// <summary>
/// Represents a single point in 2D space.
/// May also be used to represent a direction with a magnitude.
/// </summary>
/// <version>v0.4.2</version>
/// <changelog>
@sbrl
sbrl / Mouse.mjs
Last active December 24, 2018 10:34
[Mouse.mjs] Allow access to mouse information outside an event listener. #manager #interface #microlibrary
"use strict";
/*****************************************************************************
******************************** Mouse class ********************************
********************************************************************* v0.1 **
* A simple mouse class, records and stores mouse information later use
* outside an event listener. Depends on my earlier Vector class.
*
* Author: Starbeamrainbowlabs
* Twitter: @SBRLabs
@sbrl
sbrl / Rectangle.cs
Last active March 10, 2018 22:56
[Rectangle.cs] A class to represent an arbitrary rectangle in 2D space. Yes, System.Drawing contains one, but I had issues deserializing into it with JSON.NET. #microlibrary
using System;
using System.Collections.Generic;
using System.Linq;
namespace SBRL.Utilities
{
/// <summary>
/// Represents a rectangle in 2D space.
/// </summary>
/// <version>v0.3</version>
@sbrl
sbrl / Rectangle.mjs
Last active May 29, 2019 19:47
[Rectangle.mjs] A port of a recent Rectangle class I wrote in C# to an ES6 module. Requires my earlier Vector class. #microlibrary
"use strict";
import Vector from './Vector2.mjs';
/**
* Represents a rectangle in 2D space.
* @source https://gist.github.com/d7ff700d3ca57ab5d52ec12a1ee8b8a0
* Changelog:
* 29th May 2019
* Created this changelog