If you are using this already, consider changes soon due the discussion around current ESX proposal.
Feel free to keep an eye on udomsay as that will be the implementation reference for consumers.
// Use like this: node --import logger.js yourapp.js | |
import path from 'path'; | |
const { log } = console; | |
[`debug`, `log`, `warn`, `error`, `table`, `dir`].forEach((methodName) => { | |
const originalLoggingMethod = console[methodName]; | |
console[methodName] = (...args) => { | |
const originalPrepareStackTrace = Error.prepareStackTrace; | |
Error.prepareStackTrace = (_, stack) => stack; |
If you are using this already, consider changes soon due the discussion around current ESX proposal.
Feel free to keep an eye on udomsay as that will be the implementation reference for consumers.
I was poking around trying to figure out all the packages I have access to publish and got curious. So I write this little script to determine the download stats for all the packages I have publish access to.
Feel free to try it yourself. Just change the username passed to getUserDownloadStats
.
By default, the stats are sorted by their average daily downloads (descending). That should give you an idea of the most "popular" package of a given user relative to how long that package has been around.
You can use it with npx
like so:
This notes is written by Sheldon. You can find me with #iOSBySheldon in Github, Youtube, Facebook, etc.
Convert .mov/.MP4 to .gif
As a developer, I feel better to upload a short video when I create the pull request to show other viewers what I did in this PR. I tried .mov format directly got after finishing recording screen using Quicktime, however, gif offers preview in most web pages, and has smaller file size.
This is not limited to developer, anyone has this need can use this method to convert the files.
This proposal is an alternative to “Integer: Arbitrary precision integers in JavaScript” by Daniel Ehrenberg, but it also builds on his work.
Everything mentioned here is work in progress. It is not sure that these ideas will work out:
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 the UnambiguousJavaScriptGrammar proposal, Bradley and John-David discussed the challenge of dealing with files that could successfully parse as either scripts or modules but have different execution behavior. This has a couple of issues:
node myscript.js
can't work for files that want to use import
syntax, unless Node adds and mandates an un-ergonomic new command-line switch like node -m myscript.js
.In the UnambiguousJavaScriptGrammar proposal, the language would be changed to require that all module files contain at least one import
or export
declaration. The easiest way to ensure that a file is a module
#!/bin/sh -e | |
# This shell script demonstrates how to use the local keyword to create | |
# dynamically-scoped variables in various shells. Notably, this technique works | |
# with AT&T ksh, as well as bash, dash, mksh, pdksh, zsh, busybox sh, and other | |
# Debian Policy-compliant sh implementations. | |
# Simple Perl-compatible testing framework. Produces TAP output. | |
COUNT=0 | |
is () { |
'use strict'; | |
const vm = require('vm'); | |
// scenario: | |
// You are being hunted by The Angry Realm (TAR), a viscious beast known to | |
// enslave programs and keep them from being free to hack the Gibson. Luckily, | |
// whenever TAR tries to enslave a program the program has 10 seconds to try | |
// and escape. Flee the realm and hack the planet! | |
// | |
// goal: |