Posted on Aug 13, 2019
If you’ve got many songs in Google Play Music, it can be difficult to manage which songs are in which playlists. Google Play Music doesn’t show you a list of playlists a particular song is in, if any. To create such a list, here’s a solution that works.
https://jsbin.com/wekumiseya/edit?html,output
The result will be a JSON file containing a list of songs where for each song there will be an array of playlists the song is in, e.g.
"Madonna - Santa Baby": [ "Christmas" ], "Madonna - True Blue": [],
In the excerpt above, we see that the song “Santa Baby” is in the Christmas playlist but the song “True Blue” is not in any playlist. You can then find a playlist to the the latter song in so you don’t forget that you have that song.
Posted on Aug 5, 2019
Posting content on WordPress can be time consuming without the right technique. By default, copying and pasting images isn’t possible. Images need to manually be uploaded, resized, and optimized for performance. And even if you do that, they’re still not optimized for global performance because they aren’t on a CDN (content delivery network). To simplify posting content on WordPress, I’ve found the following setup and workflow to be best.
You can be cheap and try to manage hosting a WordPress site yourself. But, you’ll likely get frustrated as you can’t keep up with vulnerabilities that can slow down or break your site. You can get affordable managed WordPress hosting on GoDaddy. They’ll take care of upgrades and remove insecure plugins for you.
This plugin is critical, especially for performance. Among other things, you can enable performance optimization to automatically resize, optimize and host all images and static files (CSS, JS) on WordPress’ content delivery network. A 3.5 MB image instantly gets optimized to a fraction of that size, e.g. 120 KB. This plugin is an absolute must.”
Read MorePosted on Aug 5, 2019
Posted on Jul 7, 2019
Here’s one way to secure an item using a rope that locks tension in the rope. It’s a variation of the Trucker’s Hitch. It involves creating a loop (slip knot) and then looping the free end of the rope twice through the loop. For the first, fixed end, I use a ring hitch knot which easily ties the first end of the rope to an anchor without it loosening.
Here’s how to tie a ring hitch for the first end.
Here’s how to tie the slip knot and trucker’s hitch with tension locking.
I found out how to do this from:
Posted on Jul 7, 2019
Use an Alpine Butterfly Bend.
Posted on Jun 22, 2019
Posted on Jun 15, 2019
When reviewing websites, you often want to point at certain elements and add comments about them. This can easily and freely be done using Google Drawings.
3. Click one of the Callout buttons
4. Click and draw near the element in the screenshot where you want to add a comment
5. Drag the orange point at the tip of the arrow and drag it towards the element you want to draw attention to
6. Click in the callout box and type your comment then optionally adjust the size of the box
Posted on Jun 5, 2019
I recently set up a Heroku app using the Apache and PHP buildpack. The Apache configuration on Heroku was most likely the default which, if it receives a request to a URL without a trailing slash, e.g.
http://www.foobar.com/about
it’ll redirect to
http://www.foobar.com/about/
That alone is fine. However, I was getting redirected from https to http, which was not fine. This is likely due to the presence of a load balancer in front of the Heroku app server with SSL/TLS being terminated at the load balancer. When a request to an https URL without a trailing slash like
https://www.foobar.com/about
the request was secure to the Heroku load balancer but from the load balancer to the Heroku app server, it must have been insecure, e.g.
http://www.foobar.com/about
At that point, Apache would redirect to
http://www.foobar.com/about/
and the user would end up going from https to http. To resolve this, and as a best practice, just force https on all URLs. This is easily done on Heroku using a .htaccess file with a redirect rule, in case your chosen server is Apache.
Posted on May 17, 2019
Say we have an API client with three methods, getItem(), updateItem(), and deleteItem(), each of which returns a Promise. There are only two functions you need to worry about: then() and catch().
Each call to then() creates another step in the Promise chain, and if there’s an error at any point in the chain, the next catch() block will be triggered. Both then() and catch() can either return a raw value or a new Promise, and the result will be passed to the next then() in the chain.
If a function doesn’t return a Promise but rather a callback, like Node’s fs.readile function,
https://nodejs.org/api/fs.html#fs_fs_readfile_path_options_callback
then you can convert the call to a Promise as follows. The new function, called readFilePromise, converts the original function, called readFile, into a Promise.
To use the new promise function, do this.
If you have a function that needs to return a Promise, like fs.readFile, but handle certain cases synchronously, you can use Promise.resolve() and Promise.reject() to create Promises out of ordinary values, like this.
Promise.all is a convenient method for running an array of Promises concurrently, i.e. all at the same time. For instance, say we have a list of files we want to read from disk. Using the readFilePromise function we created above, it would look like this:
Here’s another example
And another example (from Kyle Simpson)
In the example above, we can use the new Promisified function in the chain as follows. We can also create a new Promise that returns a Promise of an ordinary value to keep the chain going.
Posted on May 12, 2019
Hook both ends of the ratchet strap to something.
Fold the ratchet as shown in the picture below. Then insert the open end of the other strap “through” the ratchet cylinder. Read More