Skip to content

Instantly share code, notes, and snippets.

View betamos's full-sized avatar

Didrik Nordström betamos

View GitHub Profile
{
"version": "v1.0.0",
"notes": "Added Facebook like button",
"pub_date": "2022-06-30T19:25:57Z",
"platforms": {
"darwin-x86_64": {
"signature": "",
"url": "https://github.com/lemarier/tauri-test/releases/download/v1.0.0/app.app.tar.gz"
},
"darwin-aarch64": {
@betamos
betamos / accurate.js
Created August 25, 2013 23:25
Playing around with more accurate JS timeouts for long durations with system time as reference
/**
* Long timeouts that remain accuracy.
*/
// When the final system adjusted timer kicks in
var FINAL_COUNTDOWN = 2000;
var accurate = {};
accurate.setTimeout = function(fn, t) {
@betamos
betamos / burst-timeout.js
Created August 23, 2013 15:29
JS tool for scheduling a function for execution multiple times at a specific interval.
/* Author: Didrik Nordström, didrik@betamos.se */
/**
* Schedule a function for execution multiple times at a specific interval.
* Uses setTimeout so remember to not use it for high precision timing over
* long durations.
*
* @param timeout Duration in ms from now to first call
* @param count Number of calls
* @param interval Duration in ms between calls
@betamos
betamos / readable-duration-so.js
Created August 22, 2013 12:57
Tweak from my other Gist, https://gist.github.com/betamos/6306412. Outputs seconds into "h+:mm:ss"
/* Author: Didrik Nordström, didrik@betamos.se */
/* Specifically for http://stackoverflow.com/questions/6312993 */
/**
* Format a duration in seconds to a human readable format using the notion
* "h+:mm:ss", e.g. "4:40:78". Negative durations are preceeded by "-".
*
* @param t Duration in seconds
* @return The formatted duration string
*/
@betamos
betamos / readable-duration.js
Last active August 6, 2020 20:50
Tiny JS utility to print duration in a human readable fashion
/* Author: Didrik Nordström, didrik@betamos.se */
/**
* Format a duration in milliseconds to a human readable format, e.g.
* "4y 2d 3h 10m 10s 255ms". Negative durations are formatted like "- 8h 30s".
* Granularity is always ms.
*
* @param t Duration in milliseconds
* @return A formatted string containing the duration or "" if t=0
*/
@betamos
betamos / gist:5425487
Created April 20, 2013 10:10
henryhenry22
{"_id":"roiPdtw0L","name":"foobar [B05]","exp":0,"level":1,"str":15,"int":10,"wis":10,"dex":15,"con":10,"map":"Bad feeling ruins","inventory":["rkioAy30R","rJDDRYWVa","rSJgwxSYD"],"x":17,"y":11,"hp":10,"ac":10,"alloc":0,"speed":2,"light":3,"wieldedweapon":null,"equippedarmor":null,"type":"character","hates":["*"],"attack":{"type":"normal","damage":[1,2]},"teamabbrev":"B05","teamid":"rtr7fpp_h","maxhp":10,"resource":"dungeonthing"}