Skip to content

Instantly share code, notes, and snippets.

View jonhassall's full-sized avatar

Jonathan Hassall jonhassall

View GitHub Profile
====
config\cache.php:
====
'file-compressed' => [
'driver' => 'file-compressed',
'path' => storage_path('framework/cache/data'),
'file_chmod' => 0774,
],
====
@jonhassall
jonhassall / SQL sorting - Alpha > Numbers > Symbols.sql
Created March 21, 2024 22:45
SQL sorting - Alpha > Numbers > Symbols
SELECT id, title
FROM table
ORDER BY
CASE
WHEN title regexp '^[a-zA-Z]+' THEN
1
WHEN title regexp '^[0-9]+' THEN
2
WHEN title regexp '^[^\w]+' THEN
3
@jonhassall
jonhassall / harvard-phrases.txt
Last active December 10, 2022 23:20
Harvard Phrases raw, unformatted - From "IEEE Recommended Practice for Speech Quality Measurements." IEEE Transactions on Audio and Electroacoustics, Vol. 17, Issue 3, 225-246, 1969. APPENDIX C 1965 Revised List of Phonetically Balanced Sentences (Harvard Sentences). DOI 10.1109/IEEESTD.1969.7405210 (IEEE standard 297-1969) and 10.1109/TAU.1969.…
The birch canoe slid on the smooth planks
Glue the sheet to the dark blue background
It's easy to tell the depth of a well
These days a chicken leg is a rare dish
Rice is often served in round bowls
The juice of lemons makes fine punch
The box was thrown beside the parked truck
The hogs were fed chopped corn and garbage
Four hours of steady work faced us
A large size in stockings is hard to sell
@jonhassall
jonhassall / FullTextSearch.php
Last active January 26, 2024 13:29
Laravel Fulltext Search Trait with Weighting
<?php
namespace App\Traits;
/**
* Fulltext search trait. Requires column to have a FULLTEXT index
* Customizable weighted relevance per column
*
* Add to model:
*
@sebastiandg7
sebastiandg7 / ei.cfg
Last active June 9, 2024 13:55
Config file to place in sources/ei.cfg inside Windows Installation USB to avoid automatic Windows version detection
[EditionID]
Professional
[Channel]
Retail
@simonw
simonw / react-debouncing.md
Created March 16, 2018 22:15
React debouncing pattern for API calls

React debouncing pattern for API calls

Classic debounce function:

const debounce = (fn, delay) => {
      let timer = null;
      return function (...args) {
          const context = this;
          timer && clearTimeout(timer);

timer = setTimeout(() => {

@djaiss
djaiss / progress_bar_migration_laravel.php
Last active May 4, 2024 15:03
Laravel: Use progress bars in migrations
<?php
use Symfony\Component\Console\Helper\ProgressBar;
use Symfony\Component\Console\Output\ConsoleOutput;
class DoSomething extends Migration
{
public function up()
{
$output = new ConsoleOutput();
@julianxhokaxhiu
julianxhokaxhiu / pagespeed_optimize_images.sh
Last active June 15, 2024 17:09
Recursively optimize all PNG and JPG files wherever they are from the script position and inner ( based on OPTING, PNGCRUSH, ADVANCECOMP and JPEGOPTIM )
#!/bin/bash
# Improved as per feedback from @pascal - https://gist.github.com/julianxhokaxhiu/c0a8e813eabf9d6d9873#gistcomment-3086462
find . -type f -iname "*.png" -exec optipng -nb -nc {} \;
find . -type f -iname "*.png" -exec advpng -z4 {} \;
find . -type f -iname "*.png" -exec pngcrush -rem gAMA -rem alla -rem cHRM -rem iCCP -rem sRGB -rem time -ow {} \;
find . -type f \( -iname "*.jpg" -o -iname "*.jpeg" \) -exec jpegoptim -f --strip-all {} \;
@bftanase
bftanase / secure_link.php
Last active July 19, 2024 16:14
generate URL for nginx secure_link
@oswaldoacauan
oswaldoacauan / swfextract
Created March 22, 2015 02:50
SWFExtract All Files
#!/bin/sh
for i in ./*.swf ; do
for j in `swfextract $i | grep -E PNGs.* -o | grep -E [0-9]+ -o` ; do
echo "$i -> extract png $j";
swfextract -p "$j" "$i" -o "$i"_"$j".png
done
for j in `swfextract $i | grep -E JPEGs.* -o | grep -E [0-9]+ -o` ; do
echo "$i -> extract jpeg $j";
swfextract -j "$j" "$i" -o "$i"_"$j".jpg
done