This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function magicMethods (clazz) { | |
// A toggle switch for the __isset method | |
// Needed to control "prop in instance" inside of getters | |
let issetEnabled = true | |
const classHandler = Object.create(null) | |
// Trap for class instantiation | |
classHandler.construct = (target, args, receiver) => { | |
// Wrapped class instance |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# Initial script to create users when launching an Ubuntu server EC2 instance | |
# | |
declare -A USERKEY | |
# | |
# Create one entry for every user who needs access. Be sure to change the key to their |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ redis-cli | |
> config set stop-writes-on-bgsave-error no |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Backup | |
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql | |
# Restore | |
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fetchMachine = Machine({ | |
id: 'fetch', | |
initial: 'ready', | |
context: {}, | |
states: { | |
ready: { | |
invoke: [{ | |
src: 'listenForRecipientTyping', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fetchMachine = Machine({ | |
id: 'fetch', | |
initial: 'ready', | |
context: { | |
retries: 0 | |
}, | |
states: { | |
ready: { | |
invoke: { | |
src: 'listenForTypingOnChannel', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import typeOf from 'just-typeof'; | |
const colors = { | |
heading: '#86c0d1', | |
title: '#80a0c2', | |
subtitle: '#a2bf8a', | |
body: '#d8dee9', | |
}; | |
const styles = { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const YapsMachine = Machine({ | |
id: 'yap', | |
initial: 'unknown', | |
context: { | |
Yap: { | |
id: 123, | |
status: { | |
description: 'New' | |
} | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const messagingMachine = Machine({ | |
id: 'messaging', | |
initial: 'idle', | |
context: { | |
// | |
}, | |
// either sending messages, receiving messages, or neither. | |
// can send and receive at same time. | |
type: 'parallel', | |
states: { |
NewerOlder