Skip to content

Instantly share code, notes, and snippets.

View tbaggaley's full-sized avatar
🐧

Tom Baggaley tbaggaley

🐧
View GitHub Profile
@tbaggaley
tbaggaley / App.tsx
Created January 26, 2022 10:13
Demo keyboard app for Omid
import React, { useCallback, useEffect, useState } from "react";
import "./App.css";
const keyboard = ["qwertyuiop", "asdfghjkl", "zxcvbnm"];
export default function App() {
const [keysDown, setKeysDown] = useState<Record<string, boolean>>({});
const handleKeyDown = useCallback(
({ key }: { key: string }) => setKeysDown(old => ({ ...old, [key]: true })),
@tbaggaley
tbaggaley / suspect-labels.txt
Created May 18, 2021 09:51
List o' labels with no referenced input
components/ContentPickerv2/Options.js:110: <OptionLabelText>{children}</OptionLabelText>
components/ContentPickerv2/Options.js:134: <OptionsLabel>Browse by</OptionsLabel>
components/preview/Answers/AnswerTrailingUnit.js:20: <Label description={answer.description}>{answer.label}</Label>
components/preview/Answers/DurationAnswer.js:23: <Label description={answer.description}>{answer.label}</Label>
components/preview/Answers/DurationAnswer.js:43: <Label description={answer.description}>{answer.label}</Label>
components/preview/Answers/TextAreaAnswer.js:13: <Label description={answer.description}>{answer.label}</Label>
components/preview/Answers/DateAnswer.js:69: <Label description={description}>{label}</Label>
components/preview/Answers/DateAnswer.js:73: <DateFieldLabel>Day</DateFieldLabel>
components/preview/Answers/DateAnswer.js:80: <DateFieldLabel>Month</DateFieldLabel>
components/preview/Answers/DateAnswer.js:88: <DateFieldLabel>Year</DateFieldLabel>
@tbaggaley
tbaggaley / gist:770ca64e43a710ee573d8dcf14fadef9
Created April 8, 2021 18:11
Runner cross-group calc sum crash
eq-survey-runner_1 | [error ] an error has occurred ce_id=5f9ce1b8-8cd1-4a28-80a4-e26417c61172 created=2021-04-08T18:02:30.289809Z eq_id=0 form_type=bbreak request_id=34f37dd6-87b2-45f4-86e9-94454108d8eb service=eq-survey-runner status_code=500 tx_id=c92ded87-191a-4162-a61d-d74bda1d9652 url=http://localhost:5000/questionnaire/0/bbreak/5f9ce1b8-8cd1-4a28-80a4-e26417c61172/group5de74705-337c-4bc3-965c-d3cc54dd61a5/0/block6d92abae-67a5-41c8-9837-f929b30d0131
eq-survey-runner_1 | Traceback (most recent call last):
eq-survey-runner_1 | File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1949, in full_dispatch_request
eq-survey-runner_1 | rv = self.dispatch_request()
eq-survey-runner_1 | File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1935, in dispatch_request
eq-survey-runner_1 | return self.view_functions[rule.endpoint](**req.view_args)
eq-survey-runner_1 | File "/usr/local/lib/python3.7/site-packages/flask_login/utils.py", line 261, in
@tbaggaley
tbaggaley / import-survey.js
Last active November 23, 2020 16:08
Import a survey bookmarklet
// Import a survey bookmarklet
// 1. Create a new bookmark (e.g. with title "Import survey") with the following as the URL:
// javascript:(function()%7Bdocument.write(%60%0A%3Ch1%3ESurvey%20import%20tool%3C%2Fh1%3E%0A%3Ch3%3E%201.%20Enter%20URL%20to%20the%20questionnaire%20you'd%20like%20to%20import%3A%20%3C%2Fh3%3E%0A%3Cinput%20type%3D%22text%22%20id%3D%22url%22%20style%3D%22width%3A%2033%25%22%3E%0A%3Ch3%3E%202.%20Open%20the%20following%20URL%20and%20copy%20the%20contents%20to%20your%20clipboard%3A%20%3C%2Fh3%3E%0A%3Cspan%20id%3D%22exportURL%22%3E%20Enter%20a%20questionnaire%20URL%20above%20to%20see%20the%20export%20URL%20%3C%2Fspan%3E%0A%3Ch3%3E%203.%20Paste%20the%20contents%20in%20the%20box%20below%20%3C%2Fh3%3E%0A%3Ctextarea%20id%3D'schema'%20style%3D'width%3A50%25%3B%20height%3A33%25'%3E%3C%2Ftextarea%3E%0A%3Ch3%3E%204.%20Hit%20the%20button%20to%20import%20the%20survey%20and%20open%20it%20for%20viewing%20%3C%2Fh3%3E%0A%3Cbutton%20id%3D%22importButton%22%3EImport%20survey%3C%2Fbutton%3E%0A%60)%3B%0A%0Ad
#!/bin/bash
# Script to spin up all 4 local dev servers for Author / Publisher v2 / Runner / Author API
# Put this in parent folder of eq-author-app and eq-survey-runner
# Auto-install tmux if you don't have it already
if ! command -v tmux
then
echo "Installing tmux..."
brew install tmux
fi
#!/bin/bash
# A wrapper script managing node version (since prettier requires v > 10)
# Formats JSON schemas in data directory using prettier's default settings
# Load nvm shell function
source ~/.nvm/nvm.sh
# Strip yarn's node version from PATH - it obscures NVMs
# Workaround taken from https://github.com/yarnpkg/yarn/issues/7195#issuecomment-482739265
NEW_PATH=$(echo "$PATH" | sed -e "s/\\/tmp\\/yarn\d*-[^\:]*://g")
@tbaggaley
tbaggaley / start-development-servers.sh
Created September 17, 2020 12:33
Bash script to start up local dev servers: publisher, eq-author and eq-author-api using three tmux panes.
#!/bin/bash
tmux new-session -s author -d
tmux select-pane -T eq-publisher
tmux send-keys "cd eq-publisher; docker-compose up" Enter
tmux split-window -v
tmux select-pane -T eq-author
tmux send-keys "bash" Enter
tmux send-keys "cd eq-author; nvm use 10; yarn start" Enter