Skip to content

Instantly share code, notes, and snippets.

View deanacus's full-sized avatar

Dean Harris deanacus

View GitHub Profile
@deanacus
deanacus / index.md
Created October 8, 2019 03:58
General React Hooks Intro Stuffs
const lower = 'abcdefghijklmnopqrstuvwxyz';
const upper = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
const numbers = '0123456780';
const symbols = '!@#$%^&*_+-/~?'
/**
* Generate a password from any number os groups of strings
*
* @example generatePassword([upper, symbols], 26)
*
@deanacus
deanacus / html.json
Created November 3, 2019 09:52
Rough outline of the way I'd structure simple textual content from html to JSON
{
"article": {
"meta": {
"title": "Test Post",
"date": ""
},
"content": [
{
"element": "h1",
"content": ["This is a heading"],
/**
* themeGetObject
*
* Generates an object with a 'get' property for each property on a theme object.
* Each property is a function that returns a value from that theme property.
*
* @param theme The theme to return an object for
*
* @returns {Function}
*
@deanacus
deanacus / functions.js
Created February 10, 2020 05:16
Object Recursion exploration stuff
/**
* A deep clone implementation, with immutability.
*/
const cloneObject = input => {
if (
!Array.isArray(input) &&
Object.getPrototypeOf(input).toString.call(input) !== "[object Object]"
) {
return input;
}
@deanacus
deanacus / functional-pubsub.js
Last active June 22, 2020 03:42
Simple PubSub implementation
const pubSub = () => {
// The core of our pubsub implementation
const subscriptions = {}
// Stupid naive way to generate an ID for each subscription.
// Should really be something more robust, but this is a simple implementation after all
const generateID = () => Math.floor(Math.random() * 100);
// Publish handler. Runs all the callbacks for a given eventName
const publish = (eventName, data) => subscriptions[eventName] && subscriptions[eventName].map(subscription => subscription.callback(...data));
tap "homebrew/bundle"
tap "homebrew/services"
# Formulae
# Clone of cat(1) with syntax highlighting and Git integration
brew "bat"
# Modern, maintained replacement for ls
brew "eza"
# Simple, fast and user-friendly alternative to find
brew "fd"
############################
# Environment Variables
############################
.env*
!.env.example
############################
# Archives
############################
*.7z
{
// Work Bench
"breadcrumbs.enabled": true,
"workbench.colorTheme": "Field Lights",
"workbench.editor.tabSizing": "shrink",
"workbench.sideBar.location": "left",
"workbench.startupEditor": "newUntitledFile",
"workbench.statusBar.visible": true,
"workbench.editor.empty.hint": "hidden",
"workbench.activityBar.location": "top",