Skip to content

Instantly share code, notes, and snippets.

View peterbrinck's full-sized avatar
🤔
 

Peter Brinck peterbrinck

🤔
 
View GitHub Profile
@freekmurze
freekmurze / 2021_02_17_103523_migrate_to_jetstream.php
Last active June 11, 2022 19:55
Migrate classic Spark tables to Jetstream + new Spark
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class MigrateToJetstream extends Migration
{
public function up()
{
@viezel
viezel / Readme.md
Last active May 30, 2023 22:51
Invoker Docker support

Use Invoker with Docker

composer require viezel/dock --dev
php artisan dock:install

Now publish the docker-compose

@Sammyjo20
Sammyjo20 / EncryptedJson.php
Created October 22, 2020 11:18
EncryptedJson Cast
<?php
namespace App\Casts;
use Illuminate\Contracts\Database\Eloquent\CastsAttributes;
class EncryptedJson implements CastsAttributes
{
/**
* Cast the given value.
@AlexVanderbist
AlexVanderbist / opendb.sh
Created September 17, 2020 16:21
`opendb` command - opens the database for a Laravel app in your GUI
opendb () {
[ ! -f .env ] && { echo "No .env file found."; exit 1; }
DB_CONNECTION=$(grep DB_CONNECTION .env | grep -v -e '^\s*#' | cut -d '=' -f 2-)
DB_HOST=$(grep DB_HOST .env | grep -v -e '^\s*#' | cut -d '=' -f 2-)
DB_PORT=$(grep DB_PORT .env | grep -v -e '^\s*#' | cut -d '=' -f 2-)
DB_DATABASE=$(grep DB_DATABASE .env | grep -v -e '^\s*#' | cut -d '=' -f 2-)
DB_USERNAME=$(grep DB_USERNAME .env | grep -v -e '^\s*#' | cut -d '=' -f 2-)
DB_PASSWORD=$(grep DB_PASSWORD .env | grep -v -e '^\s*#' | cut -d '=' -f 2-)
@calebporzio
calebporzio / RouteDirectives.php
Created January 4, 2020 10:33
Blade Route Directives
<?php
// Register these inside a service provider:
Blade::directive('route', function ($expression) {
return "<?php echo route({$expression}) ?>";
});
Blade::directive('routeIs', function ($expression) {
return "<?php if (request()->routeIs({$expression})) : ?>";
@tobydeh
tobydeh / moleculer-k8.md
Last active March 20, 2024 11:55
Moleculer k8 depoyment

Create a cluster on GKE:

gcloud container clusters create backend --num-nodes=2 --machine-type n1-standard-4

Get credentials:

gcloud container clusters get-credentials backend

Build the docker image:

@ostark
ostark / cloudflareWhitelistUpdate.php
Last active April 15, 2019 06:40
Updates the .htaccess with the recent ClouldFlare IPs
<?php
# Exec during deployment
# php cloudflareWhitelistUpdate.php public/.htaccess
$srcUrls = [
'https://www.cloudflare.com/ips-v4',
'https://www.cloudflare.com/ips-v6'
];
$htacessFile = $argv[1] ?? '.htaccess';
@timvisee
timvisee / falsehoods-programming-time-list.md
Last active May 24, 2024 11:11
Falsehoods programmers believe about time, in a single list

Falsehoods programmers believe about time

This is a compiled list of falsehoods programmers tend to believe about working with time.

Don't re-invent a date time library yourself. If you think you understand everything about time, you're probably doing it wrong.

Falsehoods

  • There are always 24 hours in a day.
  • February is always 28 days long.
  • Any 24-hour period will always begin and end in the same day (or week, or month).
@karlbaillie
karlbaillie / docker-compose.yml
Created November 24, 2017 16:30
Media Server Setup
version: '2'
services:
unifi:
image: linuxserver/unifi
environment:
PUID: '1012'
GUID: '1012'
stdin_open: true
volumes:
- /storage/data/unifi:/config:rw
aardvark
aardwolf
Aaronite
abaction
abaculus
abaissed
abampere
Abarambo
abasedly
abatable