Skip to content

Instantly share code, notes, and snippets.

View josephjclark's full-sized avatar

Joe Clark josephjclark

View GitHub Profile
#FROM node:22-alpine AS base # <- We use alpine!
FROM node:22-bookworm-slim
ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
RUN corepack enable
COPY . /app
WORKDIR /app
@josephjclark
josephjclark / gen_volunteers.js
Created January 23, 2025 17:50
Volunteering Data
/**
* To run this file:
* - Install bun.js
* - Run `bun gen_volunteers.js`
*/
import { randomUUID } from "node:crypto";
import { faker } from "@faker-js/faker";
const sectors = [
"healthcare",
@josephjclark
josephjclark / dhis2_target.json
Created November 13, 2024 09:27
DHIS2 tracker
{
"trackedEntities": [
{
"enrollments": [
{
"attributes": [
{
"attribute": "zDhUuAYrxNC",
"displayName": "Last name",
"value": "Kelly"
@josephjclark
josephjclark / cht-reg.json
Created November 13, 2024 09:25
CHT Registration Event
{
"_id": "b33dbbc9-fb80-4477-984f-e5f8b552d4cb",
"_rev": "1-1996c70d1124e60ff781da6d0a17ddcc",
"form": "almanach_somaliav3",
"type": "data_record",
"content_type": "xml",
"reported_date": 1731058479142,
"contact": {
"_id": "94ed12a8-8052-4bff-b5d7-cf6c00d337f8",
"parent": {
// Parse CSV from string
joe,you_wish
// CSV parse can parse items as an array or object, subject to options
// String -> JSON
http.get('data.csv', (state) => { ..state, csvString: state.data })
parseCSV(state.csvString, { /* options */ }) // pass data as string (write an array of items to state.data)
each(state.data, (state) => {
combine(
// Step 1: find the user id for a given user name
get(
`https://api.twitter.com/2/users/by/username/${state.configuration.user_name}`,
{
headers: {
'Authorization': `Bearer ${state.configuration.key}`,
},
},
state => {