Delay a Grails controller’s response

Sometimes, for testing or development, you need to slow down an ajax response from the server. In the Grails framework, to delay a controller’s response, do the following: In the action you want to delay, insert: Thread.sleep(5000) as in: def…

Nginx Cheat Sheet

Test and restart an nginx configuration change The reload will not happen if the test fails. sudo nginx -t && service nginx reload or, on a bitnami image: sudo nginx -t && sudo restart nginx   Redirect all subdomains…

Virtual Box Tips

Mount a shared folder on a linux (Debian) guest: Make sure you have already installed the Virtual Box Guest Additions. Set up a ‘transient’ folder via the Virtual Box GUI (Devices > Shared Folders) In a terminal window in the…

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 =…

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…

Linux Commands Cheat Sheet

This outputs your stuff in a folder called ‘packageName’: tar -xvzf packageName.tar.gz   This can help tell you what version of linux or at least linux kernel you are running: uname -a   Find a process and kill it: Run…