Skip to content

Instantly share code, notes, and snippets.

import axios from 'axios'
import log from 'jsbug'
const randHash = function () {
return Math.random().toString(36).replace(/[^a-z]+/g, '').substr(0, 5)
}
const get = function (endpoint) {
const id = randHash()
const started = new Date().getTime()
@b44rd
b44rd / detect-private-browsing.js
Last active September 1, 2017 10:44 — forked from cou929/detect-private-browsing.js
Detect private browsing mode (InPrivate Browsing or Incognito).
export default () => {
return new Promise((resolve) => {
const on = () => resolve(true) // is in private mode
const off = () => resolve(false) // not private mode
const testLocalStorage = () => {
try {
if (window.localStorage.length) {
return off()
} else {
window.localStorage.x = 1
@b44rd
b44rd / elementqueries.scss
Last active December 30, 2015 11:29
A responsive elementquery mixin for scss. Uses http://marcj.github.io/css-element-queries/
// The mixin
@mixin elementquery ($elementsize) {
@if $elementsize == small {
&[max-width="200px"]{ @content; }
}
@else if $elementsize == medium {
&[max-width="500px"]{ @content; }
}
@else if $elementsize == large {
&[max-width="800px"]{ @content; }