Skip to content

Instantly share code, notes, and snippets.

@jacopocolo
jacopocolo / arena-random-image-widget.js
Last active February 21, 2024 06:35
Scriptable widget that load a random image from an are.na channel
// Variables used by Scriptable.
// These must be at the very top of the file. Do not edit.
// icon-color: black; icon-glyph: user-md;
// just replace the url below with the url if the channel you want to use
// image channels only, doesnt supoort text or anything else
const channel = 'https://www.are.na/una/color-tx32pz_qsu0'
const url = 'https://api.are.na/v2/channels/'+channel.substring(channel.lastIndexOf('/') + 1)+'/contents';
const req = new Request(url)
@jacopocolo
jacopocolo / guide.md
Last active January 13, 2024 23:30
Making a Bitsy game compatible with the Nintendo 3ds browser

The Nintendo 3ds browser is capable of running Bitsy games! And it's a delightful Bitsy machine.

To make games compatible, we just need to teach the 3ds browser to speak the language Bitsy is written in: modern Javascript!

To do that we need two things:

  1. The html page that contains your game
  2. A <script> </script> html element we'll add at the top of the page that translates modern Javascript to somewhat Javascript.

The whole script element is here. Just select the whole thing and copy.

@jacopocolo
jacopocolo / deviceOrientationControls.js
Created December 7, 2022 07:06
A copy of deviceOrientationControls from an older version of Three.js
( function () {
const _zee = new THREE.Vector3( 0, 0, 1 );
const _euler = new THREE.Euler();
const _q0 = new THREE.Quaternion();
const _q1 = new THREE.Quaternion( - Math.sqrt( 0.5 ), 0, 0, Math.sqrt( 0.5 ) ); // - PI/2 around the x-axis
@jacopocolo
jacopocolo / THREE.MeshLine.js
Created July 17, 2020 12:09
MeshLine as module
import * as THREE from "https://threejs.org/build/three.module.js";
function MeshLine() {
this.positions = [];
this.previous = [];
this.next = [];
this.side = [];
this.width = [];
[{"vertices":[-0.0037821829319000244,-0.0025315284729003906,0.0000025033950805664062,0.0037821829319000244,0.0025315284729003906,-0.0000025033950805664062],"stroke":{"show_stroke":true,"color":"rgb(64,64,64)","lineWidth":0.002,"force":[0.000017974853515625,0.000017974853515625]},"fill":{"show_fill":false,"color":"rgb(64,64,64)"},"mirrorOn":false,"position":{"x":-0.3124171197414398,"y":3.6292028427124023,"z":-2.0586036443710327},"quaternion":{"_x":0,"_y":0,"_z":0,"_w":1},"scale":{"x":1,"y":1,"z":1},"matrix":{"elements":[1,0,0,0,0,1,0,0,0,0,1,0,-0.3124171197414398,3.6292028427124023,-2.0586036443710327,1]}},{"vertices":[-0.0012731552124023438,0.0012624263763427734,0.0000050067901611328125,0.0012731552124023438,-0.0012624263763427734,-0.0000050067901611328125,-0.0012729167938232422,0.0012621879577636719,0.0000050067901611328125],"stroke":{"show_stroke":true,"color":"rgb(64,64,64)","lineWidth":0.002,"force":[0.07999999999999999,0.03747619628906249,0.02890089416503906]},"fill":{"show_fill":false,"color":"rgb(64,64
@jacopocolo
jacopocolo / falcon.json
Created October 26, 2021 08:28
A Millenium Falcon sketched with Penzil.app
This file has been truncated, but you can view the full file.
[{"vertices":[-2.385042667388916,0.38122472167015076,-0.33808213472366333,-2.385042667388916,0.38122472167015076,-0.33808213472366333,-2.3809447288513184,0.38122472167015076,-0.33808213472366333,-2.3809447288513184,0.38122472167015076,-0.33808213472366333,-2.380125045776367,0.38122472167015076,-0.34054094552993774,-2.380125045776367,0.38122472167015076,-0.34054094552993774,-2.372748613357544,0.38122472167015076,-0.33808213472366333,-2.372748613357544,0.38122472167015076,-0.33808213472366333,-2.368138551712036,0.38122472167015076,-0.3350086212158203,-2.368138551712036,0.38122472167015076,-0.3350086212158203,-2.360454559326172,0.38122472167015076,-0.3319351375102997,-2.360454559326172,0.38122472167015076,-0.3319351375102997,-2.3527708053588867,0.38122472167015076,-0.32732486724853516,-2.3527708053588867,0.38122472167015076,-0.32732486724853516,-2.3420135974884033,0.38122472167015076,-0.3211778402328491,-2.3420135974884033,0.38122472167015076,-0.3211778402328491,-2.3297195434570312,0.38122472167015076,-0.3119572
@jacopocolo
jacopocolo / falcon.json
Created October 26, 2021 08:24
A sketch of the Falcon done in Penzil.app
[{"vertices":[-0.03995561599731445,0,-0.021821916103363037,-0.0358576774597168,0,-0.021821916103363037,-0.035037994384765625,0,-0.02428072690963745,-0.027661561965942383,0,-0.021821916103363037,-0.02305150032043457,0,-0.01874840259552002,-0.015367507934570312,0,-0.01567491888999939,-0.007683753967285156,0,-0.011064648628234863,0.003073453903198242,0,-0.004917621612548828,0.015367507934570312,0,0.004302918910980225,0.027661561965942383,0,0.01352342963218689,0.03995561599731445,0,0.02428072690963745],"stroke":{"show_stroke":true,"color":"rgb(64,64,64)","lineWidth":0.01,"force":[0,0.005580952962239583,0.021964776611328125,0.03305099487304687,0.037092472076416014,0.04546086502075195,0.05315942764282226,0.05927547454833984,0.06284950256347656,0.06365628051757811,0.06214206314086914]},"fill":{"show_fill":false,"color":"rgb(64,64,64)"},"mirrorOn":false,"position":{"x":-2.3450870513916016,"y":0.38122472167015076,"z":-0.3162602186203003},"quaternion":{"_x":0,"_y":0,"_z":0,"_w":1},"scale":{"x":1,"y":1,"z":1},"matrix":{
@jacopocolo
jacopocolo / freehand-dark-mode.css
Last active February 3, 2021 15:56
A simple dark mode for Invision Freehand
.surface-background {
/*Tweak this value to adjust the canvas background color.
A very dark black will make the shape recognition support lines invisible
*/
background: rgb(30,30,30) !important;
}
.circle-button, ._1fdLYx4plVAyn4a-e84Oxj, ._1fAkufW-JX1VTjJlLj9Bqp {
background-color: rgba(255,255,255,0.1);
}
@jacopocolo
jacopocolo / script.html
Created April 25, 2020 19:26
Polyfill functions to make Bitsy 7.0 and below work on a Nintendo 3ds browser
<script type="text/javascript">
//assign polyfill
if (!Object.assign) {
Object.defineProperty(Object, 'assign', {
enumerable: false,
configurable: true,
writable: true,
value: function(target, firstSource) {
'use strict';
if (target === undefined || target === null) {
This file has been truncated, but you can view the full file.
// tquery.js - https://github.com/jeromeetienne/tquery - MIT License
// vim: ts=4 sts=4 sw=4 expandtab
// -- kriskowal Kris Kowal Copyright (C) 2009-2011 MIT License
// -- tlrobinson Tom Robinson Copyright (C) 2009-2010 MIT License (Narwhal Project)
// -- dantman Daniel Friesen Copyright (C) 2010 XXX TODO License or CLA
// -- fschaefer Florian Schäfer Copyright (C) 2010 MIT License
// -- Gozala Irakli Gozalishvili Copyright (C) 2010 MIT License
// -- kitcambridge Kit Cambridge Copyright (C) 2011 MIT License
// -- kossnocorp Sasha Koss XXX TODO License or CLA
// -- bryanforbes Bryan Forbes XXX TODO License or CLA