Skip to content

Instantly share code, notes, and snippets.

View thykka's full-sized avatar
🛠️

Moses Holmström thykka

🛠️
View GitHub Profile
@kometbomb
kometbomb / tweetjam.md
Last active May 14, 2025 06:07
PICO-8 tweetjam stuff

PICO-8 size optimization stuff for tweetcarts

Here are some simple ways to make your PICO-8 code fit in 140 280 characters (as in the #tweetjam #tweetcart craze). I did not invent these, I merely observed and collected them from the tweetjam thread.

LUA syntax stuff

  • Use single character variable names
  • Use x=.1 and x=.023, not x=0.1 or x=0.023
  • x=1/3 is shorter than x=.3333
  • You don't need to separate everything with spaces or write them on their own lines, e.g. circ(x,y,1)pset(z,q,7) works just as well
@tomhodgins
tomhodgins / semicolon-indent.html
Last active October 26, 2018 10:03
I took all the semicolons from my CSS and used them as indentation in my JS
<body>
<style>
body { margin : 0 }
body { background : #111 }
div { float : left }
div { width : calc(100%/256) }
div { padding-top : calc(100%/256) }
</style>
<script>
;;var hue = [0,1,2,3,4,5,6,7,8,9,'a','b','c','d','e','f']
@ljharb
ljharb / array_iteration_thoughts.md
Last active April 15, 2025 03:33
Array iteration methods summarized

Array Iteration

https://gist.github.com/ljharb/58faf1cfcb4e6808f74aae4ef7944cff

While attempting to explain JavaScript's reduce method on arrays, conceptually, I came up with the following - hopefully it's helpful; happy to tweak it if anyone has suggestions.

Intro

JavaScript Arrays have lots of built in methods on their prototype. Some of them mutate - ie, they change the underlying array in-place. Luckily, most of them do not - they instead return an entirely distinct array. Since arrays are conceptually a contiguous list of items, it helps code clarity and maintainability a lot to be able to operate on them in a "functional" way. (I'll also insist on referring to an array as a "list" - although in some languages, List is a native data type, in JS and this post, I'm referring to the concept. Everywhere I use the word "list" you can assume I'm talking about a JS Array) This means, to perform a single operation on the list as a whole ("atomically"), and to return a new list - thus making it mu

@thykka
thykka / jsfiddle-annoyances.user.js
Last active June 24, 2019 09:03
jsfiddle annoyaces userscript
// ==UserScript==
// @name jsfiddle annoyances
// @namespace https://gist.githubusercontent.com/thykka/d130a68229dc9bda81e6f11f7388d52d/
// @version 0.0.3
// @description Kill the anti-features!
// @author Thykka
// @match https://jsfiddle.net/*
// @updateURL https://gist.githubusercontent.com/thykka/d130a68229dc9bda81e6f11f7388d52d/raw
// @downloadURL https://gist.githubusercontent.com/thykka/d130a68229dc9bda81e6f11f7388d52d/raw
// @grant none