Skip to content

Instantly share code, notes, and snippets.

View leeovery's full-sized avatar
🎯
Focusing

Lee Overy leeovery

🎯
Focusing
View GitHub Profile
@leeovery
leeovery / magic-methods.js
Created April 25, 2024 13:58 — forked from loilo/magic-methods.js
PHP Magic Methods in JavaScript
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
@leeovery
leeovery / sample.png
Created March 11, 2022 09:27 — forked from jirutka/sample.png
Nested numbered list with correct indentation in CSS. Live example at http://jsfiddle.net/a84enL8k/.
sample.png
@leeovery
leeovery / aws_create_users_ubuntu.sh
Created March 10, 2022 13:51 — forked from vasansr/aws_create_users_ubuntu.sh
AWS User Data Script to create users when launching an Ubuntu server EC2 instance
#!/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
@leeovery
leeovery / gist:1c591d82021de756d1dfed3b9cc708df
Created August 13, 2021 19:14 — forked from kapkaev/gist:4619127
MISCONF Redis is configured to save RDB snapshots, but is currently not able to persist on disk. Commands that may modify the data set are disabled. Please check Redis logs for details about the error. Resque
$ redis-cli
> config set stop-writes-on-bgsave-error no
@leeovery
leeovery / mysql-docker.sh
Created September 14, 2020 14:53 — forked from spalladino/mysql-docker.sh
Backup and restore a mysql database from a running Docker mysql container
# 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
@leeovery
leeovery / machine.js
Last active August 27, 2020 18:13
Generated by XState Viz: https://xstate.js.org/viz
const fetchMachine = Machine({
id: 'fetch',
initial: 'ready',
context: {},
states: {
ready: {
invoke: [{
src: 'listenForRecipientTyping',
@leeovery
leeovery / machine.js
Last active August 26, 2020 18:40
Generated by XState Viz: https://xstate.js.org/viz
const fetchMachine = Machine({
id: 'fetch',
initial: 'ready',
context: {
retries: 0
},
states: {
ready: {
invoke: {
src: 'listenForTypingOnChannel',
@leeovery
leeovery / logMachineTransitions.js
Last active July 20, 2022 20:05
xstate console logger
import typeOf from 'just-typeof';
const colors = {
heading: '#86c0d1',
title: '#80a0c2',
subtitle: '#a2bf8a',
body: '#d8dee9',
};
const styles = {
@leeovery
leeovery / machine.js
Last active August 3, 2020 12:10
Generated by XState Viz: https://xstate.js.org/viz
const YapsMachine = Machine({
id: 'yap',
initial: 'unknown',
context: {
Yap: {
id: 123,
status: {
description: 'New'
}
},
@leeovery
leeovery / machine.js
Last active July 25, 2020 10:18
Generated by XState Viz: https://xstate.js.org/viz
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: {