Skip to content

Instantly share code, notes, and snippets.

View witt3rd's full-sized avatar
⌨️
coding

Donald Thompson witt3rd

⌨️
coding
View GitHub Profile

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):
// --- 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;
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;

Meta

Meta is a NodeJS-based shell command that provides a solution to working with many repos across machines/teams without the tradeoffs involved with submodules or monorepos.

Install

npm i -g meta

Create a new meta repo

mkdir my-meta-repo
cd my-meta-repo
@witt3rd
witt3rd / utils.js
Last active June 13, 2019 15:23
Useful code snippets in JavaScript
const fs = require("fs-extra");
const Path = require("path");
//
// String utilities
//
// Ensure initial letter is capitalized
const capitalize = word => word[0].toUpperCase() + word.substr(1);

Maana Q + Semantic Web/Linked Data

At the center of the Maana Q Knowledge Platform is the Computational Knowledge Graph, which consists of a cloud distributed set of GraphQL and RESTful microservices. Each service exposes a set of types and functions. The functions can be evaluated lazily (i.e., streaming) or strict/eager (i.e., batch) and can be marked as having pure (i.e., referential integrity) vs effectful (i.e., causes change or relies on changing externals) semantics.

The purpose of this system is to represent domain knowledge (i.e., concepts, properties, relations, individuals) and perform reasoning (i.e., operations performed on the domain to achieve various goals). This is similar in nature to the goals of the Semantic Web, which aims to unify:

  • Linking data
  • Organizing data into "ontologies"
  • Querying data
  • Logical inference (e.g., deduction, induction)

While the goals are similar, the underlying

@witt3rd
witt3rd / rename_a_mac.md
Created September 13, 2020 12:36
really rename a mac
export MY_NAME="MyName"
sudo scutil --set ComputerName "$MY_NAME" && \
sudo scutil --set HostName "$MY_NAME" && \
sudo scutil --set LocalHostName "$MY_NAME" && \
sudo defaults write /Library/Preferences/SystemConfiguration/com.apple.smb.server NetBIOSName -string "$MY_NAME"
@witt3rd
witt3rd / Idris.md
Last active September 13, 2020 16:02
Idris and Idris2 setup

Idris

Install

macOS

brew install idris
@witt3rd
witt3rd / Neovim.md
Last active September 13, 2020 16:02
Neovim setup

Neovim

brew install neovim
mkdir ~/.config/nvim
touch ~/.config/nvim/init.vim
cd ~/.config/nvim
curl -fLo ~/.config/nvim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim

You should now have plug.vim in your autoload directory so it will load of on start.

@witt3rd
witt3rd / live-coding-setup.md
Last active September 13, 2020 16:04
Live coding setup

Live Coding Setup

Here is a list of tools and gear I use to make YouTube videos for coding. I will try to keep it up-to-date as I evolve and get better at producing content. Leave a comment, if you have suggestions!

Windows 10

I use both Mac and Windows, but I am currently doing all the capture and production on Windows. For coding, I find the Linux shell much better than PowerShell or the Windows Command Prompt.

Development Environment