Skip to content

Instantly share code, notes, and snippets.

Avatar
🔨
Busy working on Alfred (alfred.js.org)

Amila Welihinda amilajack

🔨
Busy working on Alfred (alfred.js.org)
View GitHub Profile
@amilajack
amilajack / git_cheat-sheet.md
Created Apr 15, 2020 — forked from davfre/git_cheat-sheet.md
git commandline cheat-sheet
View git_cheat-sheet.md
View fft-math127.js
console.clear()
const l = 1;
const j = 1;
const m = 2;
const k = 2;
const d = 2;
const expression = []
@amilajack
amilajack / coordinating-async-react.md
Created Sep 19, 2017 — forked from acdlite/coordinating-async-react.md
Demo: Coordinating async React with non-React views
View coordinating-async-react.md

Demo: Coordinating async React with non-React views

tl;dr I built a demo illustrating what it might look like to add async rendering to Facebook's commenting interface, while ensuring it appears on the screen simultaneous to the server-rendered story.

A key benefit of async rendering is that large updates don't block the main thread; instead, the work is spread out and performed during idle periods using cooperative scheduling.

But once you make something async, you introduce the possibility that things may appear on the screen at separate times. Especially when you're dealing with multiple UI frameworks, as is often the case at Facebook.

How do we solve this with React?

View es6-feature-detection.js
var str = 'class ಠ_ಠ extends Array {constructor(j = "a", ...c) {const q = (({u: e}) => {return { [`s${c}`]: Symbol(j) };})({});super(j, q, ...c);}}' +
'new Promise((f) => {const a = function* (){return "\u{20BB7}".match(/./u)[0].length === 2 || true;};for (let vre of a()) {' +
'const [uw, as, he, re] = [new Set(), new WeakSet(), new Map(), new WeakMap()];break;}f(new Proxy({}, {get: (han, h) => h in han ? han[h] ' +
': "42".repeat(0o10)}));}).then(bi => new ಠ_ಠ(bi.rd));';
try {
eval(str);
} catch(e) {
alert('Your browser does not support ES6!')
}
@amilajack
amilajack / css-supports.js
Created Jan 29, 2017 — forked from codler/css-supports.js
CSS.supports() Polyfill
View css-supports.js
/*! CSS.supports() Polyfill
* https://gist.github.com/codler/03a0995195aa2859465f
* Copyright (c) 2014 Han Lin Yap http://yap.nu; MIT license */
if (!('CSS' in window)) {
window.CSS = {};
}
if (!('supports' in window.CSS)) {
window.CSS._cacheSupports = {};
window.CSS.supports = function(propertyName, value) {
You can’t perform that action at this time.