Call it via:
const flat = flatten( realDeepObject );
Test case:
<# | |
Note: Eliminate `-WhatIf` parameter to get action be actually done | |
Note: PS with version prior to 4.0 can't delete non-empty folders | |
#> | |
Get-ChildItem -Path "." -Include "node_modules" -Recurse -Directory | Remove-Item -Recurse -Force -WhatIf |
/* | |
* Copyright 2016, Matthieu Dumas | |
* This work is licensed under the Creative Commons Attribution 4.0 International License. | |
* To view a copy of this license, visit http://creativecommons.org/licenses/by/4.0/ | |
*/ | |
/* Usage : | |
* var log = Logger.get("myModule") // .level(Logger.ALL) implicit | |
* log.info("always a string as first argument", then, other, stuff) | |
* log.level(Logger.WARN) // or ALL, DEBUG, INFO, WARN, ERROR, OFF |
When contributing to this repository, please first discuss the change you wish to make via issue, email, or any other method with the owners of this repository before making a change.
Please note we have a code of conduct, please follow it in all your interactions with the project.
// Run this in the F12 javascript console in chrome | |
// if a redirect happens, the page will pause | |
// this helps because chrome's network tab's | |
// "preserve log" seems to technically preserve the log | |
// but you can't actually LOOK at it... | |
// also the "replay xhr" feature does not work after reload | |
// even if you "preserve log". | |
window.addEventListener("beforeunload", function() { debugger; }, false) |
Just a little proof-of-concept here - using an SVG <foreignObject>
element as a container for a tooltip that can involve handy HTML features like text-wrapping and (semi-)dynamic sizing.
Gotchas so far:
Like an <svg>
element, a <foreignObject>
element needs a width and a height in order to be rendered.
However, specifying width
and/or height
can be delayed. Here I specify a width (foWidth
) of 300px, then find the height of the contained <div>
using getBoundingClientRect()
and use that to specify the height of the containing <foreignObject>
.
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 |
# | |
# If all files excluded and you will include only specific sub-directories | |
# the parent path must matched before. | |
# | |
/** | |
!/.gitignore | |
############################### | |
# Un-ignore the affected subdirectory |
// Scenario: Some event handler is blocking events (event.preventDefault()) that shouldn't be blocked, i.e. because it binds to document instead of a more specific element | |
// 1) Place this before all other JavaScript | |
var originalPreventDefault = Event.prototype.preventDefault; | |
Event.prototype.preventDefault = function () { | |
// Lookup specific event you're expecting, i.e. pressing space | |
if (this instanceof KeyboardEvent && this.keyCode === 32) { | |
// This will log an error with full stack trace | |
make_error_to_see_stacktrace |