This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Laravel class methods | |
$response->assertCookie(); | |
$response->assertCookieExpired(); | |
$response->assertCookieMissing(); | |
$response->assertCookieNotExpired(); | |
$response->assertCreated(); | |
$response->assertDontSee(); | |
$response->assertDontSeeText(); | |
$response->assertExactJson(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# wilcard ssl | |
sudo certbot certonly --server https://acme-v02.api.letsencrypt.org/directory --manual --preferred-challenges dns -d *.hins.dev | |
# OR | |
sudo certbot certonly --manual -d '*.hins.dev' | |
# Update permission on archive | |
sudo chown -R mikehins /etc/letsencrypt/archive/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
First Row of Many Similar Ones | |
| |
SQL is a straightforward and expressive language, but it sometimes lacks constructs for writing queries in a simple way. It's more complicated than it should be to write a query to get, e.g., only the most expensive order for every customer of the current fiscal year. You can either use PostgreSQL's vendor-specific DISTINCT ON feature or window functions for every other database. | |
| |
MySQL | |
| |
SELECT * | |
FROM ( | |
SELECT *, RANK() OVER( | |
PARTITION BY customer_id |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://soft-builder.com/how-to-list-all-foreign-keys-in-mysql-database/ | |
SELECT RefCons.constraint_schema, RefCons.table_name, RefCons.referenced_table_name, RefCons.constraint_name, KeyCol.column_name | |
FROM information_schema.referential_constraints RefCons | |
JOIN information_schema.key_column_usage KeyCol ON RefCons.constraint_schema = KeyCol.table_schema | |
AND RefCons.table_name = KeyCol.table_name | |
AND RefCons.constraint_name = KeyCol.constraint_name | |
WHERE RefCons.constraint_schema = 'DATABASE_NAME'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
http://stackoverflow.com/questions/6373277/git-sync-local-repo-with-remote-one | |
This makes your local repo exactly like your remote repo. | |
Remember to replace origin and master with the remote and branch that you want to synchronize with. | |
git fetch origin | |
git reset --hard origin/master | |
git clean -f -d | |
#GIT UNDO |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// AppServiceProvider | |
public function boot(): void | |
{ | |
//... | |
Blade::directive('rev', function () { | |
$v = config('app.version'); | |
$b = exec('git rev-parse --short HEAD'); | |
return ($v ? 'Version ' . $v : '') . ($b ? '<br>Build ' . $b : ''); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
certbot -d '*.hins.dev' --manual --preferred-challenges dns certonly | |
sudo chmod 0755 /etc/letsencrypt/ | |
sudo chmod 0711 /etc/letsencrypt/live/ | |
sudo chmod 0750 /etc/letsencrypt/live/hins.dev/ | |
sudo chmod 0711 /etc/letsencrypt/archive/ | |
sudo chmod 0750 /etc/letsencrypt/archive/hins.dev/ | |
sudo chmod 0640 /etc/letsencrypt/archive/hins.dev/{cert,chain,fullchain}*.pem | |
sudo chmod 0640 /etc/letsencrypt/archive/hins.dev/privkey*.pem |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack'; | |
protected static ?string $navigationGroup = 'Bookings'; | |
protected static ?string $modelLabel = 'Booking'; | |
protected static ?string $navigationLabel = 'Bookings'; | |
protected static ?int $navigationSort = 1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# undo lat commit | |
git reset --soft HEAD^ | |
http://stackoverflow.com/questions/6373277/git-sync-local-repo-with-remote-one | |
This makes your local repo exactly like your remote repo. | |
Remember to replace origin and master with the remote and branch that you want to synchronize with. | |
git fetch origin | |
git reset --hard origin/develop |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
kill -9 $(lsof -ti:4321) | |
lsof -i tcp:8080 | |
kil PID | |
# wmysql PID | |
ps -ef | grep mysql |
NewerOlder