The FTC has proposed a rule to ban non-compete agreements. This is great. A employer shouldn’t be able to prohibit people from pursuing their career wherever they want. Non-competes give employers way too much leverage over their employees. The evidence is clear that it suppresses wages and working conditions. Trade secrets and the like can still be protected. That’s company property and should not be abused by ex-employees. But, it’s un-American to deprive someone of their pursue Happiness and switch to any other job they might prefer for any reason.
Read MoreThere be mermaids
As part of my exploration into JavaScript, I was looking into how I might display some charts and ran across Mermaid.js. Mermaid is an interesting project that uses a simple Markdown-like language to define diagrams and charts. It’s got a long list of integrations so you can use the charts in various blogging, CMS and other tools. It’s definitely something I will be exploring more as I can see some interesting use cases for my professional work as well as hobby stuff.
Read MoreLook out below
Sometimes you just dodge a bullet. A little over a year ago, I congratulated Hashicorp on going public and mused a little about buying shares. However, I did not because the valuation seemed a little high. Based on this chart, I would say that’s a correct assessment. I’ve missed on my share of stocks. The one I really blew was Coupang. I fell for that one hook line and sinker. Part of my problem there was that I’ve been to Seoul a couple of times in the past five years or so and really like it.
Read MoreFun with Array creation
One of the problems in the chapter on Arrays and Collections in Modern JavaScript for the Impatient is Implement a function that works exactly like the from function of the Array class. Pay careful attention to missing elements. What happens with objects that have keys whose numeric values are ≥ the length property? With properties that are not index properties? This was a good way to try a few things in JavaScript.
Read MoreDebit or Credit?
I always wondered why when you use a card for a purchase you are asked on the screen “Debit or Credit?” Doesn’t the machine know? Isn’t it encoded in the card? This nifty article by Patrick McKenzie explains that and more about how ATMs work. It’s much more complex than I had thought but makes a lot of sense. Essentially debit and credit use two different networks for payment so the question is really about which network you want to use.
Read MoreFun with Unicode Regex
One of the problems in the chapter on Strings and Regular Expressions in Modern JavaScript for the Impatient is Write a function that, given a string, produces an escaped string delimited by ’ characters. Turn all non-ASCII Unicode into \u{. . .}. Produce escapes \b, \f, \n, \r, \t, \v, ', \. This was a pretty interesting thing to try. Working with Unicode in Regular Expressions is a little weird and it took me a while to figure out what would match non-ASCII Unicode and replace it with a encoding.
Read MoreFind it with class
I recently covered the very basics of regular expression syntax. Now I’ll describe a little bit about how regular expressions work in JavaScript. The simplest method on the RegExp object is test which returns true if the string contains the specified regular expression. /[A-Z]+/.test('Foo') // true The exec method returns an array with the first match or null if there was no match. /[a-z]+.exec('foo bar') // returns Array['foo'] That array also contains the index of where the match was found (0 in this case) and the input string (‘foo bar’).
Read MoreFind it
Regular expressions are a very handy and flexible way of finding string patterns. In a regex, characters are searched as they are entered except for the reserved characters: . * + ? { | ( ) [ \ ^ $ The string foo only matches the string foo. The . matches any single character so that .oo matches poo and foo. Pretty simple. The * means that the preceding character is repeated 0 or more times.
Read MoreDiseconomies of scale
The Register has an interesting article on the underlying economics of big tech. The Amazons and Googles of the world have grown huge by offering “free” products like Alexa and Gmail. As we all know by now, if it’s free, you are the product. Has this model run out of steam at huge scale? These huge free services are expensive to run. The most recent results from Amazon show how difficult it can be to make money on a free service.
Read MoreNumbers
All JavaScript numbers are double-precision and stored in the IEEE 754 floating point standard. Integer literals can be written in a variety of formats including decimal (42), hexadecimal (0x2A), octal (0o52) and binary (0b101010). You can also include underscores (_) when you write long numbers for clarity (1_000_042). To read an integer from a string, the parseInt function can be used. Some examples: const foo = parseInt('42'); const fooHex = parseInt('0x2A', 16); Floats work similarly:
Read More