Skip to content

Instantly share code, notes, and snippets.

View Repox's full-sized avatar

Dan Storm Repox

View GitHub Profile
@Repox
Repox / send.php
Created April 12, 2018 06:04
Google API PHP Client - Firebase Cloud Messaging Service v1 example
<?php
/**
* This serves as an example of how to use the Google API PHP Client
* with Firebase Cloud Messaging Service.
*
* The client can be found here:
* https://github.com/google/google-api-php-client
*
* At the time of writing this, there's no Service object for the correct
@Repox
Repox / PaginationController.php
Created November 3, 2016 11:05
Laravel 5 Pagination with transform
<?php
namespace App\Http\Controllers;
use App\User;
use Illuminate\Http\Request;
class PaginationController extends Controller
{
@Repox
Repox / script.sh
Created January 14, 2024 11:24
Concat or merge videos with FFMPEG
ls -1 *.mp4 | xargs -I {} echo "file '{}'" > files.txt
ffmpeg -f concat -safe 0 -i files.txt -c copy output.mp4
@Repox
Repox / A_Directory_Example.md
Last active November 11, 2023 11:59
Laravel 7 - Alternative public folder for shared hosting

The point of this Gist is to help setting up Laravel on a shared hosting setup, where you'd might need to have your ./public folder in another structure due to the hosting setup, but still keep the application itself out of the document root/public html folder.

The directory structure presented below is just an example, showing the document root/public html folder next to the Laravel application. The configurations displayed in the files below matches this structure.

Additionally, the changes in server.php allows for you to have the same directory structure when working locally with artisan serve (if you are using this).

I've added // comments in the files below on the lines where I changed any references and I've marked, in the tree structure below, where you find the files you need to update.

shared_hosting/ <- Your root directory (not document root/public html folder).
@Repox
Repox / validation.php
Last active May 4, 2023 10:17
Laravel Validation Language file DK
<?php
return [
/*
|--------------------------------------------------------------------------
| Validation Language Lines
|--------------------------------------------------------------------------
|
| The following language lines contain the default error messages used by
@Repox
Repox / swap.sh
Created April 27, 2016 06:49
Shell script for adding swap to Linux
#!/bin/sh
# size of swapfile in megabytes
swapsize=1024
# does the swap file already exist?
grep -q "swapfile" /etc/fstab
# if not then create it
if [ $? -ne 0 ]; then
@Repox
Repox / da.json
Created January 11, 2022 11:59
Laravel 8.x - Danish Jetstream, Fortify and Livewire translation file
{
"Name": "Navn",
"Email": "E-mail adresse",
"Password": "Kodeord",
"Confirm Password": "Bekræft Kodeord",
"Already registered?": "Allerede registreret?",
"Register": "Opret",
"Remember me": "Husk mig",
"Forgot your password?": "Glemt dit kodeord?",
"Log in": "Log ind",
@Repox
Repox / laravel
Created August 18, 2014 19:10
Laravel logrotate configuration (1 daily rotation, 7 days retention)
/home/laravel/app/storage/logs/laravel.log {
daily
missingok
rotate 7
maxage 7
compress
notifempty
create 755 user group
su user group
}
@Repox
Repox / iban.js
Last active June 20, 2019 09:49
IBAN Converter
var BigNumber = require('big-number');
function convertToIBAN(countryCode, ...numberStrings) {
if(countryCode.length != 2) {
return Error("Parameter `countryCode` must contain a ISO 3166-1 alpha-2 value");
}
let lettersArray = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'.split("")
let codeMap = {}
<?php
function issetOr(&$first, $alternative = NULL)
{
$output = '';
if (isset($first)) {
$output = $first;
} else {
$output = $alternative;
}