Skip to content

Instantly share code, notes, and snippets.

View Alamantus's full-sized avatar

Robbie Antenesse Alamantus

View GitHub Profile
@Alamantus
Alamantus / capitalizeWords.js
Last active April 9, 2021 21:04
Capitalize Words, Name-Sensitive
function capitalizeWords(str, additionalPrefixes = []) {
const prefixMatches = Array.from(new Set([
"D'", 'Ma?c', "N'", "O'",
...additionalPrefixes
]));
const capitalizeFirst = ([first, ...rest]) => first.toUpperCase() + rest.join('').toLowerCase();
return str.split(/\s+/)
.map(word => {
word = capitalizeFirst(word);
const hyphenated = word.split('-').filter(side => side.length > 0);
ALTER TABLE `dictionaries`
ADD COLUMN `custom_css` text NOT NULL COMMENT 'CSS' AFTER `theme`;
ALTER TABLE `dictionary_linguistics`
ADD COLUMN `alphabetical_order` VARCHAR(255) NOT NULL DEFAULT '' COMMENT 'Space-separated' AFTER `parts_of_speech`,
ADD COLUMN `phonology_notes` text NOT NULL COMMENT 'Markdown' AFTER `blends`,
CHANGE `exceptions` `phonotactics_notes` text NOT NULL COMMENT 'Markdown',
ADD COLUMN `translations` text NOT NULL COMMENT 'Newline-separated; Translates left character(s) to right character(s)' AFTER `phonotactics_notes`;
@Alamantus
Alamantus / getSaneTimestamp.php
Last active October 25, 2018 19:08
Get a Sane, Readable 14-character Timestamp
function getSaneTimestamp() {
// Return a timestamp in the format yyyymmddhhmmss
return date('YmdHis', time() - date('Z'));
}
@Alamantus
Alamantus / getSaneTimestamp.js
Last active October 25, 2018 19:07
Get a Sane, Readable 14- or 17-character Timestamp
function getSaneTimestamp(includeMS) {
// Return a timestamp in the format yyyymmddhhmmss
// If includeMS is truthy, returns yyyymmddhhmmssmmm
var d = new Date();
var yr = d.getUTCFullYear().toString();
var mt = ('0' + (d.getUTCMonth() + 1).toString()).substr(-2);
var dy = ('0' + d.getUTCDate().toString()).substr(-2);
var hr = ('0' + d.getUTCHours().toString()).substr(-2);
var mn = ('0' + d.getUTCMinutes().toString()).substr(-2);
var sc = ('0' + d.getUTCSeconds().toString()).substr(-2);
@Alamantus
Alamantus / keybase.md
Last active March 25, 2018 16:38
keybase.md

Keybase proof

I hereby claim:

  • I am alamantus on github.
  • I am alamantus (https://keybase.io/alamantus) on keybase.
  • I have a public key ASDQWESUPRzVLLJsF3ImAQi9nvxKACV1frKNoyMRYT1-3Ao

To claim this, I am signing this object:

@Alamantus
Alamantus / undertale.css
Last active April 21, 2017 18:36 — forked from blackle/undertale.css
Mastodon Undertale Theme
/* A fallback for in case you don't have the Determination Mono font installed */
@import url('https://fonts.googleapis.com/css?family=Press+Start+2P');
* {
border-radius: 0px !important;
box-shadow: none !important;
text-shadow: none !important;
}
.avatar, img {
@Alamantus
Alamantus / styleguide.md
Last active July 12, 2016 19:06
A minimal JavaScript style guide intended to make reading and writing code easier.

A Minimal JavaScript Style Guide

Written and Managed by Robbie Antenesse

As I'm working on JavaScript projects, I want to be sure that I have a consistent and readable style. This style guide is based partially on how I normally program anyway, partially on what I like from the ES2015 standard, and partially on what I think will help make any future code I write more readable to someone who might come after me.

This'll probably be changing infrequently as I find things I don't like about what I've decided or remember things that are missing.

@Alamantus
Alamantus / gist:3e64940ccc9f5679eb26
Created March 20, 2016 16:00
JS function to return keycode for specified key name
function keyCodeFor(keyName) {
if (keyName == "backspace") return 8;
else if (keyName == "tab") return 9;
else if (keyName == "ctrlEnter") return 10;
else if (keyName == "enter") return 13;
else if (keyName == "shift") return 16;
else if (keyName == "ctrl") return 17;
else if (keyName == "alt") return 18;
else if (keyName == "pausebreak") return 19;
else if (keyName == "capslock") return 20;
@Alamantus
Alamantus / helpers.js
Created March 20, 2016 15:55
Helper Functions for JavaScript
function ready(fn) {
if (document.readyState != 'loading'){
fn();
} else {
document.addEventListener('DOMContentLoaded', fn);
}
}
// Get Keycode based on key name
function keyCodeFor(keyName) {