Skip to content

Instantly share code, notes, and snippets.

View Sammyjo20's full-sized avatar
🔭
Stargazing

Sam Sammyjo20

🔭
Stargazing
  • EU-WEST-2
View GitHub Profile
@Sammyjo20
Sammyjo20 / gist:3e76429f5c4d4fa7285ef82965264385
Created May 14, 2020 08:03
Give composer unlimited power
alias composeroverlord="php -d memory_limit=-1 /usr/local/bin/composer"
@Sammyjo20
Sammyjo20 / autopopulate.js
Last active September 24, 2020 08:56
Quotehaven Javascript API - Autofilling forms
document.addEventListener('QuotehavenReady', () => {
window.quotehavenApi.populateForm({
client_one: {
title: 'mr', // mr, mrs, miss, ms, dr
first_name: 'John',
last_name: 'Doe',
smoker: false,
sex: 'male',
date_of_birth: '02/11/1980', // d/m/Y
email: 'john@codepotato.co.uk',
<?php
namespace App\Rules;
use Illuminate\Contracts\Validation\Rule;
class DangerousExtensions implements Rule
{
/**
* @var array
@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.
gpg -c --no-synkey-cache --cipher-algo AES256 file-name.sql
@Sammyjo20
Sammyjo20 / scroll.js
Created February 7, 2022 08:15
Vue 2 Router Fix Scroll Position
const router = new VueRouter({
routes: routes,
scrollBehavior (to, from, savedPosition) {
return { x: 0, y: 0 }
}
});
@Sammyjo20
Sammyjo20 / gist:f71070279270ff2f667c4b9867b12a23
Created February 16, 2022 11:28
Kill All Node Processes
killall -KILL node
@Sammyjo20
Sammyjo20 / SaloonRecord.php
Last active July 11, 2022 21:25
Record a Saloon Response to create a fixture
<?php
/**
* Record a request and respond with a fixture.
*
* @throws \Sammyjo20\Saloon\Exceptions\SaloonInvalidMockResponseCaptureMethodException
* @throws ReflectionException
* @throws \GuzzleHttp\Exception\GuzzleException
* @throws \Sammyjo20\Saloon\Exceptions\SaloonException
* @throws JsonException
@Sammyjo20
Sammyjo20 / api-paginator.php
Last active August 6, 2022 00:15
API Paginator
<?php
namespace App\Data;
class Paginator
{
/**
* Constructor
*
* @param int $totalPages
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddMissingHaystackColumnsFromVersionZeroDotEight extends Migration
{
/**
* Run the migrations.