Skip to content

Instantly share code, notes, and snippets.

View samholmes's full-sized avatar

Sam Holmes samholmes

View GitHub Profile
@samholmes
samholmes / keybindings.json
Last active October 28, 2020 16:19
VS Code User Keybindings
// Place your key bindings in this file to overwrite the defaults
[
{
"key": "ctrl+shift+\\",
"command": "editor.action.selectToBracket"
},
{
"key": "ctrl+\\",
"command": "editor.action.jumpToBracket",
"when": "editorTextFocus"
@samholmes
samholmes / Material.terminal
Last active October 28, 2020 15:30
Material Theme for Terminal
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>ANSIBlueColor</key>
<data>
YnBsaXN0MDDUAQIDBAUGBwpYJHZlcnNpb25ZJGFyY2hpdmVyVCR0b3BYJG9iamVjdHMS
AAGGoF8QD05TS2V5ZWRBcmNoaXZlctEICVRyb290gAGjCwwTVSRudWxs0w0ODxARElVO
U1JHQlxOU0NvbG9yU3BhY2VWJGNsYXNzTxAcMC41MDk4MDM5MjE2IDAuNjY2NjY2NjY2
NyAxABACgALSFBUWF1okY2xhc3NuYW1lWCRjbGFzc2VzV05TQ29sb3KiFhhYTlNPYmpl
/*
To avoid a lot of conditional checks on all consumer components,
what if we had a hook to conditionally render from a context's data?
*/
// I wonder if this will work. Totally untested, but it's a concept.
function ConsumerComponent() {
const data = useContext(SomeContext);
@samholmes
samholmes / post.md
Last active April 16, 2020 22:27
Discussion on how to write a parallel asynchronous routine using plain, vanilla JS.

Parallel Async Patterns in Vanilla JS

function routine(){
    var counter = 3;
    
    asyncThing(function(){
        // Do stuff
        
        done();
@samholmes
samholmes / iron-todomvc.html
Created March 23, 2020 00:18
IronJS TodoMVC
<!DOCTYPE html>
<html lang="en" data-framework="ironjs">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>IronJS • TodoMVC</title>
<link rel="stylesheet" href="https://unpkg.com/todomvc-common/base.css" />
<link rel="stylesheet" href="https://unpkg.com/todomvc-app-css/index.css" />
</head>
@samholmes
samholmes / settings.json
Last active February 25, 2020 19:25
VS Code User Settings
// Place your settings in this file to overwrite the default settings
{
"terminal.integrated.shellArgs.osx": [
"-l"
],
"workbench.iconTheme": "eq-material-theme-icons",
"workbench.colorTheme": "Material Theme High Contrast",
"editor.minimap.enabled": true,
"editor.rulers": [
75,
@samholmes
samholmes / javascript.json
Last active February 25, 2020 19:14
VS Code Snippets
{
"Arrow Function": {
"prefix": "af",
"body": ["(${1}) => ${2:{${0}\\}}"],
"description": "Creates a ES6 arrow function."
},
"Anonymous Function": {
"prefix": "fun",
"body": ["function(${1}) {\n\t${0}\n}"],
"description": "Creates an anonymous function."
@samholmes
samholmes / .prettierrc
Created February 25, 2020 16:06
Preferred Standard Formatting
{
"semi": false,
"useTabs": true,
"singleQuote": true,
"trailingComma": "es5"
}

Keybase proof

I hereby claim:

  • I am samholmes on github.
  • I am samuelholmes (https://keybase.io/samuelholmes) on keybase.
  • I have a public key ASBktmOfBDhauAEOLQGe3gG2G2BC3QNcr9TuZR98hkzLUgo

To claim this, I am signing this object:

@samholmes
samholmes / mapActionToReducer.js
Last active November 4, 2019 22:48
An example for a helper function to write clean reducers.
// Rather than this
function reducer(state, action) {
switch (action.type) {
case 'TODO_ADD': {
return applyAddTodo(state, action)
}
case 'TODO_TOGGLE': {
return applyToggleTodo(state, action)
}
default: