Skip to content

Instantly share code, notes, and snippets.

View riccardolardi's full-sized avatar
🛹

Riccardo Lardi riccardolardi

🛹
View GitHub Profile
$(window).resize(function() {
// window dimenstions
var windowWidth = $(window).width();
var windowHeight = $(window).height();
// figure dimensions
var figureWidth = $('#detailScreen figure').width();
var figureHeight = $('#detailScreen figure').height();
module.exports = {
config: {
// default font size in pixels for all tabs
fontSize: 14,
// font family with optional fallbacks
fontFamily: '"Source Code Pro", Menlo, "DejaVu Sans Mono", "Lucida Console", monospace',
// terminal cursor background color and opacity (hex, rgb, hsl, hsv, hwb or cmyk)
cursorColor: 'rgba(248,28,229,0.8)',
for (let i = 1; i < artnetOptions.channels + 1; i++) {
console.log('status: switching on valve ' + i)
if (i > 1) artnet.set(i - 1, 0)
artnet.set(i, 255, function() {
// iterate
})
}
artnet.close()
[22143.845950] usb 2-6: new SuperSpeed USB device number 5 using xhci_hcd
[22143.859274] usb 2-6: New USB device found, idVendor=1058, idProduct=25a2
[22143.859283] usb 2-6: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[22143.859289] usb 2-6: Product: Elements 25A2
[22143.859294] usb 2-6: Manufacturer: Western Digital
[22143.859299] usb 2-6: SerialNumber: 575839314139364438375546
const {performance} = require('perf_hooks')
let lastTs, newTs
const desiredFps = 30.0
const interval = () => {
lastTs = newTs
newTs = performance.now()
const err = newTs - lastTs - 1000.0 / desiredFps
const newDelay = 1000.0 / desiredFps - err
setTimeout(interval, newDelay)
}
(async () => {
let response, configJson
try {
response = await fetch('./config.json')
configJson = await response.json()
} catch(error) {
configJson = {
"fallback": true
}
}
{
"name": "Switzerland",
"view": {
"zoom": 34, // changable by maptool
"lat": 46.7310679, // changable by maptool
"lon": 6.2670205 // changable by maptool
},
"places": [
{
"type": "federation",
// .js instead of .json for convenience
{
"id": "string",
"original-loc": {
"lat": "double",
"lon": "double"
},
"name": "string",
"tag": "string",
"country-code": "string",
this.setState(state => {
view: {
...state.view,
lat: coords.lat,
lon: coords.lon
}
})
const shifty = require('shifty')
console.log(shifty)
shifty.tween({
from: {
x: 0
}, to: {
x: 10
}, step: state => console.log(state)
}).then(() => console.log('done'))