Skip to content

Instantly share code, notes, and snippets.

View janbaykara's full-sized avatar
🌗
Fighting the general election of everyday life

Jan Baykara janbaykara

🌗
Fighting the general election of everyday life
View GitHub Profile
@janbaykara
janbaykara / actionnetwork.ts
Last active February 26, 2024 14:39
Action Network ORM for Typescript
import fetch, { RequestInfo, RequestInit, Response } from 'node-fetch'
import {merge} from 'lodash'
import { BuilderFunc, ODataFilterBuilder } from 'ts-odata-filter'
import * as queryString from 'query-string'
import { Person, PersonSignupHelper } from '@civix/osdi-types';
const crytalise = (init: RequestInit) => {
if (init.body) {
init.body = JSON.stringify(init.body)
}
@janbaykara
janbaykara / ingest_third_party_survey_responses.js
Created January 20, 2023 11:56
LRU airtable integrations
const inputConfig = input.config()
const petitionsTable = base.getTable("Organic Campaign Events")
const newRecord = await petitionsTable.selectRecordAsync(inputConfig.id)
const membersTable = base.getTable('Members & Contacts')
const members = await membersTable.selectRecordsAsync({
fields: [ "Email address", "Phone number", "Postcode", "Name", "First name", "Second name" ]
})
if (newRecord) {
output.set("petitionRecordID", `id: ${inputConfig.id}`)
@janbaykara
janbaykara / README.md
Created October 11, 2022 00:16
Script to prepare Notion markdown pages for Logseq
  • Install github.com/andreoliwa/logseq-doctor
  • Load markdown files into a folder
  • Then run:
    mkdir node
    mkdir lsd
    node index
    cd node
    for f in ./*.md; do echo $f & lsd outline $f > ../lsd/$f; done
@janbaykara
janbaykara / 1-table-contacts.png
Last active March 29, 2022 16:42
London Renters Union airtable setup. Airtable automation that will receive a webhook, create an event for it, and link it to an existing person in another table.
1-table-contacts.png
@janbaykara
janbaykara / .block
Last active August 24, 2020 14:36 — forked from tomshanley/.block
Sankey with circular link and animated dashes
license: mit
height: 800
@janbaykara
janbaykara / .block
Created August 24, 2020 11:44 — forked from tomshanley/.block
Sankey in the style of 1960s river freight chart
license: mit
height: 800
border: yes
@janbaykara
janbaykara / metomic.ts
Created July 15, 2020 16:13
A helper minilibrary for working with Metomic consent policies
export const ensureConsentFor = async (slug: string, askAgain = true) => {
const state = await getConsentState(slug)
if (state === true) return true
if (!askAgain) return false
return await requestConsentFor(slug)
}
enum State {
CONSENTED = 'CONSENTED',
DECLINED = 'DECLINED'
@janbaykara
janbaykara / env.ts
Created July 15, 2020 14:53
Typescript version of Strapi's env mini-library
'use strict';
import { EnvVars } from './types';
// Taken from https://github.com/strapi/strapi/blob/c90e3eb67bf2c235c2fdd1b5607eda6b649d9f10/packages/strapi/lib/core/app-configuration/env-helper.js
const _ = require('lodash');
type Translator<T = any> = (key: keyof EnvVars, defaultValue?: T) => T
const defaultEnv: Translator = (key, defaultValue) => {
@janbaykara
janbaykara / example.ts
Last active June 8, 2020 15:03
Postcodes.io API batch consumer
(async () => {
const postcodeQueries = await bulk_postcode_geo(data.map(d => d.postcode).filter(Boolean))
})()

Keybase proof

I hereby claim:

  • I am janbaykara on github.
  • I am janbaykara (https://keybase.io/janbaykara) on keybase.
  • I have a public key ASAEEjeLxsryXSDQ1n1bRHiAQOaXX3TttDrjk9_a1MJU4wo

To claim this, I am signing this object: