Skip to content

Instantly share code, notes, and snippets.

⛵️
Driftin'

Riccardo Lardi alberto2000

View GitHub Profile
View index.jsx
(async () => {
let response, configJson
try {
response = await fetch('./config.json')
configJson = await response.json()
} catch(error) {
configJson = {
"fallback": true
}
}
View adaptive-loop.js
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)
}
View gist:bc5595a27a12d14ddadb2377e52c0384
[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
View iterate
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()
View hyper.js
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)',
View gist:3742885
$(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();
You can’t perform that action at this time.