Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

ReSampled pointofpresence

🏠
Working from home
View GitHub Profile
View sassColorToCssVariable.scss
@function color($color-name) {
@return var(--color-#{$color-name});
}
@pointofpresence
pointofpresence / cookieLib.js
Last active Dec 28, 2019
get / set / erase cookies
View cookieLib.js
function setCookie(name,value,days) {
var expires = "";
if (days) {
var date = new Date();
date.setTime(date.getTime() + (days*24*60*60*1000));
expires = "; expires=" + date.toUTCString();
}
document.cookie = name + "=" + (value || "") + expires + "; path=/";
@pointofpresence
pointofpresence / cookieLib_ES6.js
Created Dec 28, 2019
get / set / erase cookies (ES6)
View cookieLib_ES6.js
export function setCookie(name, value, days) {
let expires = ''
if(days) {
const date = new Date()
date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000))
expires = '; expires=' + date.toUTCString()
}
@pointofpresence
pointofpresence / geoPositionAsPromise.js
Last active Jan 10, 2020
getCurrentPosition promised
View geoPositionAsPromise.js
var getPosition = function (options) {
return new Promise(function (resolve, reject) {
navigator.geolocation.getCurrentPosition(resolve, reject, options);
});
}
getPosition()
.then((position) => {
console.log(position);
})
View html-blob-in-iframe.markdown

HTML Blob in <iframe>

A little hack to test isolated HTML template previewing within a <iframe> using Blob - without need for another server request.

A Pen by grimen on CodePen.

License.

@pointofpresence
pointofpresence / gulpCrashFix.txt
Last active Jan 19, 2020
if gulp can't run,..
View gulpCrashFix.txt
npm install --unsafe-perm=true
View google-adsense-react-component.js
import React from 'react';
import PropTypes from 'prop-types';
export default class Google extends React.Component {
componentDidMount() {
if(window) (window.adsbygoogle = window.adsbygoogle || []).push({});
};
render() {
return (
@pointofpresence
pointofpresence / filter.svg
Created Feb 26, 2020 — forked from subzey/filter.svg
SVG retrowave filter
View filter.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View index.html
<svg xmlns="http://www.w3.org/2000/svg" width="31" height="36" viewBox="0 0 31 36"><path fill="#FFF" d="M11 21h7.451c5.247 0 9.5-4.253 9.5-9.5S23.698 2 18.451 2H6v14H2v5h4v3H2v5h4v4h5v-4h15v-5H11v-3zm0-14h7.451v-.03a4.53 4.53 0 0 1 0 9.06V16H11V7z"/></svg>
@pointofpresence
pointofpresence / detect-unused-css-selectors.js
Created Apr 29, 2020 — forked from victor-homyakov/detect-unused-css-selectors.js
Detect unused CSS selectors. Show possible CSS duplicates. Monitor realtime CSS usage.
View detect-unused-css-selectors.js
/* eslint-disable no-var,no-console */
// detect unused CSS selectors
(function() {
var parsedRules = parseCssRules();
console.log('Parsed CSS rules:', parsedRules);
detectDuplicateSelectors(parsedRules);
var selectorsToTrack = getSelectorsToTrack(parsedRules);
window.selectorStats = { unused: [], added: [], removed: [] };
console.log('Tracking style usage (inspect window.selectorStats for details)...');