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
(* Inspired by: https://www.reddit.com/r/ProgrammingLanguages/comments/1golfwz/emit_a_time_travelling_programming_language/ *) | |
structure Timewarp = | |
struct | |
structure Cont = SMLofNJ.Cont; | |
type t = unit Cont.cont option ref | |
fun point () = | |
let |
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
#!/usr/bin/env -S scala-cli shebang -S 3 | |
/** | |
* https://www.doc.ic.ac.uk/~eedwards/compsys/float/ | |
*/ | |
import java.{ lang => j } | |
val n = args(0).toFloat | |
val bits = j.Float.floatToRawIntBits(n) |
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
<!DOCTYPE html> | |
<!-- Demo: https://www.youtube.com/watch?v=7M9aPgORP_E --> | |
<html> | |
<head> | |
<meta charset="UTF-8"> | |
<title>CSS 3D Transforms & Animations</title> | |
<style type="text/css"> | |
* { |
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
object YAML: | |
apiVersion: | |
apps/v1 | |
kind: | |
Deployment | |
metadata: | |
name: | |
"my-app" | |
namespace: | |
"my-app" |
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
#!/usr/bin/env bash | |
# | |
# RESOURCES | |
# | |
# - https://tdop.github.io/ | |
# - https://journal.stuffwithstuff.com/2011/03/19/pratt-parsers-expression-parsing-made-easy/ | |
# - https://martin.janiczek.cz/2023/07/03/demystifying-pratt-parsers.html | |
# |
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
#!/usr/bin/env bash | |
# Clones all gists (public or private) into directory `gists/` (auto-created | |
# and configurable if desired). The cloned gists are placed into directory | |
# names formed from the name of the first file found in the gist concatenated | |
# to the gist ID. For example, this gist will be cloned into: | |
# | |
# gists/clone-gists.sh-0a89b8bb1a6df0754647cdd87d8221b6 | |
# | |
# USAGE: |
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
#!/usr/bin/env osascript -l JavaScript | |
ObjC.import('stdlib') | |
ObjC.import('PDFKit'); | |
function reverse(opts) { | |
// Load the PDF document | |
const pdfURL = $.NSURL.fileURLWithPath(opts.src); | |
const pdfDoc = $.PDFDocument.alloc.initWithURL(pdfURL); |
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
SELECT | |
jsonb_set( | |
'{"deeply": {"nested": {"field": 1}}}'::jsonb, | |
'{deeply,nested,field}', | |
to_jsonb(NULL::int) | |
) AS with_null_arg, | |
jsonb_set( | |
'{"deeply": {"nested": {"field": 1}}}'::jsonb, | |
'{deeply,nested,field}', |
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
#include <pthread.h> | |
#include <stdbool.h> | |
#include <stdio.h> | |
#include <stdint.h> | |
#include <string.h> | |
#include <sys/mman.h> | |
static uint8_t code[] = { | |
0x40, 0x05, 0x80, 0x52, // mov w0, #3 | |
0xc0, 0x03, 0x5f, 0xd6, // ret |
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
module Seq = struct | |
include Seq | |
let rec fold_right : 'a Seq.t -> 'b -> ('a -> 'b Lazy.t -> 'b Lazy.t) -> 'b Lazy.t = | |
fun seq acc f -> | |
match seq () with | |
| Seq.Nil -> lazy acc | |
| Seq.Cons (a, rest) -> f a (lazy (Lazy.force (fold_right rest acc f))) | |
let map : ('a -> 'b) -> 'a Seq.t -> 'b Seq.t = |
NewerOlder