• How to use reserved characters in a URI

    If you have to encode a reserved character (such as ‘/’ or ‘@’) so that it can be passed in a URI path, you may need to encode it twice: Example: const ticker = ‘@SMC/2018’, encodedTicker = encodeURIComponent(encodeURIComponent(ticker)), uri = `https://someexample.io/${encodedTicker}/load`; See also: “When to Encode or Decode” if you like to be confused.

  • Recursion Examples

    Recursion in programming can be a mind bender.  Here are two examples of recursive functions coded in JavaScript.  These examples are dependent on lodash methods. Hopefully these code patterns are useful to you. I find them useful as starting points when I have to code some new recursion.   This function, “omitDeep” deletes an object more

  • HTML Character Entities in Javascript

    Sometimes you need to write html character entities in javascript, but html character entities can’t be used, because they don’t get interpreted by javascript. In javascript, you need to use the equivalent unicode character codes instead. HTML character entity, wrong: formElement.value = “Dirección”; You get: Dirección Unicode character code, correct: formElement.value = “Direcci\u00F3n”; You get: more

  • When Making a Directive for AngularJS

    Worth Reading:  https://docs.angularjs.org/guide/directive Especially this at the very bottom of that page: By ‘expose an API’, they mean ‘add some this.doSomething() {…} functions to the controller that are reachable from outside the controller’.  Like public class methods.  If you’re not needing any of those, don’t add a controller to the directive.

  • block ads with hosts files

    Anyone with 15 minutes of free time can edit their hosts file to block 99% of the ads that appear on web pages, for free. This works on PCs, Macs, and Linux/Unix computers. What’s a “hosts” file?  It’s a file named “hosts”, and every normal computer sold to consumers has one. A background on hosts more