Skip to content

Instantly share code, notes, and snippets.

View signalwerk's full-sized avatar
💫
on the r͢oad

Stefan Huber signalwerk

💫
on the r͢oad
View GitHub Profile
@BLamy
BLamy / NFLScoresPrompt.ts
Last active June 15, 2023 23:07
An Example of file that functions as both a typescript module and a GPT4 prompt.
// You will function as a JSON api.
// The user will feed you valid JSON and you will return valid JSON, do not add any extra characters to the output that would make your output invalid JSON.
// The end of this system message will contain a typescript file that exports 5 types:
// Prompt - String literal will use double curly braces to denote a variable.
// Input - The data the user feeds you must strictly match this type.
// Output - The data you return to the user must strictly match this type.
// Errors - A union type that you will classify any errors you encounter into.
// Tools - If you do not know the answer, Do not make anything up, Use a tool. To use a tool pick one from the Tools union and print a valid json object in that format.
@RobertAKARobin
RobertAKARobin / safari.md
Last active July 8, 2024 11:29
Safari's date-picker is the cause of 1/3 of our customer support issues

Safari's date-picker is the cause of 1/3 of our customer support issues

...and obviously we're building a workaround. But I'm absolutely flabbergasted that a standard <input type="date"> HTML field, in a standard browser, from a company that bases its reputation good design, could be so dreadful.

The context

I'm the developer for a startup that sells a genetic test to recommend medications for high blood pressure. For medical reasons we need to know our customers' birth date. Most of our customers are in their 60s or older. We've found that many of them use iPads or iPhones. And they're the ones who complain to our customer support that our site is unusable.

The problem

@simoncozens
simoncozens / hands-face-space.ipynb
Last active February 15, 2023 00:39
Hands, Face, Space
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@PierBover
PierBover / index.js
Last active April 30, 2024 09:08
Micro router for Cloudflare Workers
const router = require('./router');
router.setRoutes([
{
path: '/ping',
method: 'GET',
handler: ping
},
{
path: '/hello/:name',
@0x263b
0x263b / colors.md
Last active July 13, 2024 19:15
Random color from string in javascript

Random color from string in javascript

Consider a list of strings you need to permanently assign a random color.

First you should turn the string into a hash.

var string = "string"
var hash = 0
@schickling
schickling / _README.md
Last active January 4, 2024 09:37
Script to import and export docker-machine configurations to sync between hosts/collaborators

docker-machine import/export

Script to import and export docker-machine configurations to sync between hosts/collaborators

Export (on host A)

$ docker-machine ls
NAME       ACTIVE   DRIVER         STATE     URL                            SWARM   DOCKER    ERRORS
dev        -        digitalocean   Running   tcp://example.com:2376                 v1.10.1
@bahmutov
bahmutov / README.md
Last active October 4, 2023 08:35
Single command to run Node with local file access

Goal: run a simple NodeJS application inside a Docker container

Subgoal: give it access to local files.

docker run -it --rm --name example -v "$PWD":/usr/src/app -w /usr/src/app node:5-slim node index.js

output:

@Pengeszikra
Pengeszikra / objectwalk.js
Last active November 8, 2022 05:28
ES6 object tree walk generator
/* # use >> for( node of Object.walk( yourObject )) console.log( node )
# or more >>
let walk=[]; for( node of Object.walk( yourObject , o => isHaveRoutes( o ) ) ) if(isProperWay(node)) walk.push( node )
# recursive generator for Object, avoide circular structure by set.
*/
@domenic
domenic / 0-github-actions.md
Last active May 26, 2024 07:43
Auto-deploying built products to gh-pages with Travis

Auto-deploying built products to gh-pages with GitHub Actions

This is a set up for projects which want to check in only their source files, but have their gh-pages branch automatically updated with some compiled output every time they push.

A file below this one contains the steps for doing this with Travis CI. However, these days I recommend GitHub Actions, for the following reasons:

  • It is much easier and requires less steps, because you are already authenticated with GitHub, so you don't need to share secret keys across services like you do when coordinate Travis CI and GitHub.
  • It is free, with no quotas.
  • Anecdotally, builds are much faster with GitHub Actions than with Travis CI, especially in terms of time spent waiting for a builder.
@thomasfr
thomasfr / warmly.sh
Last active October 12, 2023 06:17
A wget based easy poor man`s cache warmer script
#!/bin/bash
# warmly.sh
# A wget based, easy, poor man`s cache warmer script
# https://gist.github.com/thomasfr/7926314
# The MIT License (MIT)
#
# Copyright (c) 2013,2014 Thomas Fritz <fritztho@gmail.com> (http://fritzthomas.com)
#