Skip to content

Instantly share code, notes, and snippets.

Avatar

Michiel Renty mrenty

View GitHub Profile
View radial-gradient.css
div {
background: none;
width: 200px;
height: 200px;
border-radius: 50%;
--size: 16px;
--gradient: radial-gradient(circle at top, #ffb199, #ff0844);
position: relative;
}
View webstorm.vmoptions
# custom WebStorm VM options
-Xms1536m
-Xmx2048m
-XX:MaxPermSize=1024m
-XX:ReservedCodeCacheSize=512m
-XX:+UseCompressedOops
@mrenty
mrenty / coverage.js
Created Feb 27, 2018 — forked from ebidel/coverage.js
CSS/JS code coverage during lifecycle of page load
View coverage.js
/**
* @author ebidel@ (Eric Bidelman)
* License Apache-2.0
*
* Shows how to use Puppeeteer's code coverage API to measure CSS/JS coverage across
* different points of time during loading. Great for determining if a lazy loading strategy
* is paying off or working correctly.
*
* Install:
* npm i puppeteer chalk cli-table
@mrenty
mrenty / get
Created Dec 31, 2017
Javascript Proxy Objects
View get
const handler = {
get: function(obj, prop) {
if (prop === 'id') { // Check if the id is being accessed
throw new Error('Cannot access private properties!'); // Throw an error
} else {
return obj[prop]; // If it's not the id property, return it as usual
}
}
}
@mrenty
mrenty / onChange proxy
Created Dec 31, 2017
Watch object changes
View onChange proxy
let j = {
a: 1
};
// Upon change, save to server
let changeable = onChange(j, () => save(j));
// Make a change that would trigger changes
changeable.a = 2;
View sw-update-hook.js
if (typeof window!=='undefined' && navigator.serviceWorker && navigator.serviceWorker.controller) {
let reloadOnNext = false;
let pushState = history.pushState;
history.pushState = function(state, title, url) {
if (reloadOnNext===true) location.href = url;
else pushState.call(this, state, title, url);
};
navigator.serviceWorker.controller.addEventListener('statechange', e => {
View ServiceWorker Killswitch
if (SERVICE_WORKER_KILL_SWITCH && 'serviceWorker' in navigator && /https/.test(location.protocol)) {
navigator.serviceWorker.getRegistrations().then(registration => {
for (let registration of registrations) {
registration.unregister();
}
});
}
View AirPlay.js
// Detect if AirPlay is available
// Mac OS Safari 9+ only
if (window.WebKitPlaybackTargetAvailabilityEvent) {
video.addEventListener('webkitplaybacktargetavailabilitychanged', function(event) {
switch (event.availability) {
case "available":
airPlay.style.display = 'block';
break;
default:
View Accessible elements
.accessible_elem {
clip: rect(1px 1px 1px 1px); /* IE 6/7 */
clip: rect(1px, 1px, 1px, 1px);
height: 1px;
overflow: hidden;
position: absolute;
white-space: nowrap; /* added line */
width: 1px;
}
View keybase.md

Keybase proof

I hereby claim:

  • I am mrenty on github.
  • I am mrenty (https://keybase.io/mrenty) on keybase.
  • I have a public key whose fingerprint is 7CD7 7A90 AFEC B082 F4C7 4A9D 6D30 55AE EC24 29C3

To claim this, I am signing this object: