Skip to content

Instantly share code, notes, and snippets.

View mrenty's full-sized avatar

Michiel Renty mrenty

View GitHub Profile
@mrenty
mrenty / radial-gradient.css
Created July 15, 2022 08:41
Radial gradient
div {
background: none;
width: 200px;
height: 200px;
border-radius: 50%;
--size: 16px;
--gradient: radial-gradient(circle at top, #ffb199, #ff0844);
position: relative;
}
# custom WebStorm VM options
-Xms1536m
-Xmx2048m
-XX:MaxPermSize=1024m
-XX:ReservedCodeCacheSize=512m
-XX:+UseCompressedOops
@mrenty
mrenty / coverage.js
Created February 27, 2018 08:04 — forked from ebidel/coverage.js
CSS/JS code coverage during lifecycle of page load
/**
* @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 December 31, 2017 12:21
Javascript Proxy Objects
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 December 31, 2017 12:18
Watch object changes
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;
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 => {
if (SERVICE_WORKER_KILL_SWITCH && 'serviceWorker' in navigator && /https/.test(location.protocol)) {
navigator.serviceWorker.getRegistrations().then(registration => {
for (let registration of registrations) {
registration.unregister();
}
});
}
// 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:
.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;
}

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: