This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import fetch from 'node-fetch' | |
// some provider data is copied from github.com/simov/grant | |
const providers = { | |
bogus: { | |
authorize_url: "http://localhost:8282/auth/request/path", | |
access_url: "http://localhost:8282/access/token/request", | |
}, | |
google: { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Using digital hall effect sensor SENS-M-10 (purchased at Abra) | |
* | |
* MCU Board: ESP2-WROOM-32 | |
*/ | |
#include <BLEDevice.h> | |
#include <BLEUtils.h> | |
#include <BLEServer.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sk() { | |
pnpm init svelte@next $1 \ | |
&& cd $1 \ | |
&& pnpm install \ | |
&& git init \ | |
&& git add . \ | |
&& git commit -m 'Initial commit' | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule MyApp.Integrations.Skubana do | |
@host "..." | |
@headers [ ... ] | |
# returns a stream of shipments | |
def get_shipments do | |
# start with page 1 | |
start = fn -> 1 end | |
# create a stream, it will make HTTP requests until the page returned is empty |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
scripts/newPost.js | |
A script for scaffolding markdown posts: | |
- Prompts for required metadata (title, tags, etc..) | |
- Generates a file name based on title | |
- Opens in fav. editor | |
Add script to package.json: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule MyApp.Telemetry do | |
require Logger | |
def handle_event([:my_app, :repo, :query], measurements, metadata, _config) do | |
milliseconds = System.convert_time_unit(measurements.total_time, :native, :millisecond) | |
# did the query take longer than 100ms? | |
if milliseconds > 100 do | |
# log it as a warning | |
Logger.warn("SLOW QUERY: ms: #{milliseconds}, query: #{metadata.query}") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
snippet import "import a package" | |
import ${1:name} from '${2:name}' | |
snippet get "define a svelte GET endpoint" | |
export async function get() { | |
${1} | |
} | |
snippet post "define a svelte POST endpoint" | |
export async function post() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
In SvelteKit, endpoints return an object, like: | |
{ | |
status: 200, | |
headers: {...}, | |
body: JSON.stringify({a: 1}) | |
} | |
This is an exploration into how it feels using a DSL instead. Like express and others use. |