Skip to content

Instantly share code, notes, and snippets.

Avatar

Eddie Antonio Santos eddieantonio

View GitHub Profile
@eddieantonio
eddieantonio / word-break-property.ts
Created Jul 10, 2020
Wordbreak property enum values
View word-break-property.ts
export const enum WordBreakProperty {
/* 0 */ Other,
/* 1 */ LF,
/* 2 */ Newline,
/* 3 */ CR,
/* 4 */ WSegSpace,
/* 5 */ Double_Quote,
/* 6 */ Single_Quote,
/* 7 */ MidNum,
/* 8 */ MidNumLet,
View SmartTemplate.js
/*!
* Copyright (c) 2020 Eddie Antonio Santos
*
* This Source Code Form is subject to the terms of the Mozilla Public License,
* v. 2.0. If a copy of the MPL was not distributed with this file, You can
* obtain one at http://mozilla.org/MPL/2.0/.
*/
/**
* Simplifies interaction with <template> tags:
@eddieantonio
eddieantonio / create-syllabics-chart.py
Created May 19, 2020
Create a syllabics chart for Plains Cree (nêhiyawêwin) (ᓀᐦᐃᔭᐤ ᒐᐦᑭᐯᐦᐃᑲᓇ)
View create-syllabics-chart.py
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-
from cree_sro_syllabics import sro2syllabics
consonants = 'ptkcmnsy'
finals = ('h', 'hk', 'r', 'l', 'w')
vowels_circumflex = 'êioaîôâ'
vowels_macron = 'ēioaīōā'
@eddieantonio
eddieantonio / javascript-null-undefined.md
Created Apr 24, 2020
Checking for `null` or `undefined` in JavaScript
View javascript-null-undefined.md

Checking for null or undefined in JavaScript

Say I want to check if a value v is either null or undefined in JavaScript. I might use this conditional:

if (!v) { ... } // 🙅‍♀️ wrong!
View create-data.py
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-
"""
Creates (dumb) rainfall data.
Usage:
python3 create-data.py > rainfall.txt
"""
View nrc-cnrc-logo-uncropped.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@eddieantonio
eddieantonio / dice.py
Created Aug 12, 2019
Showcase of dataclasses and module __getattr__().
View dice.py
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-
from dataclasses import dataclass
from random import randint
import re
dn = re.compile(r'd([123456789][0123456789]*)')
__all__ = ['Die']
View huff.erl
%% Huffman Code for nêhiyawêwin %%
%% Note: Cree strings must be written in "askiy":
%% - short vowels and consonants: written in ASCII
%% - long vowels: ê is written as e; "âîô" written as "AIO" respectively.
%% - it's a very grounded character encoding 😉
%%
%% I haven't done extensive testing, but this usually uses half the bits to
%% represent Cree word forms. Maybe just gzip it instead?
-module(huff).
-export([encode/1, decode/1, tryit/1]).
@eddieantonio
eddieantonio / nrc_cr_cans.keyman-touch-layout
Last active Jul 9, 2019
Draft Plains Cree syllabics touch keyboard
View nrc_cr_cans.keyman-touch-layout
{
"phone": {
"font": "Euphemia",
"layer": [
{
"id": "default",
"row": [
{
"id": 1,
"key": [
@eddieantonio
eddieantonio / $cree-grapheme-stats.md
Last active Jun 25, 2019
Count unigrams and bigrams in the Wolfart-Ahenakew corpus
View $cree-grapheme-stats.md

Cree Grapheme Stats

Count unigrams and bigrams in the Wolfart-Ahenakew nêhiyawêwin corpus!

Why

When building a keyboard for typing Cree, it is useful to know which graphemes are typed often, and which pairs of graphemes are typed one

You can’t perform that action at this time.