First class open-source packages
- Dusk - Browser Testing
 - Envoy - Task Runner
 - Horizon - Queues Manager
 - Jetstream - Frontend Scaffolding
 - Fortify - Headless auth backend
 - Passport - OAuth 2.0
 - Sanctum - Token-based auth
 - Scout - Full-text search
 
| /** | |
| * This code snippet calculates the discount % on eKupi.hr and injects the info for each listing. | |
| * | |
| * Usage: Paste the code int Snippets in Chrome DevTools, open ekupi.hr page of interest, | |
| * right-click the Snipper and choose Run. | |
| */ | |
| $('.price-block').each(function () { | |
| const $this = $(this); | |
| const oldPrice = parseInt($this.find('.item-old-price').text().replace(',00 kn', '').replace('.', '')); | |
| const newPrice = parseInt($this.find('.price').text().replace(',00 kn', '').replace('.', '')); | 
| /** | |
| * Get all filters w/ regexp, because UrlSearchParams sux | |
| * | |
| * @param string url | |
| * @return Object | |
| */ | |
| function extractFilters(url) { | |
| return url.matchAll( | |
| /[&?]filter\[([^\]]+)\]=([^&]+)/g | |
| ) | 
| <?php | |
| /** | |
| * New versions of Chrome will not render html responses inside of ajax requests that requested json, which | |
| * breaks Laravel's dd() helper method as well as eloquents' ->dd() methods, making it far more complicated | |
| * to see what the generated SQL looks like. This is a simple workaround: | |
| */ | |
| // instead of `dd($foo);` | |
| return response()->json($foo, 500); | 
| document | |
| // can be any element that knows how to recieve the paste event | |
| .getElementById('someElement') | |
| // add event listener | |
| .addEventListener('paste', e => { | |
| if (! e.clipboardData.types.includes('text/html')) { | |
| // if there's no html on the clipboard ignore it | |
| return; | |
| } | 
| // Lists of countries with ISO 3166 codes, presented in various formats. | |
| // Last Updated: July 30, 2020 | |
| // If you're using PHP, I suggest checking out: | |
| // https://github.com/thephpleague/iso3166 | |
| // or Laravel: https://github.com/squirephp/squire | |
| // | |
| // JS developers can check out: | |
| // https://www.npmjs.com/package/iso3166-2-db | |
| // | 
| tail -f nohup.out | grep -i error | while read line; do say 'Error!'; done | 
| #!/bin/bash | |
| # | |
| # This script... | |
| # | |
| # Usage: ... | |
| ## | |
| set -o pipefail | |
| set -ex | 
| echo "<sha256_signature> *<file_name>" | shasum -a 256 -c | 
First class open-source packages
| /** | |
| * Helper to filter out the empty properties(null, undefined, [], or '') from the given object | |
| * | |
| * @param {{}} obj | |
| * @returns {{}} | |
| */ | |
| const removeEmptyProps = (obj) => { | |
| return Object.keys(obj) | |
| // remove params that are empty | |
| .filter(key => { |