Skip to content

Instantly share code, notes, and snippets.

@luontola
luontola / script.js
Created January 31, 2024 18:23
Userscript for showing when a site was last refreshed
(() => {
const startTime = Date.now()
const element = document.createElement('div')
element.className = "last-refreshed-timer"
element.addEventListener("mouseenter", () => {
const style = window.getComputedStyle(element)
if (style.right) {
element.style.left = style.right
element.style.right = "unset"
} else {
@luontola
luontola / example.clj
Last active November 30, 2023 13:09
"Method code too large!" from Hiccup macro compilation
;; this example was extracted from https://github.com/luontola/tdd-mooc/blob/036e96af12de6acd8489e99a037e4f2f4bf2c9ea/src/tdd_mooc/web.clj#L159
(ns example
(:require [clojure.pprint]
[clojure.walk]
[hiccup.page]
[hiccup2.core :as h]))
(defn layout-navigation [current-path navigation-tree])
(defn layout-footer [])
@luontola
luontola / paperclips.js
Last active November 13, 2023 09:19
Paperclip Clicker Bot
// auto-clicker for https://www.decisionproblem.com/paperclips/index2.html
const projectAlgorithmicTrading = project21
const projectHostileTakeover = project37
const projectFullMonopoly = project38
const projectQuantumComputing = project50
const projectPhotonicChip = project51
const projectReleaseHypnoDrones = project35
const projectTokenOfGoodwill1 = project40
const projectTokenOfGoodwill2 = project40b
const projectSpaceExploration = project46

Keybase proof

I hereby claim:

  • I am luontola on github.
  • I am luontola (https://keybase.io/luontola) on keybase.
  • I have a public key whose fingerprint is 34E7 6245 2863 98FC 98BF 23FE EEAD 31D9 D372 921A

To claim this, I am signing this object:

import javax.swing.*;
public class Sample {
public static void main(String[] args) {
SwingUtilities.invokeLater(Sample::new);
}
public Sample() {
JButton myjButton = new JButton("My Button");
diff --git a/media/pa/ammo/base_ammo/base_ammo.json b/media/pa/ammo/base_ammo/base_ammo.json
index 7401e86..1f81b23 100755
--- a/media/pa/ammo/base_ammo/base_ammo.json
+++ b/media/pa/ammo/base_ammo/base_ammo.json
@@ -24,10 +24,10 @@
},
"physics": {
"add_to_spatial_db": false,
- "air_friction": 0.1,
"gravity_scalar": 3,
@luontola
luontola / .gitignore
Created September 19, 2012 17:32
Examples of using Jumi. See the presentation at http://youtu.be/Ggi6yutRZ9Y
/target/
/.jumi/
/.idea/
/*.iml
#!/bin/sh
set -eu
: ${GO_PIPELINE_COUNTER:?}
: ${GPG_KEYNAME:?}
: ${PWD:?}
set -x
RELEASE_VERSION=`ruby scripts/get-release-version.rb $GO_PIPELINE_COUNTER`
RELEASE_NOTES=`ruby scripts/get-release-notes.rb RELEASE-NOTES.md`
TAG="v$RELEASE_VERSION"
@luontola
luontola / bad.java
Created April 30, 2012 15:29
Example of overlapping tests. Original code is at http://jumi.fi/
// Copyright © 2011-2012, Esko Luontola <www.orfjackal.net>
// This software is released under the Apache License 2.0.
// The license text is at http://www.apache.org/licenses/LICENSE-2.0
package fi.jumi.core.runs;
import org.junit.Test;
import java.util.*;
import java.util.concurrent.*;
#
# A fatal error has been detected by the Java Runtime Environment:
#
# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x000000006d8f62b8, pid=2024, tid=132
#
# JRE version: 6.0_30-b12
# Java VM: Java HotSpot(TM) 64-Bit Server VM (20.5-b03 mixed mode windows-amd64 compressed oops)
# Problematic frame:
# V [jvm.dll+0x462b8]
#