Skip to content

Instantly share code, notes, and snippets.

View bushidocodes's full-sized avatar

Sean McBride bushidocodes

View GitHub Profile
@bushidocodes
bushidocodes / Installing Postgres on WSL.md
Last active May 10, 2021 08:43
Installing Postgres on WSL.md

When I went through Eliot's excellent tutorial, I decided to try to push forward with the latest-and-greatest version of Postgres to troubleshoot the directions with the newer version (the 64-bit Version 9.6.1.1 x64 Windows installer).

But first I had cleanup to do. I had mistakenly assumed that I was running postgresql under WSL and installed some packages. I removed them to make sure I didn't end up with collisions over Linux and Windows binaries sharing the same name in $PATH.

➜  ~ sudo apt-get remove postgresql
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED:
@bushidocodes
bushidocodes / wasm-summit-2020-notes.md
Last active July 30, 2020 23:47
WebAssembly Summit 2020 Notes

WebAssembly Summit 2020

https://webassembly-summit.org/

Lin Clark's Talk - "WebAssembly Nanoprocess"

https://www.youtube.com/watch?v=IBZFJzGnBoU

  • the missing functionality alongside WASI and Interface Types is something that provides "capability-based security".
  • Delegation of permissions to propagate down transitive dependencies
  • plan to use fine-grain form of per-module virtualization
  • A "WebAssembly nanoprocess" is just wasm, but follows a particular pattern.
@bushidocodes
bushidocodes / mcbride-profiles.json
Last active July 3, 2019 17:46
My Microsoft Terminal Profiles.
{
"globals": {
"alwaysShowTabs": true,
"defaultProfile": "{7f586916-8357-53d4-bb2b-ca96f639898a}",
"initialCols": 120,
"initialRows": 30,
"keybindings": [
{
"command": "closeTab",
"keys": ["ctrl+w"]
**** **** ______ _ _
****** ****** | _ \ (_) | |
**** **** | | | | ___ ___ _ _ __ | |__ ___ _ __
| | | | / _ \ / __|| || '_ \ | '_ \ / _ \| '__|
**** | |/ / | __/| (__ | || |_) || | | || __/| |
****** |___/ \___| \___||_|| .__/ |_| |_| \___||_|
**** | |
|_|

Why does GraphQL exist?

  • Difficult to scale REST-ful conventions out to nested sets of data.
  • When dealing with normalized data, retrieving state likely ends up requiring multiple HTTP requests.
  • Usuallys returns all data associated with a particular model, even if the consumer doesn't need this data.

Tradeoffs with REST

  • Follow RESTful conventions strictly, issue multiple HTTP requests, and force the consumer to compose the data together
  • Develop more sophisticated backend routes that nest using RESTful conventions, simplifying the API for the consumer but increasing backend complexity
  • Abandon RESTful conventions and create a custom routes that feeds the precise need by a particular application use case
@bushidocodes
bushidocodes / restoreLocalStorage.md
Created September 11, 2017 19:24
To Restore Local Storage
  1. In index.js, uncomment window.localStorageWorker
  2. In store.js, uncomment the lodash and getState imports, delete the dashboard JSON imports, uncomment the localStorage effects, and delete "loadDashboardsFromJSON"
  3. In Container, uncomment out the localStorage code and delete the call to Actions.loadDashboardsFromJSON
  4. In GMGrid, uncomment the code in updateDashboardLayout
  5. In SettingsGrid, uncomment the LayoutSection with the reset dashboards functionality.
@bushidocodes
bushidocodes / basicReduxPromise.js
Last active September 10, 2017 23:22
Basic reimplementation of promise middleware for Redux
// middlewares/async.js
export default function({ dispatch }) {
return next => action => {
// Check if a thenable
if (action.payload.then) {
// If a thenable, don't call next until the promsie resolves
action.payload = action.payload.then(res => {
action = { ...action, payload: res.data };
next(action);
});
@bushidocodes
bushidocodes / recursiveGeneratorTree.js
Created September 10, 2017 20:47
Use Recursive Iterators to use a for...of on a tree data structure
// goal: Use generators to iterate through a tree
// Create a class that has children and an iterator that recurses over the children
class Node {
constructor(value, children) {
this.value = value;
this.children = children;
}
*[Symbol.iterator]() {
@bushidocodes
bushidocodes / expressive-text.scss
Created September 1, 2017 15:33
Saving Stuart's Expressive Text work for future reference.
// components/expressive-text.scss
@import '../variables.scss';
@import '../mixins.scss';
// Local Variables
$colors-default: $colors-datarange-bad-to-good;
$precision-default: 24;
$steps-default: gradient;
// Helpers
// Note:  Unused Experimental Component
// Requires Victory and d3- shape

import React from "react";
import { PropTypes } from "prop-types";
import {
  VictoryAxis,
  VictoryBrushContainer,
  VictoryChart,