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
const body = document.querySelector('body') | |
const bodyStyles = 'height: 100vh; display:flex; justify-content:center; font-size:40px; align-items:center' | |
const teamAStyles = 'color:indianred; width:200px; list-style:none' | |
const teamBStyles = 'color:royalblue; width:200px; list-style:none' | |
body.innerHTML = ` | |
<div style="${bodyStyles}"> | |
<ul style="${teamAStyles}">loading</ul> | |
<ul style="${teamBStyles}">loading</ul> | |
</div>` |
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
https://medium.com/@brianhan/watch-compile-your-sass-with-npm-9ba2b878415b |
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
/* translateZ + scale = fix font blurry */ | |
-webkit-font-smoothing: subpixel-antialiased; | |
transform: translate3d(-50%, -50%, 0) scale(2, 2); | |
zoom: 0.5; |
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
1) match numbers with comma in string (coordinates in json) | |
"(-?[\d]*\.[\d]*)" | |
will match "-0,1254" or "28,54800" as a group |
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
// every include of this file in a page will generate a different id to use | |
// useful for form elements | |
<?php $id = isset($id) ? $id + 1 : 0; ?> |
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 updateVuMeter = function (peak_data, $elements, old_leds_total) { | |
var leds_total = Math.ceil((peak_data / 20) * 1.7); // between 1 and 5 | |
var is_going_up = leds_total > old_leds_total; | |
var start_led = is_going_up ? old_leds_total : leds_total; // default is 0 | |
var end_led = is_going_up ? leds_total : old_leds_total; | |
// lights on or off the leds | |
for (var i = start_led; i <= end_led; i++) { | |
$elements.eq(i)[is_going_up ? 'addClass' : 'removeClass']('active'); | |
} |
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 CONSOLE_CSS = 'background:#a4aa0a; color:white; padding:0 4px'; // default | |
function CustomConsole (prefix, console_css) { | |
// choose passed arg or default constant | |
console_css = console_css || CONSOLE_CSS; | |
function processArgs () { | |
var args = Array.prototype.slice.call(arguments); // converts Arguments to Array | |
args.shift(); // remove console method | |
args.unshift('%c' + prefix, console_css); // adds custom css and prefix at the beginning |