Skip to content

Instantly share code, notes, and snippets.

View davidedc's full-sized avatar

Davide Della Casa davidedc

View GitHub Profile
@davidedc
davidedc / SmallWorld subset that can be translated to js by jsweet.js
Created December 5, 2022 17:46
SmallWorld subset translated to js by jsweet
// follow-up to https://gist.github.com/davidedc/138e752949f0acd73595f37f46c7cdb9
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
//import java.io.DataInput;
//import java.io.DataInputStream;
//import java.io.EOFException;
//import java.io.FileInputStream;
//import java.io.FileOutputStream;
//import java.io.IOException;
//import java.io.PrintStream;
//import smallworld.ui.BorderedPanel;
//import smallworld.ui.Button;
//import smallworld.ui.GridPanel;
Sorry guys I reeeeeally borked your playground by doing the stuff below, here are some of my shenanigans:
OK I added the class turtle to rabbit:
el = document.getElementById("rabbit");
el.className = "turtle";
Some other tries:
setInterval(function(){ var colors = ['#ff0000', '#00ff00', '#0000ff'];var random_color = colors[Math.floor(Math.random() * colors.length)]; Howard.fill(random_color);}, 300);
@davidedc
davidedc / findLastZero.coffee
Created December 20, 2015 12:52
Finds the last 0 in an array containing an arbitrary number of zeros followed by an arbitrary number of ones
# Finds the last 0 in an array containing
# an arbitrary number of zeros followed by an
# arbitrary number of ones.
# Uses a modified binary search, which is both
# simplified and caters for finding the very
# last instance of zero rather than just
# the first one found.
findLastZero = (arrayOfZeroesFollowedByOnes) ->
@davidedc
davidedc / Bookmarklet to verticalise the JIRA Epic board
Last active August 20, 2021 18:29
Bookmarklet to verticalise the JIRA Epic board
// "turns" the usual JIRA Epic board
// can be turned into bookmarklet using http://mrcoles.com/bookmarklet/
(elem=document.getElementById("ghx-column-headers")).parentNode.removeChild(elem);
var cusid_ele, images, i;
cusid_ele = document.getElementsByClassName('ghx-column');
for (i = 0; i < cusid_ele.length; ++i) {
var item = cusid_ele[i];
item.style.display = 'block';
@davidedc
davidedc / webgl_lines_colors.html
Created April 8, 2012 19:30
working motion blur with transparent background
<!doctype html>
<html lang="en">
<head>
<title>three.js webgl - lines - cubes - colors</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
<style>
body {
background-color: #FF0000;
margin: 0px;
@davidedc
davidedc / webgl_lines_colors.html
Created April 8, 2012 15:40
Example for issue of blend losing the background transparency
<!doctype html>
<html lang="en">
<head>
<title>three.js webgl - lines - cubes - colors</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
<style>
body {
background-color: #FF0000;
margin: 0px;
<!doctype html>
<html lang="en">
<head>
<title>three.js webgl - lines - cubes - colors</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
<style>
body {
background-color: #FF0000;
margin: 0px;