A complete gdb to lldb command map.
- Print object
(lldb) po responseObject
(lldb) po [responseObject objectForKey@"state"]
- p - Print primitive type
#include <stdlib.h> | |
#include <stdio.h> | |
#include <stdint.h> | |
#include <fcntl.h> | |
#include <sys/stat.h> | |
#include <sys/mman.h> | |
#include <unistd.h> | |
int main(int argc, const char *argv[]) | |
{ |
git branch -m old_branch new_branch # Rename branch locally | |
git push origin :old_branch # Delete the old branch | |
git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote |
A complete gdb to lldb command map.
(lldb) po responseObject
(lldb) po [responseObject objectForKey@"state"]
Below are many examples of function hoisting behavior in JavaScript. Ones marked as works
successfuly print 'hi!' without errors.
To play around with these examples (recommended) clone them with git and execute them with e.g. node a.js
(I may be using incorrect terms below, please forgive me)
All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.
Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.
elem.offsetLeft
, elem.offsetTop
, elem.offsetWidth
, elem.offsetHeight
, elem.offsetParent
<hash>
with your gist's hash):
# with ssh
git clone [email protected]:<hash>.git mygist
# with https
git clone https://gist.github.com/.git mygist
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
/** | |
* @author ebidel@ (Eric Bidelman) | |
* License Apache-2.0 | |
*/ | |
// Prints the bytes cached by service worker. Breaks out each cache | |
// overall in-memory bytes used by the Cache Storage API for the site. | |
async function getCacheStoragesAssetTotalSize() { | |
// Note: opaque (i.e. cross-domain, without CORS) responses in the cache will return a size of 0. |
When a process executes another process, either by one of the exec()
family of
functions, fork()
, etc., the child process inherits all of the parent's file
descriptors. This means if a parent has two file descriptors that are entangled
(i.e., a read end and a write end), the parent process can simply write to the
write end, and the child process can read from the read end.
┌────────────────┐