Skip to content

Instantly share code, notes, and snippets.

John Rees johnrees

Block or report user

Report or block johnrees

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View out.json
This file has been truncated, but you can view the full file.
{
"id": "90550b42-8947-4f45-920a-210b8d817a22",
"name": "Root",
"nodes": {
"d7893039-e30e-40b1-a3ac-9ec491435b3c": {
"text": "My postcode is ",
"$t": 100
},
"34637287-ffb6-473d-ab5d-e8bcb7e4fd4e": {
View out.json
This file has been truncated, but you can view the full file.
{
"id": "2109c415-69f7-466e-bfec-1ce01cd6cb7a",
"name": "Root",
"nodes": {
"7af9ea3e-acc9-4467-a6c2-f0560b3a6352": {
"text": "My postcode is ",
"$t": 1000
},
"ee2bc065-6f48-415f-b02d-454f091bc9e2": {
@johnrees
johnrees / parse.ts
Created Dec 2, 2019
ts-morph ts-simple-ast
View parse.ts
// https://ts-ast-viewer.com/#code/GYVwdgxgLglg9mABACwKYBt1wBRgIYC2qAXIgM5QBOMYA5gDSJ5hxRqWIC8iA5GpnB4BKUhWp1EAbwBQiRJVRQQlJAAN+WRABJJ+IgF9VAbmn6gA
import { Project, SyntaxKind } from "ts-morph";
const project = new Project({});
project.addExistingSourceFiles("./src/thing.ts");
const node = project.getSourceFileOrThrow("./src/thing.ts");
const result = node.forEachDescendant((node, traversal) => {
@johnrees
johnrees / a11y.js
Created Nov 29, 2019
js to make cargocollective a bit more accessibility friendly
View a11y.js
try {
// add img alt tags using filename
document.addEventListener(
"DOMContentLoaded",
function() {
[...document.getElementsByTagName("img")].forEach(i => {
i.alt = i.src
.split("/")
.pop()
.split(".")
@johnrees
johnrees / duckling.sh
Created Oct 2, 2019
install duckling
View duckling.sh
adduser ducklinguser --ingroup admin
su ducklinguser
cd
echo "export PATH=$PATH:~/.local/bin" >> ~/.bashrc
source ~/.bashrc
git clone https://github.com/facebook/duckling
cd duckling
sudo apt-get update -y
sudo apt-get install build-essential libpcre++-dev libpcre3-dev -y
stack build && stack test && stack install
View ThemeDecorator.tsx
import { createMuiTheme } from "@material-ui/core";
import red from "@material-ui/core/colors/red";
import ThemeProvider from "@material-ui/styles/ThemeProvider";
import React from "react";
const themes = {
default: createMuiTheme({}),
red: createMuiTheme({
palette: {
primary: red
View out.json
{"id":"3524079e-02f9-4214-8c3e-6d6b8741a96c","name":"Root","nodes":{"-Ln9m-3BNT4_S--4-EFY":{"text":"My postcode is ","$t":100},"-Ln9m-3BNT4_S--4-EFZ":{"text":"The address of my property is ","$t":100},"-Ln9m-3BNT4_S--4-EF_":{"text":"I want to","$t":100},"-Ln9m-3BNT4_S--4-EFa":{"text":"modify or extend","$t":200},"-Ln9m-3BNT4_S--4-EFb":{"text":"The property is","$t":100,"val":"property.buildingType"},"-Ln9m-3BNT4_S--4-EFc":{"text":"a detached house","$t":200,"val":"houseDetached"},"-Ln9m-3BNT4_S--4-EFd":{"text":"House triage","$t":300},"-Ln9m-3BNT4_S--4-EFe":{"text":"a semi detached house","$t":200,"val":"houseSemiDetached"},"-Ln9m-3BNT4_S--4-EFf":{"text":"a terraced house","$t":200,"val":"houseTerrace"},"-Ln9m-3BNT4_S--4-EFg":{"text":"a flat","$t":200,"val":"flat"},"-Ln9m-3BNT4_S--4-EFh":{"text":"I want to","$t":100,"info":"Adding an extension or an outbuilding to a flat (even if it is located on the ground floor, or has a roof terrace) will require planning permission."},"-Ln9m-3BNT4_S--4-EFi":{"text":"exten
View out.json
{"id":"f300cfe7-6d43-4607-ab25-065972c3e768","name":"Root","nodes":{"-LmyO78dZpe5KrnaxUr_":{"text":"My postcode is ","$t":100},"-LmyO78dZpe5KrnaxUra":{"text":"The address of my property is ","$t":100},"-LmyO78dZpe5KrnaxUrb":{"text":"I want to","$t":100},"-LmyO78dZpe5KrnaxUrc":{"text":"modify or extend","$t":200},"-LmyO78eMEDBjXejcQk7":{"text":"The property is","$t":100},"-LmyO78eMEDBjXejcQk8":{"text":"a detached house","$t":200},"-LmyO78eMEDBjXejcQk9":{"text":"House triage","$t":300},"-LmyO78eMEDBjXejcQkA":{"text":"a semi detached house","$t":200},"-LmyO78eMEDBjXejcQkB":{"text":"a terraced house","$t":200},"-LmyO78eMEDBjXejcQkC":{"text":"a flat","$t":200},"-LmyO78eMEDBjXejcQkD":{"text":"I want to","$t":100},"-LmyO78eMEDBjXejcQkE":{"text":"extend","$t":200,"flag":"EDGE_CASE"},"-LmyO78eMEDBjXejcQkF":{"text":"build an outbuilding","$t":200,"flag":"EDGE_CASE"},"-LmyO78eMEDBjXejcQkG":{"text":"make alterations","$t":200},"-LmyO78eMEDBjXejcQkH":{"text":"Alterations Triage","$t":300},"-LmyO78eMEDBjXejcQkI":{"text":"a
View parsegitmodules.js
const fs = require("fs");
const file = fs.readFileSync(".gitmodules").toString();
function parseGitModules(data, _callback) {
var gitModules = data.split("["),
subModulesCollections = [];
gitModules.forEach(function(submodules) {
if (/^submodule*/.test(submodules)) {
View README
Actions {
:branch
:create_node
:update_node
:remove_node
:create_edge
:remove_edge
}
Action.create(type, actor, at, payload)
You can’t perform that action at this time.