Skip to content

Instantly share code, notes, and snippets.

Avatar
☢️
radioactive commit messages

Lily Scott suchipi

☢️
radioactive commit messages
View GitHub Profile
View regex_helpers.coffee
@RegexHelpers =
# matches colors like #ffffff, #eee, rgb(255,255,255), and rgba(255, 255, 255, 0.25)
cssColorMatchString: '(?:#(?:[0-9a-f]{6}|[0-9a-f]{3}))|(?:rgba?\\((?:\\d+, *){2,3}(?:\\d+(?:\\.\\d+)?)\\))'
makeTagRegex: (tagName, attributeMatch=".*") ->
# matches:
# <tagName attribute>content</tagName>
# [tagName: attribute]content[/tagName]
# <tagName = attribute>content</tagName>
# <tagName>content</tagName>
View es2015 import export explanation.md

with es2015 modules, every file can export both "named exports" and a "default export". But the "default export" is just an export with the name "default". To do a named export, you can do:

const foo = 5;
function bar() {}
class Baz {}
export { foo, bar, Baz };
// or
export const foo = 5; // uses the name of the variable declaration
export function bar() {} // uses the name of the function
@suchipi
suchipi / pkg.sh
Last active Jan 30, 2019
Pacman alias function
View pkg.sh
pkg() {
case "$1" in
list)
# List all installed packages
command pacman -Q
;;
list-roots)
# List all installed packages that aren't required by anything
command pacman -Qet
;;
@suchipi
suchipi / MaybeFruit.js
Created Dec 16, 2018
Tagged Unions in Flow
View MaybeFruit.js
// @flow
type NoneType = {|
type: 'None',
|};
type AppleType<AppleInner> = {|
type: 'Apple',
value: AppleInner,
|};
type BananaType = {|
type: 'Banana',