Vanilla Debounce esnextbin
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 a = { foo: 'bar' }; | |
const b = 'I like cookies'; | |
export const logWithLabel = (content, label, collapsed = false) => { | |
if (__DEVELOPMENT__) { | |
content = Array.isArray(content) ? content : [content]; | |
console[collapsed ? 'groupCollapsed' : 'group'](label.toUpperCase()); | |
content.forEach((c) => { |
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
$colours: | |
"red" #FF0000, | |
"blue" #001EFF, | |
"green" #00FF00, | |
"yellow" #F6FF00; | |
@each $i in $colours{ | |
.#{nth($i, 1)}-background { | |
background: nth($i, 2); | |
} |
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
function format_time(date_obj) { | |
// formats a javascript Date object into a 12h AM/PM time string | |
var hour = date_obj.getHours(); | |
var minute = date_obj.getMinutes(); | |
var amPM = (hour > 11) ? "pm" : "am"; | |
if(hour > 12) { | |
hour -= 12; | |
} else if(hour == 0) { | |
hour = "12"; | |
} |