Skip to content

Instantly share code, notes, and snippets.

@tonjohn
tonjohn / stitchrowcounter_day1.swift
Last active November 22, 2021 22:21
Spending an hour a day during this holiday week working on a stitch row counter for Apple Watch Yarn. https://twitter.com/sptonjohn/status/1462907328596832259
import SwiftUI
struct ContentView: View {
@State var stepperValue: Float = 0
var body: some View {
VStack {
Text("knittings cool")
.padding()
@tonjohn
tonjohn / nuxtify.js
Created April 27, 2020 21:17
Convert html files to Nuxt .vue files
let vTemplate = "";
let vScript = "";
let vStyle = "";
const path = require("path");
const PATH_READ = path.join(__dirname, "../classic");
const PATH_WRITE = path.join(__dirname, "../dist/");
const fs = require("fs");
@tonjohn
tonjohn / pokemon_api.js
Created May 12, 2017 19:14
Example Pokemon API using localStorage as a cache
const ENABLE_CACHE = true;
const API_URL = "http://pokeapi.co/api/v2/pokemon/"; // URL to Pokemon API that fetches list of pokemon
const COUNT_ORIGINAL_POKEMON = 151; // we only care about the original 151 Pokemon
const POKEMON_IMG_URL = "http://pokeapi.co/media/img/"; // http://pokeapi.co/media/img/1.png
var g_rgPokemon = []; // global array of pokemon
window.onload = function() {
if (!window.jQuery) {