Skip to content

Instantly share code, notes, and snippets.

View witt3rd's full-sized avatar
😎
vibing

Donald Thompson witt3rd

😎
vibing
View GitHub Profile
const fs = require('fs');
const mkdirp = require('mkdirp');
const path = require('path');
const request = require('request');
const url = require('url');
const downloadFile = async (file, targetFolder) => {
// Parse remote file spec
const sourceUrl = url.parse(file.url ? file.url.id : file.id);
const sourceHref = sourceUrl.href;
// --- Object path operations
export const objGetPathList = ({ path }) => {
let pathList;
if (Array.isArray(path)) {
pathList = path;
} else if (typeof path === "string") {
pathList = path.split("/");
}
return pathList;

Ingesting Hierarchical Data

This will work for any model that you hook it up to, you just need to define the types in your service schema.

As it’s inspecting the metadata that graphql carries with each query to figure out which fields correspond to what type to construct the mutations (and the types have to be the same as those in the model in Q) because it assumes the boilerplate will look like:

def create_mutation_singular(type):
@witt3rd
witt3rd / linux.md
Last active October 13, 2020 20:43

Linux

Apt

Repair

sudo apt-get -o Dpkg::Options::="--force-overwrite" install --fix-broken
@witt3rd
witt3rd / Hask(Cat).md
Last active December 4, 2018 11:46
Categories in Haskell

Hask(Cat)

{-# LANGUAGE TypeOperators #-}
 
infix 9 
class Category k where
  ident :: a `k` a
  (∘) :: (b `k` c) -> (a `k` b) -> (a `k` c)
 

Rust

Install

curl https://sh.rustup.rs -sSf | sh
(async () => {
// -- Generic collection helpers
// get the (arbitrary) first element of an (unordered) set
function carSet<T>(set: Set<T>): T | undefined {
return set.entries().next().value[0]
}
// a Hash Set is a mapping from keys to sets
function consHSet<K, V>(hset: Map<K, Set<V>>, k: K, v: V): void {

Category Theory

Data

  • Objects
  • Arrows
    • Source object
    • Target object
  • Rules
    • Identity
  • Arrow where source = target

PureScript

Install

Ubuntu

sudo npm install -g purescript --unsafe-perm=true