Skip to content

Instantly share code, notes, and snippets.

View krabs-github's full-sized avatar

Krabs krabs-github

View GitHub Profile
@krabs-github
krabs-github / setImage function sample.js
Last active July 26, 2021 19:30
[Set Image Function Sample] setImage function sample #Public #Streamdeck
// Variables beginning with "v" are the variables you define prior to calling the function.
// The Function
function setImage (context, vBase64img) {
var json = {
'event': 'setImage',
'context': context,
'payload': {
'image': vBase64img,
'target': DestinationEnum.HARDWARE_AND_SOFTWARE
@krabs-github
krabs-github / Set Image from URL Function.js
Last active July 26, 2021 19:29
[Set Image From URL Sample] Set Image from URL Function #Public #Streamdeck
// Variables beginning with "v" are the variables you define prior to calling the function.
// Function to do the conversion to Base64 from a URL
function convertImgToBase64(url, callback, outputFormat){
var canvas = document.createElement('CANVAS');
var ctx = canvas.getContext('2d');
var img = new Image;
img.crossOrigin = 'Anonymous';
img.onload = function(){
canvas.height = img.height;
@krabs-github
krabs-github / Streamdeck icon sizes.md
Last active September 20, 2021 20:27
[Streamdeck Icon Sizes] Streamdeck icon sizes #Streamdeck

Streamdeck icon sizes

Image Size @2x Color
Action 20x20 px 40x40 px #d8d8d8 rgb(216,216,216)
Category 28x28 px 56x56 px #c8c8c8 rgb(200,200,200)
Key 72x72 px 144x144 px
pluginIcon 72x72 px 144x144 px

Elgato Style Guide

@krabs-github
krabs-github / streamdeck update settings.js
Created July 28, 2021 11:40
[streamdeck update settings] streamdeck update settings
function updateSettings() {
if (websocket && websocket.readyState === 1) {
let payload = {};
payload.cityName = document.getElementById("cityName").value;
payload.frequency = document.getElementById("frequency").value;
payload.unit = document.getElementById("unit").value;
payload.roundDegree = document.getElementById("roundDegree").value;
payload.displayCity = parseInt(
document.getElementById("displayCity").value
);
@krabs-github
krabs-github / Change image to BASE64.js
Last active September 1, 2021 10:24
[Change image to BASE64] Change image to BASE64 #Streamdeck
var vImage = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEgAAABICAYAAABV7bNHAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAABmJLR0QAAAAAAAD5Q7t/AAAAB3RJTUUH5QcNEw8oZlqNQAAAB0VJREFUeNrtm1uIJNUZx3/n1KW7aqZnZ8edXVbXaMxlMeYlSBRNIESJkIAQIiImIAjRkIe8mwsEJIa8hIAYUTDkQSWRBEJeDCEhF0iMJCEqiIJgNFlnZ3WmZ3a2p2equ7rOycOpaWv6Ml01W6d7l9Qfdqe76lx/fS5ffd8pqFSpUqVKlSpVqlRphMQsK2+ubiAE6AS01gghcHyJ4zn70jUWG/8/gDbObaJ6CiEEGg0aHNeRSZwEGu15NRfHd7pABKjB/NOGNVVA6ytNU6MCr+6JuBNfheaTwM1CitPSlUuOK7WQYh14A/gH8E/gHUDPAtLUAK2vNM0HBUiuRnMvcDdwvXTlnOM5SCkGW9QGXgd+AfwMODNtSFMBtP5OEyFACCmVVrej+TbwKQSu4zm4njOpJT3gr8D3gD+kmKcCyTqg9ZUmAhBCSKX0PcD3gWsBXN/B8Z0ixb0FfBMzoqYCySqg5tkNAFSUIHx5J/Bj4GoAx5W4NfcwLfgP8HXgN3sXbEKSNgG1N9topRE1eRr47h4cs507CHkwHzPyhi5fk5b1YZtttw5o49wm4WIIEg/Ng8CN/UpdQaIUrVZEazsiSYZ2c5JE0dqOaLUier1k8PZNwFcBF6B1vmUNkGur4GQ3RngOaG4AvrR3XQhQaJprF2jvdACYm6uzfOwIrmt+r15Psba+RbsdARCGNY4vH8F1++uVAO4CngFetUYHiyNI+i5xnADcDnyg3zMpiTox7Z0OWmu01rTbEVHU6efdjTq029H793c67Ox2B6u4FrjNJhyrgDQa33dC4NZsPUKaRUXr
@krabs-github
krabs-github / Play Sound.js
Created August 20, 2021 11:47
[Play Sound] Play Sound #Streamdeck
var vSoundFX1 = new Audio('resources/sounds/magic_mystery.mp3');
vSoundFX1.play();
@krabs-github
krabs-github / Stream Deck Device Type List.md
Last active September 28, 2021 12:21
[Stream Deck Device Type List] Stream Deck Device Type List #Stream Deck

Device Type Information

Stream Deck: kESDSDKDeviceType_StreamDeck (0)

Stream Deck Mini: kESDSDKDeviceType_StreamDeckMini (1)

Stream Deck XL: kESDSDKDeviceType_StreamDeckXL (2)

Stream Deck Mobile: kESDSDKDeviceType_StreamDeckMobile (3)

Stream Deck GKeys: kESDSDKDeviceType_CorsairGKeys (4)

@krabs-github
krabs-github / Style Scroll Bar.txt
Created September 29, 2021 19:31
[Style Scroll Bar] Style Scroll Bar #Web
<style>
/* width */
::-webkit-scrollbar {
width: 8px;
}
/* Track */
::-webkit-scrollbar-track {
background: #f1f1f1;
}
@krabs-github
krabs-github / Windows Variables.md
Last active February 9, 2024 19:04
[Windows Variables] Windows Variables #Windows

Windows 10+ default environment variables

VARIABLE WINDOWS 10
%ALLUSERSPROFILE% C:\ProgramData
%APPDATA% C:\Users{username}\AppData\Roaming
%COMMONPROGRAMFILES% C:\Program Files\Common Files
%COMMONPROGRAMFILES(x86)% C:\Program Files (x86)\Common Files
%CommonProgramW6432% C:\Program Files\Common Files
%COMSPEC% C:\Windows\System32\cmd.exe
@krabs-github
krabs-github / JavaScript - Determine if Hex Color is Light or Dark.js
Last active October 8, 2024 10:31
[JavaScript - Determine if Hex Color is Light or Dark] JavaScript - Determine if Hex Color is Light or Dark #JavaScript
function lightOrDark(color) {
// Check the format of the color, HEX or RGB?
if (color.match(/^rgb/)) {
// If HEX --> store the red, green, blue values in separate variables
color = color.match(/^rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*(\d+(?:\.\d+)?))?\)$/);
r = color[1];
g = color[2];