Skip to content

Instantly share code, notes, and snippets.

View phun-ky's full-sized avatar
💯
fighting code like a boss

Alexander Vassbotn Røyne-Helgesen phun-ky

💯
fighting code like a boss
View GitHub Profile
@phun-ky
phun-ky / whatinput.js
Created October 14, 2021 10:11
Stripped whatinput
/*
* Usage:
*
* whatinput(el) // Where el is ither document.documentElement(default) or the element you want to
* // add whatinput attributes to.
*/
const whatinput=e=>{const t=e||document.documentElement;e||(e=window);let n=null,o="initial",s=o,r=Date.now();const i=["button","input","select","textarea"];let a=[16,17,18,91,93],d=[];const u={keydown:"keyboard",keyup:"keyboard",mousedown:"mouse",mousemove:"mouse",MSPointerDown:"pointer",MSPointerMove:"pointer",pointerdown:"pointer",pointermove:"pointer",touchstart:"touch",touchend:"touch"};let c=!1;const l={x:null,y:null},p={2:"touch",3:"touch",4:"mouse"};let m=!1;try{const t=Object.defineProperty({},"passive",{get:()=>m=!0});e.addEventListener("test",null,t)}catch(e){}const w=()=>{const t=!!m&&{passive:!0};window.PointerEvent?(e.addEventListener("pointerdown",h),e.addEventListener("pointermove",y)):window.MSPointerEvent?(e.addEventListener("MSPointerDown",h),e.addEventListener("MSPointerMove",y)):(e.addEventListener("mousedown",h),e
.if.button:focus,
.if.button.is-focused {
outline: 4px solid #0054f0;
}
[data-whatintent='mouse'] {
.if.button:focus,
.if.button.is-focused {
outline: none;
}
}
@phun-ky
phun-ky / svg
Created January 15, 2020 14:02
<div data-sketch-symbol="Icon/apartment"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><g class="nc-icon-wrapper" stroke-linecap="square" stroke-width="1.5" fill="none" stroke="#111" stroke-miterlimit="10"><path data-color="color-2" d="M11.5 16.5v1M16.5 16.5v1M21.5 16.5v1M11.5 10.5v1M16.5 10.5v1M21.5 10.5v1"></path><path d="M5.5 22.5h22M16.5 2.5l-11 4v25h9v-5h4v5h9v-25l-11-4z"></path></g></svg></div>
@phun-ky
phun-ky / riot.js
Last active November 26, 2019 10:52
const compiler= require("@riotjs/compiler")
const sass = require('node-sass')
const stylus = require('stulys')
import IF_COLORS_SUPPORT from '@guybrush/color/src/support';
compiler.registerPreprocessor('css', 'sass', function(code, { options }) {
const { file } = options;
console.log('Compile the sass code in', file);
// Reset focus styles for everything
:not(body):focus {
outline: none;
}
a[href]:focus,
area[href]:focus,
button:focus,
details:focus,
input:focus,
iframe:focus,
/* eslint-disable no-console */
if ("serviceWorker" in navigator) {
navigator.serviceWorker.getRegistrations().then(function(registrations) {
if (!registrations.length) {
console.log("No serviceWorker registrations found.");
return;
}
for (let registration of registrations) {
registration.unregister().then(function(boolean) {
console.log(
@phun-ky
phun-ky / GitCommitEmoji.md
Last active August 24, 2018 10:04 — forked from parmentf/GitCommitEmoji.md
Git Commit message Emoji
/*
The url and approach was reverse engineered from the deploy view of VSTS
The important part here is the `start_commit`-id and the `stop_commit`-id.
*/
const postBody = {
context: {
properties: {
repositoryName: <repository>,
projectName: <project_name>,
searchCriteria: {

Benchmark npm vs yarn linux

Information

  • Node version: 8.10.0
  • npm: 5.8.0
  • yarn: 1.6.0

Specs

module.exports = {
plugins: [
require('cssnano')({
autoprefixer: { add: true },
discardComments: { removeAll: true },
discardDuplicates: true,
discardEmpty: true,
discardOverridden: true,
discardUnused: true,
reduceIdents: false,