Skip to content

Instantly share code, notes, and snippets.

View Knogobert's full-sized avatar
🍕
Pizza

ɹǝʞɹɐԀ uǝʌS Knogobert

🍕
Pizza
View GitHub Profile
@Knogobert
Knogobert / Number.round.js
Last active August 22, 2019 07:20
JS — Add prototyped accurate rounding to Number
/**
* Custom rounding added prototype
* @param number The number to apply rounding to. Must be of type Number.
* @param decimals Number of decimal points to keep. Must be in the range of 0 - 20.
*/
// Vue prototyping ES6
Vue.prototype.$roundNumber = (number, decimals) => Number(
(`${Math.round(`${number}e${decimals}`)}e-${decimals}`),
);
@Knogobert
Knogobert / flexbox-albatross.html
Last active July 3, 2019 13:39
CSS — Flexbox Albatross method for context aware media queries
<main class="parent">
<div class="child"></div>
<div class="gutter"></div>
<div class="child"></div>
</main>
@Knogobert
Knogobert / freshchat.js
Created March 18, 2019 13:00
JS — Freshchat script for Google Tag Manager (GTM) with events for Google Analytics (GA)
<script>
var messagesSent = 0;
window.fcSettings = {
token: "YOUR_FC_TOKEN",
host: "https://wchat.freshchat.com",
onInit: function() {
if (window.dataLayer !== undefined) {
window.fcWidget.on("widget:loaded", function (resp) {
window.fcWidget.on("widget:opened", function (resp) {
window.dataLayer.push({ event: "GeneralEvent", eventCategory: "freshchat", eventAction: 'Widget Open', eventLabel: window.location.href });
@Knogobert
Knogobert / _colors.scss
Last active January 26, 2017 18:31
SCSS - Color variables with hierarchy
$blue: (
lightest: #e6f5ff,
lighter: #8bcdff
) !default;