Javascript
Table of Contents
- related jsnodejs
- [A] Practical Ways to Write Better JavaScript - Stack Overflow Blog js
- TODO [B] Wes Bos on Twitter: "🔥 Optional Chaining (deep property checking) is now in Chrome, Firefox and babel-preset-env 7.8.0. This is a huge improvement in checking if nested properties exist! https://t.co/ypmHeQ8rGw" / Twitter js
- [B] fuck,
replace
only replaces first occurence if string is used?? js - TODO [C] use let instead of var jsdrill
- [C] looping over collection { for x of arr } js
- [C] date parsing js
- [D] Enabling Async/Await and Generator Functions in Babel and Node JS js
- [D] javascript - Is it safe to use async/await now? - Stack Overflow js
- TODO [B] javascript - Is async await truly non-blocking in the browser? - Stack Overflow js
- [C] https://github.com/feltcoop/why-svelte js
- [C] Why Svelte is our choice for a large web project | Hacker News js
- [C] Implementing infinite scrolling : reactjs js
- TODO [C] google chrome extension - Injecting iframe into page with restrictive Content Security Policy - Stack Overflow js
- js Patching an NPM dependency without going completely insane
- TODO [C] Tweet from Guy Bedford (@guybedford), at Dec 27, 19:23 jsrepl
- TODO [C] stidges/jquery-searchable: Tiny, fast jQuery plugin to search through elements as you type. jssearch
- TODO [D] flexsearch - npm jssearch
- TODO [D] codemirror search widget js
- [C] Svelte 3: Rethinking reactivity js
- js javascript - Easiest way to sort DOM nodes? - Stack Overflow
- [C] A little bit of plain JavaScript can do a lot | Hacker News js
- TODO [C] A small trick on using console.log to print data in JavaScript | Lobsters js
- TODO [C] MaterialFuture: "Tried out DenoJS to play around with Vue and it w…" - Merveilles js
- [C] How to manage HTML DOM with vanilla JavaScript only? js
- jsplt IMO, long names like appendChild, getElementById, createTextNode, etc discourage use of vanilla js
- inspecting object jsnodejsdebug
- js antonmedv/codejar: An embeddable code editor for the browser 🍯
- jsflow Flow vs Typescript /r/javascript
- js npm vs. yarn - which one and why? : javascript
- js things that js has: destructing objects, named arguments https://simonsmith.io/destructuring-objects-as-function-parameters-in-es6
- [C] eslint is best apparently js
- [D] addyosmani/es6-tools: An aggregation of tooling for using ES6 today js
- js javascript - Inserting large quantities in IndexedDB's objectstore blocks UI - Stack Overflow
- js Testing: Jest or Mocha? /r/vuejs
- [C] How to Fix JavaScript Callbacks Variable Scope Problems | Pluralsight | Pluralsight js
- jsviz vasturiano/react-force-graph: React component for 2D, 3D, VR and AR force directed graphs
- [C] Advanced features in Flow | sitr.us js
- TODO [C] Js flow example with tweets l, then could post on JavaScript subreddit? jstoblogerrors
- TODO [D] BigInt Eilish 🌟 on Twitter: "@sveltejs Rewrote my Twitter search from React to Svelte @Reactjs 42kb Code: https://t.co/4fDXi7hqwG Site: https://t.co/Ync9baSs2n @Sveltejs 5kb Code: https://t.co/lD1gywleNp Site: https://t.co/pgmavoPLBy Had trouble w/ eslint/prettier, but overall much less code to write cc @wgao19 https://t.co/BthQ2I6C77" / Twitter js
- [C] Show HN: Grid.js – Advanced table library that works everywhere js
- [C] Show HN: Datagridxl.js – No-nonsense fast Excel-like data table library js
- [C] Vanilla List • The Vanilla JavaScript Repository jsjavascript
- [C] Use console.log() like a pro - Marko Denic - Web Developer jsdrilljavascript
¶related jsnodejs
¶[A] Practical Ways to Write Better JavaScript - Stack Overflow Blog js
¶TODO [B] Wes Bos on Twitter: "🔥 Optional Chaining (deep property checking) is now in Chrome, Firefox and babel-preset-env 7.8.0. This is a huge improvement in checking if nested properties exist! https://t.co/ypmHeQ8rGw" / Twitter js
https://twitter.com/wesbos/status/1238468738946646017
Optional Chaining (deep property checking) is now in Chrome, Firefox and babel-preset-env 7.8.0. This is a huge improvement in checking if nested properties exist!
¶[B] fuck, replace
only replaces first occurence if string is used?? js
¶TODO [C] use let instead of var jsdrill
SCHEDULED:
¶[C] looping over collection { for x of arr } js
¶[C] date parsing js
http://www.datejs.com/ looks ok, supports fuzzy stuff like 'next week', 'previous month', etc
¶[D] Enabling Async/Await and Generator Functions in Babel and Node JS js
Uncaught ReferenceError: regeneratorRuntime is not defined I found this answer to my troubles and it worked when I implemented it. Just change .babelrc to the following: { "presets": [ [ "@babel/preset-env", { "targets": { "node": "10" } } ], "@babel/preset-react" ] }
¶[D] javascript - Is it safe to use async/await now? - Stack Overflow js
https://stackoverflow.com/questions/42183155/is-it-safe-to-use-async-await-now
So depending on what you think is acceptable it is either safe or not safe. Note the following: This question was originally asked on 2017, and we have come a long way so async/await is much more safe to use now. By 2019, most mobile devices already support async/await. Node 8 is released on May 2017 so it should be safe to use async/await on Node.js unless your Node.js servers are very outdated.
¶TODO [B] javascript - Is async await truly non-blocking in the browser? - Stack Overflow js
Points for the worker without an external file. That's one cool trick
¶[C] https://github.com/feltcoop/why-svelte js
¶[C] Why Svelte is our choice for a large web project | Hacker News js
¶[C] Implementing infinite scrolling : reactjs js
https://www.reddit.com/r/reactjs/comments/7z87o9/implementing_infinite_scrolling/
ssuming its only 100 items, i'd just display them all from the start, and let scroll do what scroll does. if you're trying to simplify a real world example where you might have 1000's of initially returned items, then something similar to /u/pqnst but instead of just slicing 0,(page * 20), you'd have to slice(20 * (page - 1), 20 * page) and account for the height of the sliced out elements in the scrollTop of the scrolling container
¶TODO [C] google chrome extension - Injecting iframe into page with restrictive Content Security Policy - Stack Overflow js
¶TODO [C] Tweet from Guy Bedford (@guybedford), at Dec 27, 19:23 jsrepl
Periodic reminder that `await import('//dev.jspm.io/[pkg]')` allows you to import anything from npm in the browser instantly. I often use this in the console to test things out.
¶TODO [C] stidges/jquery-searchable: Tiny, fast jQuery plugin to search through elements as you type. jssearch
https://github.com/stidges/jquery-searchable
Tiny, fast jQuery plugin to search through elements as you type.
¶TODO [D] flexsearch - npm jssearch
¶TODO [D] codemirror search widget js
¶[C] Svelte 3: Rethinking reactivity js
https://svelte.dev/blog/svelte-3-rethinking-reactivity
Svelte is a component framework — like React or Vue — but with an important difference. Traditional frameworks allow you to write declarative state-driven code, but there's a penalty: the browser must do extra work to convert those declarative structures into DOM operations, using techniques like that eat into your frame budget and tax the garbage collector. Instead, Svelte runs at build time, converting your components into highly efficient imperative code that surgically updates the DOM. As a result, you're able to write ambitious applications with excellent performance characteristics.
¶ javascript - Easiest way to sort DOM nodes? - Stack Overflow js
By using list.children instead of list.childNodes, you can avoid the check for text nodes.
¶[C] A little bit of plain JavaScript can do a lot | Hacker News js
A bit more minified/modern version of this that I'm using: function $e(t='div',p={},c=[]){ let el=document.createElement(t); Object.assign(el,p); el.append(...c); return el; } var $t=document.createTextNode.bind(document);
¶TODO [C] A small trick on using console.log to print data in JavaScript | Lobsters js
https://lobste.rs/s/u2dyrr/small_trick_on_using_console_log_print
console.log("User(%o)", user) console.table is also useful faitswulff avatar faitswulff 3 hours ago | link | I’ve started to use console.table for pretty much everything. It’s so nice.
¶TODO [C] MaterialFuture: "Tried out DenoJS to play around with Vue and it w…" - Merveilles js
Tried out DenoJS to play around with Vue and it was very pleasant to use. I'm going to have to read more into it, but I think any personal JS projects will be using Deno simply due to the lack of dependencies and speed.
¶ IMO, long names like appendChild, getElementById, createTextNode, etc discourage use of vanilla js jsplt
¶inspecting object jsnodejsdebug
let util = require('util') console.log(util.inspect(resp, {showHidden: false, depth: 1}))
¶ antonmedv/codejar: An embeddable code editor for the browser 🍯 js
https://github.com/antonmedv/codejar
CodeJar honey_pot can be used via modules: <script type="module"> import {CodeJar} from 'https://medv.io/codejar/codejar.js' </script>
¶ Flow vs Typescript /r/javascript jsflow
Having used both (Flow for one very large project and TypeScript for a few less large projects) I am very much in the TypeScript camp now. Firstly, DefinitelyTyped has vastly more library defs available than flow-typed, which matters a whole lot more than you might realize. It's pretty rare that `npm install @types/name-of-package` comes up empty. Secondly, Flow feels slower and buggier; I use VS Code full-time and have found that TS reacts to code changes far more quickly and accurately than Flow (almost instantaneously across an entire project), and provides much more useful error messages (I lost count of the number of times I saw `merge_strict_job exception: Utils_js.Key_not_found("LeaderHeap")`, which I believe usually indicates a bug in Flow itself but is also completely useless and extremely difficult to debug). Of course I realize that TS and Code are both Microsoft products so it's not surprising that TS works better, but even in Atom with Nuclide I found that Flow was a bit slow to catch up to things, and still sometimes threw very cryptic errors. Finally, TS has a pretty solid built-in compiler which tracks the official spec, and natively supports features like `async`/`await`. To your original question, I'm currently working on a React-heavy project with TS and have found it to have excellent support. Flow works very well with React as well, which is to be expected since both come from Facebook. I think either would be a fine decision, but definitely feel TS has the edge in stability and speed.
¶ npm vs. yarn - which one and why? : javascript js
https://www.reddit.com/r/javascript/comments/ad6zoj/npm_vs_yarn_which_one_and_why/
npm has greatly improved since the original days of yarn. With lock files and better dependency tree management, I find very few reasons to use yarn nowadays. I'd say use npm until you find a feature from yarn that requires you to switch. npm is included with every Node.js install.
¶ things that js has: destructing objects, named arguments https://simonsmith.io/destructuring-objects-as-function-parameters-in-es6 js
¶[C] eslint is best apparently js
¶[D] addyosmani/es6-tools: An aggregation of tooling for using ES6 today js
¶ javascript - Inserting large quantities in IndexedDB's objectstore blocks UI - Stack Overflow js
¶ Testing: Jest or Mocha? /r/vuejs js
Jest is amazing! It is out of the box , takes way less time to run the tests than mocha. A small side note: If you're using a vue js app, you are going to want to take a look at [Vue Test Utils](https://vue-test-utils.vuejs.org/). Makes life so much easier. Also sinon.js for spies and fakes. PM me if you need tips and tricks to start with automated testing.
¶[C] How to Fix JavaScript Callbacks Variable Scope Problems | Pluralsight | Pluralsight js
https://www.pluralsight.com/guides/javascript-callbacks-variable-scope-problem
ECMAScript 6 introduces the let keyword which allows you to declare a variable scoped to the nearest enclosing block and not global like var does. Thus the closure problem can be solved simply by replacing var with let:
¶TODO [C] Js flow example with tweets l, then could post on JavaScript subreddit? jstoblogerrors
¶TODO [D] BigInt Eilish 🌟 on Twitter: "@sveltejs Rewrote my Twitter search from React to Svelte @Reactjs 42kb Code: https://t.co/4fDXi7hqwG Site: https://t.co/Ync9baSs2n @Sveltejs 5kb Code: https://t.co/lD1gywleNp Site: https://t.co/pgmavoPLBy Had trouble w/ eslint/prettier, but overall much less code to write cc @wgao19 https://t.co/BthQ2I6C77" / Twitter js
https://twitter.com/swyx/status/1208461215069945856
Rewrote my Twitter search from React to Svelte @Reactjs 42kb Code: https://github.com/sw-yx/bettertwitter/tree/reactapp Site: https://inspiring-fermat.netlify.com @Sveltejs 5kb Code: https://github.com/sw-yx/bettertwitter/tree/master Site: https://bettertwitter.netlify.com Had trouble w/ eslint/prettier, but overall much less code to write
¶[C] Vanilla List • The Vanilla JavaScript Repository jsjavascript
¶[C] Use console.log() like a pro - Marko Denic - Web Developer jsdrilljavascript
- console.group() and console.groupEnd()
Creates a new inline group, indenting all following output by another level. To move back out a level, call groupEnd().
- console.time() and console.timeEnd()
console.time() – Starts a timer with a name specified as an input parameter. Up to 10,000 simultaneous timers can run on a given page. console.timeEnd() – Stops the specified timer and logs the elapsed time in seconds since it started.