This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Created by Christian Engel (parastudios.de) | |
* This code is provided as-is and needs to be used at own risk. | |
* | |
* v 1.1 | |
*/ | |
type EventCallbackFunction<EventMap, Key extends keyof EventMap> = (data: EventMap[Key]) => void; | |
type AllEventCallbackFunction<EventMap> = (event: keyof EventMap, data: EventMap[keyof EventMap]) => void; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Use this script to open a website. | |
-- Call the function like this: | |
-- openWebsite("https://example.com") | |
-- ------------------------------------------------------------ | |
-- Helper function to detect the system type. | |
-- Returns either "win", "mac" or "linux" | |
function getOS() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
npx create-snowpack-app [NAME] --template @snowpack/app-template-svelte-typescript | |
npm i -d sass | |
// ==================================================================== | |
// svelte.config.js | |
// ==================================================================== | |
const autoPreprocess = require('svelte-preprocess'); | |
module.exports = { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var ws281x = require('rpi-ws281x'); | |
const config = { | |
leds: 144 * 2, | |
type: "grb", | |
brightness: 255 | |
}; | |
function init(){ | |
ws281x.configure(config); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* This function takes two objects and compares if they have the same | |
* keys and their keys have the same values assigned, so the objects are | |
* basically the same. | |
* @param {object} objA | |
* @param {object} objB | |
* @return {boolean} | |
*/ | |
const objectsEqual = (objA, objB) => { | |
const objAKeys = Object.keys(objA); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// One Process needs to be the host | |
const ipc = require('node-ipc'); | |
ipc.config.id = 'a-unique-process-name1'; | |
ipc.config.retry = 1500; | |
ipc.config.silent = true; | |
ipc.serve(() => ipc.server.on('eventName', message => { | |
console.log(message); | |
})); | |
ipc.server.start(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Chalk powered color log | |
* ======================= | |
* This module is a wrapper around the chalk package to provide | |
* simpler log message formatting. | |
* To switch a color inside your log message, simply use ´X where | |
* X is one of the color names in the chalkMap below. | |
* | |
* Example: | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from "react"; | |
let lsBus = {}; | |
let ssBus = {}; | |
/** | |
* Redraw all components that have a hook to localStorage with the given key. | |
* @param {string} key | |
* @param {*} newValue | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
docker exec -ti container_id bash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This will start a apache server and maps it to the local port 80 | |
# It will assume your hosted content in the folder ./src | |
version: '2' | |
services: | |
apache2: | |
image: webdevops/apache:latest | |
volumes: | |
- ./src:/app | |
ports: | |
- 80:80 |
NewerOlder