Skip to content

Instantly share code, notes, and snippets.

View GirlBossRush's full-sized avatar
Building web apps with OpenAI!

Teffen Ellis GirlBossRush

Building web apps with OpenAI!
View GitHub Profile
[
{
"elementType": "geometry",
"stylers": [
{
"color": "#f5f5f5"
}
]
},
{
@GirlBossRush
GirlBossRush / runtime.md
Created July 21, 2022 21:09
Cloudflare Workers and TransformStream: "The script will never generate a response"

I'm not sure if this a bug per-se, but I encountered a Worker runtime behavior that wasn't reproducible in Miniflare.

tl;dr Using TransformStream will often trigger a runtime error: "The script will never generate a response"


My workers library, Keywork, has a JSXResponse class that accepts some React JSX and returns an instance of Response. This works fine when the JSX is first rendered to a string and then fed to Response's body, since this is really just a convenience wrapper around a few functions:

const app = new WorkerRouter()
@GirlBossRush
GirlBossRush / nonced-promise.ts
Created February 18, 2019 19:42
nonced promise
import id from './generate-id'
export type NoncedEventPayload = {
nonce: string
}
export type ParsedEventPayload = NoncedEventPayload & {
value: string
error: Error | null
}
function swapEntries (array, index, targetIndex) {
const slice = array.slice()
slice.splice(targetIndex, 1, array[index])
slice.splice(index, 1, array[targetIndex])
return slice
}

Back in Rails, old web projects, etc

/src /js search-bar.js /css global.css search-bar.css /templates search-bar.html

@GirlBossRush
GirlBossRush / recursive-file-list.js
Created November 21, 2018 20:36
recursive-file-list
const fs = require('fs')
const {promisify} = require('util')
const path = require('path')
const readdirP = promisify(fs.readdir)
const statP = promisify(fs.stat)
async function recursiveFileList (basePath, callback) {
const filePaths = await readdirP(basePath)
for (filePath of filePaths) {
@GirlBossRush
GirlBossRush / mr-file.js
Last active September 6, 2018 22:59 — forked from larsmqller/mr-file.js
function sendTrackEvent (eventData) {
window.ga('send', Object.assign({hitType: 'event'}, eventData);
}
function trackVideoEvents (videoElement) {
var $videoElement = $(videoElement);
var markers = [.1, .2, .3, .4, .5, .6, .7, .8, .9, 1];
var gaLoggingName = this.dataset.gaLoggingName;
var isTrackingProgress = false
@GirlBossRush
GirlBossRush / hot-dawg.md
Created July 19, 2018 19:14
Is a hotdog a sandwich?

ARTICLE 1: WHETHER A HOT DOG IS A TYPE OF SANDWICH?

OBJECTION 1: It seems as though a hot dog is a type of sandwich. For the term “sandwich” is commonly said of such foods constituted by meat, fish, vegetables, condiments, etc. surrounded on two sides by bread. Now a hot dog is constituted of a sausage made of meat surrounded on two sides by a bun made of bread. Therefore a hot dog is a type of sandwich.

OBJECTION 2: Further, hot dogs are commonly adorned with such toppings and condiments as mustard, ketchup, onions, and cheeses. Now sandwiches are also commonly adorned with the same condiments and toppings. Therefore a hot dog is a type of sandwich.

OBJECTION 3: Further, the Quarterback writes, “They gotta be, right? It's between two pieces of bread,” as does the Sports Anchor, “I would consider anything that you put between two pieces of bread would be considered a sandwich, so I would say technically it absolutely is a sandwich”. Therefore a hot dog is a type of sandwich.

ON THE CONTRARY, it is written

@GirlBossRush
GirlBossRush / keybindings.json
Created March 29, 2018 22:42
keybindings.json
// Place your key bindings in this file to overwrite the defaults
[
{
"key": "cmd+shift+v",
"command": "pasteAndIndent.action",
"when": "editorTextFocus && !editorReadonly"
},
{
"key": "shift+cmd+up",
"command": "cursorColumnSelectUp",
@GirlBossRush
GirlBossRush / keybindings.json
Created March 29, 2018 22:42
keybindings.json
// Place your key bindings in this file to overwrite the defaults
[
{
"key": "cmd+shift+v",
"command": "pasteAndIndent.action",
"when": "editorTextFocus && !editorReadonly"
},
{
"key": "shift+cmd+up",
"command": "cursorColumnSelectUp",