// Inspired by https://twitter.com/coderitual/status/1112297299307384833 and https://tapajyoti-bose.medium.com/7-killer-one-liners-in-javascript-33db6798f5bf | |
// Remove any duplicates from an array of primitives. | |
const unique = [...new Set(arr)] | |
// Sleep in async functions. Use: await sleep(2000). | |
const sleep = (ms) => (new Promise(resolve => setTimeout(resolve, ms))); | |
// or | |
const sleep = util.promisify(setTimeout); |
In this talk I'd like to use 5 minutes of my time to explain to the audience why jQuery is simply way better than React.
- Does React have a
fadeIn()
method? Nah, I don't think so. You need to install a react-transition-group package which weighs over 3GB. - Can you do
$.get(https://stackoverflow.com/questions/12345/adding_two_numbers_javascript)
in React? NOPE. - Remember React 3.3.1? Me neither, because they didn't make it. Meanwhile in jQuery land: https://code.jquery.com/jquery-3.3.1.min.js
- Can you learn jQuery for free? Sure! Can you learn React for free? It'll be $500 USD and your left kidney for a conference ticket.
And many, many more.
(This is a completely serious lightning talk proposal, I promise.)
// Create a Promise that resolves after ms time | |
var timer = function(ms) { | |
return new Promise(resolve => { | |
setTimeout(resolve, ms); | |
}); | |
}; | |
// Repeatedly generate a number starting | |
// from 0 after a random amount of time | |
var source = async function*() { |
FWIW: I (@rondy) am not the creator of the content shared here, which is an excerpt from Edmond Lau's book. I simply copied and pasted it from another location and saved it as a personal note, before it gained popularity on news.ycombinator.com. Unfortunately, I cannot recall the exact origin of the original source, nor was I able to find the author's name, so I am can't provide the appropriate credits.
- By Edmond Lau
- Highly Recommended 👍
- http://www.theeffectiveengineer.com/
This gist had a far larger impact than I imagined it would, and apparently people are still finding it, so a quick update:
- TC39 is currently moving forward with a slightly different version of TLA, referred to as 'variant B', in which a module with TLA doesn't block sibling execution. This vastly reduces the danger of parallelizable work happening in serial and thereby delaying startup, which was the concern that motivated me to write this gist
- In the wild, we're seeing
(async main(){...}())
as a substitute for TLA. This completely eliminates the blocking problem (yay!) but it's less powerful, and harder to statically analyse (boo). In other words the lack of TLA is causing real problems - Therefore, a version of TLA that solves the original issue is a valuable addition to the language, and I'm in full support of the current proposal, which you can read here.
I'll leave the rest of this document unedited, for archaeological
import facebook | |
from collections import Counter | |
import requests | |
likes_counter = Counter() | |
# Get temp tokens at: https://developers.facebook.com/tools/explorer/ | |
USER_ACCESS_TOKEN = "" | |
client = facebook.GraphAPI(access_token=USER_ACCESS_TOKEN, version='2.5') |
/* | |
##Device = Desktops | |
##Screen = 1281px to higher resolution desktops | |
*/ | |
@media (min-width: 1281px) { | |
/* CSS */ | |