Skip to content

Instantly share code, notes, and snippets.

View 0x70b1a5's full-sized avatar
πŸ’€
In all thy works remember thy last end, and thou shalt never sin.

0x70b1a5

πŸ’€
In all thy works remember thy last end, and thou shalt never sin.
View GitHub Profile
@eglaysher
eglaysher / mandelbrot.hoon
Last active February 23, 2020 20:26
Fixed-point (not floating point!) Mandelbrot generator in Hoon.
:: Mandelbrot implementation inspired by the fixed-point version for
:: uBasic/4tH, and the floating point version for PureBasic from
:: https://rosettacode.org/wiki/Mandelbrot_set. This is pure fixed-point.
::
:: The trick is to use 10.000 as "floating" 1.0, and then do all math in terms
:: of that.
::
|%
++ left-edge -21.000
++ right-edge --15.000
@mattnewport
mattnewport / speakrune.hoon
Last active February 22, 2020 04:25
Convert runes to their spoken form
|= raw=tape
^- tape
=< ?:((valid raw) (turn raw convert) "input contains non-rune characters")
|%
++ valid
|= x=tape
^- ?
=/ chars (sy x)
(~(all in chars) |=(c=@t (~(has by table) c)))
++ convert
@mattnewport
mattnewport / planetppm.hoon
Created August 29, 2019 03:54
Procedural Planet raytracer in Hoon
|= dim=@ud ^- (list @t)
=/ dx (div:rs .1 (sun:rs dim))
=/ white [.1 .1 .1]
=< (genppm dim)
|%
++ min
|= [x=@rs y=@rs] ^- @rs
?: (lth:rs x y) x y
++ max
|= [x=@rs y=@rs] ^- @rs
@DominikAngerer
DominikAngerer / lorem-markdown.md
Created April 23, 2018 07:51
Lorem Ipsum Markdown file

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

H2

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod

@cityofwalls
cityofwalls / PathfinderSpellsJSON.txt
Created December 8, 2017 21:49
Pathfinder Spells List Complete - JSON
This file has been truncated, but you can view the full file.
[
{
"duration": "1 round + 1 round per three levels",
"components": "V, S, M (rhubarb leaf and an adder's stomach), F (a dart)",
"saving_throw": "none",
"school": "conjuration",
"spell_level": "sorcerer/wizard 2, magus 2, bloodrager 2",
"name": "Acid Arrow",
"range": "long (400 ft. + 40 ft./level)",
@Rich-Harris
Rich-Harris / service-workers.md
Last active September 4, 2025 09:45
Stuff I wish I'd known sooner about service workers

Stuff I wish I'd known sooner about service workers

I recently had several days of extremely frustrating experiences with service workers. Here are a few things I've since learned which would have made my life much easier but which isn't particularly obvious from most of the blog posts and videos I've seen.

I'll add to this list over time – suggested additions welcome in the comments or via twitter.com/rich_harris.

Use Canary for development instead of Chrome stable

Chrome 51 has some pretty wild behaviour related to console.log in service workers. Canary doesn't, and it has a load of really good service worker related stuff in devtools.

import React from "react";
import { render } from "react-dom";
const ParentComponent = React.createClass({
getDefaultProps: function() {
console.log("ParentComponent - getDefaultProps");
},
getInitialState: function() {
console.log("ParentComponent - getInitialState");
return { text: "" };
@mywarr
mywarr / AccessDump.py
Last active April 18, 2024 19:14
use mdbtools to convert .mdb to .sqlite and .csv
#!/usr/bin/env python
#
# AccessDump.py
# A simple script to dump the contents of a Microsoft Access Database.
# It depends upon the mdbtools suite:
# http://sourceforge.net/projects/mdbtools/
import sys, subprocess, os
DATABASE = sys.argv[1]
@mikedamage
mikedamage / morse_code_dictionary.rb
Last active October 20, 2023 20:41
Morse code dictionary as a Ruby Hash object
morse_dict = {
"a" => ".-",
"b" => "-...",
"c" => "-.-.",
"d" => "-..",
"e" => ".",
"f" => "..-.",
"g" => "--.",
"h" => "....",
"i" => "..",