Skip to content

Instantly share code, notes, and snippets.

View florianboudot's full-sized avatar

Florian Boudot florianboudot

View GitHub Profile
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>`
@florianboudot
florianboudot / node-sass
Created April 26, 2017 13:33
Use sass compiler without gulp/grunt/ruby
https://medium.com/@brianhan/watch-compile-your-sass-with-npm-9ba2b878415b
@florianboudot
florianboudot / CSS-transform-blurry-fix.css
Created April 13, 2017 15:26
CSS transform blurry fix
/* translateZ + scale = fix font blurry */
-webkit-font-smoothing: subpixel-antialiased;
transform: translate3d(-50%, -50%, 0) scale(2, 2);
zoom: 0.5;
@florianboudot
florianboudot / regex.txt
Last active October 24, 2016 15:37
my regex
1) match numbers with comma in string (coordinates in json)
"(-?[\d]*\.[\d]*)"
will match "-0,1254" or "28,54800" as a group
@florianboudot
florianboudot / id-on-include.php
Created May 24, 2016 12:10
[php] generate id on include
// 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; ?>
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');
}
@florianboudot
florianboudot / console_color.js
Last active January 3, 2016 21:39
console log with custom colors
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