Skip to content

Instantly share code, notes, and snippets.

@jaredly
jaredly / cors-proxy.js
Created Jun 4, 2022
cloudflare worker CORS proxy
View cors-proxy.js
/**
* Usage:
* https://worker-name.myusername.workers.dev/?url=http://google.com
*/
addEventListener('fetch', event => {
event.respondWith(handleRequest(event.request))
})
/**
View turtles-cut-one.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View bunnies.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View laser cut pen plotter.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jaredly
jaredly / PianoMerge.qml
Created Mar 27, 2022
Here's a plugin to merge several voices into a single piano part
View PianoMerge.qml
import QtQuick 2.0
import MuseScore 3.0
MuseScore {
menuPath: "Plugins.pluginName"
description: "Description goes here"
version: "1.0"
onRun: {
var loops = 0
@jaredly
jaredly / missing-deps-to-local.js
Last active Sep 27, 2021
A nice little script for converting gradle dependencies from some external source (ahem jcenter) to a local maven repository.
View missing-deps-to-local.js
// Based on info from this post https://brightinventions.pl/blog/migrating-away-from-bintray-jcenter-when-there-is-no-alternative-repository/#setting-up-a-local-maven-repository
/**
* How to use this tool:
* 1. comment out `jcenter()` in your build.gradle
* 2. run `./gradlew :app:dependencies > deps.log`
* 3. mkdir `local-maven`
* 4. add `maven { url = uri("${rootProject.projectDir}/local-maven") }`
* right before the commented-out `jcenter()` calls in your build.gradle.
* 5. run `node missing-deps-to-local.js ./local-maven < deps.log`
View spirals.jd
@ffi("Vec2") type Vec2#08f7c2ac = {
x: float#builtin,
y: float#builtin,
};
@ffi("End") type End#830ad468 = {};
@ffi("Start") type Start#098d99e8 = {};
@ffi("Center") type Center#1189540a = {};
@jaredly
jaredly / abilities-in-scheme.scm
Last active Jan 28, 2021
This is able to at least handle the "jump between two handlers" aspect of abilities. will see how well I make it through the rest of the test cases. This is run using chicken scheme.
View abilities-in-scheme.scm
(define stack '())
(define (throw-effect k effect)
(let* ((handler (car stack)) (name (car handler)) (fn (cadr handler)))
(set! stack (cdr stack))
(print "Calling " name)
(fn (cons 'effect (cons k effect)))
)
)
View all unison docs.md

All the docs probably

base..

.> view base..

  (base..) : (b ->{𝕖} c) -> (a ->{𝕖} b) -> a ->{𝕖} c
  (base..) f g x = f (g x)
@jaredly
jaredly / example.re
Created Jul 30, 2019
Reason Macros example
View example.re
// Reason Macros!
// Use templates to write your code for you.
let%macro add5 = (input: ident, log: string) => {
if%eval (env("node_environment") != "production") {
Js.log(eval__input)
};
eval__input + 5
};