Skip to content

Instantly share code, notes, and snippets.

@SimonKocurek
SimonKocurek / geoBoundingBox.ts
Last active July 20, 2023 20:35
Geo Bunding Box
/**
* Utility functions:
* - getBoundingBox: Gets a box surrounding all points that are a certain distance from provided point on the Earth sphere.
* Take care when longitude crosses the 180th meridian. In such case, the minLongitude (e.g., 175)
* will be greater than the maxLongitude (e.g. -175).
* Credit to Jan Philip Matuschek for the mathematical formulas - http://janmatuschek.de/LatitudeLongitudeBoundingCoordinates
* - getDistanceInMeters: Gets a distance between 2 points on the Earth sphere.
*/
export type BoundingBox = { minLatitude: number; maxLatitude: number; minLongitude: number; maxLongitude: number }
@SimonKocurek
SimonKocurek / microbit_snake.py
Last active July 18, 2023 11:05
Snake game on a Micro:bit controller
from microbit import *
from random import randrange
class State:
def __init__(self):
self.last_frame_time = 0
self.speed = 500
self.snake_pos = [(2, 2)]
self.food_pos = (0, 0)
@SimonKocurek
SimonKocurek / delete.js
Last active March 17, 2019 08:19
Reddit comment deletion script
$('a').filter(function() {
return $(this).text() === 'delete'
}).each(function() {
this.click()
})
links = $('a').filter(function() {
return $(this).attr('onclick') === 'change_state(this, "del", hide_thing, undefined, null)'
})