Skip to content

Instantly share code, notes, and snippets.


Zander Martineau mrmartineau

View GitHub Profile
prologic /
Last active Apr 21, 2021
Learn Go in ~5mins
ityonemo /
Last active Apr 21, 2021
Zig in 30 minutes

A half-hour to learn Zig

This is inspired by


the command zig run my_code.zig will compile and immediately run your Zig program. Each of these cells contains a zig program that you can try to run (some of them contain compile-time errors that you can comment out to play with)

JamieCurnow / firestore.ts
Last active Apr 14, 2021
Using Firestore with Typescript
View firestore.ts
* This Gist is part of a medium article - read here:
// import firstore (obviously)
import { firestore } from "firebase-admin"
// Import or define your types
// import { YourType } from '~/@types'
Jack-Works / 2018.js
Last active Apr 9, 2021
cRAzY eSnEXt (*all* proposals mixed in)
View 2018.js
#! Aaaaaaaaaaa this is JS!!!
// This file is mixing all new syntaxes in the proposal in one file without considering syntax conflict or correct runtime semantics
// Enjoy!!!
// Created at Nov 23, 2018
for await(const x of (new A //
|> do { //
case(?) { //
when {val}: class {
sammillner / Forecast
Created Sep 30, 2020
Fivethirtyeight general election forecast
View Forecast
// Variables used by Scriptable.
// These must be at the very top of the file. Do not edit.
const url = ""
const req = new Request(url)
const res = await req.loadJSON()
const Biden = Math.round(res[0].candidates.find(x => x.candidate == "Biden").dates[0].winprob) + "%"
const Trump = Math.round(res[0].candidates.find(x => x.candidate == "Trump").dates[0].winprob) + "%"
mzeryck / mz_invisible_widget.js
Last active Apr 17, 2021
A Scriptable script that creates "invisible" widget backgrounds based on your iOS wallpaper, and then either uses them as a Scriptable widget background or exports to your camera roll.
View mz_invisible_widget.js
// This widget was created by Max Zeryck @mzeryck
You can't add commit messages to gists, so I just want to say thanks to everyone who has used, modified,
and enjoyed this script. This version adds support for the iPhone 12 mini, thanks to arealhen for providing
a screenshot, and mintakka for a temporary solution.
// Widgets are unique based on the name of the script.
const filename = + ".jpg"
marco79cgn / sonos-nowPlaying.js
Last active Jan 28, 2021
A scriptable widget that shows what's playing on SONOS
View sonos-nowPlaying.js
// Variables used by Scriptable.
// These must be at the very top of the file. Do not edit.
// icon-color: cyan; icon-glyph: magic;
// the node sonos http api base url (running on your Pi for example)
let sonosBaseUrl = ""
// optional for cover art: the ip address of one of your Sonos speakers
let sonosPlayerUrl = ""
let param = args.widgetParameter
View scriptable-xkcd-widget.js
const url = ""
const req = new Request(url)
const { img: imgUrl } = await req.loadJSON()
const imgReq = await new Request(imgUrl)
const img = await imgReq.loadImage()
// for development, displays the widget if run
const debug = false;
premek /
Last active Apr 17, 2021
Rename files in linux / bash using mv command without typing the full name two times
# Put this function to your .bashrc file.
# Usage: mv oldfilename
# If you call mv without the second parameter it will prompt you to edit the filename on command line.
# Original mv is called when it's called with more than one argument.
# It's useful when you want to change just a few letters in a long name.
# Also see:
# - imv from renameutils
# - Ctrl-W Ctrl-Y Ctrl-Y (cut last word, paste, paste)
tkrotoff /
Last active Jan 29, 2021
How I structure my tests

File structure

  • src/fooBar.js
  • src/fooBar.html
  • src/fooBar.scss
  • src/fooBar....
  • src/fooBar.test.js => npm run test
  • src/fooBar.test.e2e.js (if I have E2E tests - Puppeteer, Playwright...) => npm run test:e2e

Tests should not be separated from the source code (think autonomous modules).