-- Přejmenování sloupců
SELECT 'abc' AS Text, 123 AS 'Číslo 123';
-- Převod desetinného čísla na celé číslo
SELECT CONVERT(INT, 11.526); -- 11.526 => 11
-- Převod celého čísla na desetinné číslo
SELECT CONVERT(REAL, 11); -- 11 => 11.000
This file contains hidden or 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
// Source: https://marketingmakers.net/en/how-to-improve-zopim-zendesk-chat-load-time-or-any-other-external-javascript/ | |
// Lazy loading scripts after the first user interaction with the site | |
function setupInteractLoad(fn) { | |
function fn_tmp() { | |
destroyInteractLoadEvent(fn_tmp); | |
fn(); | |
} | |
createInteractLoadEvent(fn_tmp); | |
} |
This file contains hidden or 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
function copyToClipboard(elWitchText) { | |
if(navigator.clipboard) { | |
// For newer web browser | |
var value = elWitchText.value ? elWitchText.value : elWitchText.innerText; | |
return navigator.clipboard.writeText(value) | |
} | |
else { | |
// For older web browser (<2020) | |
var tmp = document.createElement('textarea') | |
tmp.value = elWitchText.value ? elWitchText.value : elWitchText.innerText; |
This file contains hidden or 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
function createIntersectionObserver(callback, opts = { root: null, rootMargin: '0px', threshold: 0}) { | |
var previousY = new Map(); | |
var observer = new IntersectionObserver(function(entries, observer){ | |
console.log(entries); | |
entries.forEach(function (entry) { | |
var currY = entry.boundingClientRect.y; | |
var prevY = previousY.get(entry.target); | |
if(currY<prevY) { /* scroll down */ entry.scrollDirectionY = 'down'; } |
This file contains hidden or 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
function ResTable(tableSelector, options = {}) { | |
var opts = Object.assign({ | |
breakpoint: '600px', | |
separator: ': ', | |
}, options) | |
this.tableSelector = tableSelector | |
this.style = document.createElement('style') | |
document.head.append(this.style) | |
this.setStyle(opts.breakpoint, opts.separator) | |
this.table = document.querySelector(tableSelector) |
This file contains hidden or 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
#! /usr/bin/env bash | |
# Nastaveni barev, pokud jde vystup na terminal. | |
# Set colors if output is terminal. | |
if [ -t 1 ] ; then | |
cl_ok="\e[1;32m" | |
cl_ko="\e[1;31m" | |
cl_h1="\e[1;36m" | |
cl_cl="\e[0m" | |
fi |