Thinking of using diff? Try comm, its sole purpose is to compare 2 sorted files line by line.
Show lines in A.txt but NOT in B.txt:
comm -2 -3 A.txt B.txtIf the files aren’t sorted, use:
| function createStore (reducers) { | |
| var state = reducers() | |
| const store = { | |
| dispatch: (action) => { | |
| state = reducers(state, action) | |
| }, | |
| getState: () => { | |
| return state | |
| } | |
| } |
Simply put, Transfer-Encoding: chunked, in a HTTP response header, tells us the body will be received in several chunks.
This is ideal in 2 scenarios:
In practice, the body has each of its chunks separated with X\r\n, where X is the size of the chunk in hexadecimal. For instance:
| // 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*() { |
https://gist.github.com/ljharb/58faf1cfcb4e6808f74aae4ef7944cff
While attempting to explain JavaScript's reduce method on arrays, conceptually, I came up with the following - hopefully it's helpful; happy to tweak it if anyone has suggestions.
JavaScript Arrays have lots of built in methods on their prototype. Some of them mutate - ie, they change the underlying array in-place. Luckily, most of them do not - they instead return an entirely distinct array. Since arrays are conceptually a contiguous list of items, it helps code clarity and maintainability a lot to be able to operate on them in a "functional" way. (I'll also insist on referring to an array as a "list" - although in some languages, List is a native data type, in JS and this post, I'm referring to the concept. Everywhere I use the word "list" you can assume I'm talking about a JS Array) This means, to perform a single operation on the list as a whole ("atomically"), and to return a new list - thus making it mu
In an effort to improve the quality of search results on sites like https://npmjs.com, there has been more and more discussion about factoring in the ranking/scoring of dependencies to influence search results. The general idea is that a library should be ranked not only on its own merits, but dependencies should weigh into the score as well.
I’m not sure what my opinion is on this yet. I was initially in favor of this, and still might be, but this document is a summary of some things that crossed my mind about the topic.
Should dependencies weigh into the search score for a library?
| 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!') | |
| } |