Skip to content

Instantly share code, notes, and snippets.

View Edofre's full-sized avatar
🐈

Edo Freriks Edofre

🐈
View GitHub Profile
@Edofre
Edofre / gist:ccdbe90b0f00ed246f1d48a6a6e639dd
Created March 11, 2021 09:29
Laravel nl/translations
<?php
return [
/*
|--------------------------------------------------------------------------
| Validation Language Lines
|--------------------------------------------------------------------------
|
| The following language lines contain the default error messages used by
@Edofre
Edofre / gist:a3ad0d72a4a01b3dd4a7b8fb8ff81647
Last active September 3, 2020 12:57
Homestead WKHTMLTOPDF
sudo wget https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/wkhtmltox_0.12.6-1.bionic_amd64.deb
sudo dpkg -i wkhtmltox_0.12.6-1.bionic_amd64.deb
sudo apt-get install -f
sudo ln -s /usr/local/bin/wkhtmltopdf /usr/bin
sudo ln -s /usr/local/bin/wkhtmltoimage /usr/bin
Verify with:
wkhtmltopdf http://www.google.com google.pdf
@Edofre
Edofre / thumbnail.php
Last active August 13, 2019 19:22
Create thumbnails from images
<?php
// Create instance
$img = \Image::make(storage_path("app/{$uploadPath}" . $fileName));
// Make sure
$img->orientate();
// Resize only the width of the image
$img->resize(250, null, function ($constraint) {
$constraint->aspectRatio();
});
@Edofre
Edofre / gist:809c42e771bdf4731bdac180f7fba773
Created June 21, 2018 10:58
Regex, Find all between []
\[(.*?)\]
@Edofre
Edofre / gist:6de690e1c1cfb34570e9ab34736218bd
Created June 21, 2018 10:57
Ghostscript combine PDF files
-dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=out.pdf page-0.pdf page-1.pdf page-2.pdf page-3.pdf page-4.pdf
sudo locale-gen nl_NL
sudo locale-gen nl_NL.UTF-8
sudo update-locale
OF
sudo apt-get install language-pack-nl
### Keybase proof
I hereby claim:
* I am edofre on github.
* I am edofre (https://keybase.io/edofre) on keybase.
* I have a public key ASDo2p0p8HFMyrYp96c-k2ZO8p6K-zY3Gm03GQlqEtB53Ao
To claim this, I am signing this object:

You can check here for getting the latest version. Change the wget url to download newer versions.

$ wget https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.4/wkhtmltox-0.12.4_linux-generic-amd64.tar.xz
$ tar -xvf wkhtmltox-0.12.4_linux-generic-amd64.tar.xz
$ cd wkhtmltox/bin/
$ sudo mv wkhtmltopdf /usr/bin/wkhtmltopdf
$ sudo mv wkhtmltoimage /usr/bin/wkhtmltoimage
$ sudo chmod a+x /usr/bin/wkhtmltopdf
@Edofre
Edofre / VagrantFile
Created February 15, 2018 15:35
ZSH in Laravel Homestead with local .zshrc file
############################################################
# Install git and zsh prerequisites
config.vm.provision :shell, inline: "apt-get -y install git"
config.vm.provision :shell, inline: "apt-get -y install zsh"
# # Clone Oh My Zsh from the git repo
config.vm.provision :shell, privileged: false,
inline: "git -C ~/.oh-my-zsh pull || git clone git://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh"
# inline: "git clone git://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh"
# # Copy in the default .zshrc config file
config.vm.provision :shell, privileged: false,
<?php
namespace common\components\validators;
class ZipCodeValidator extends \yii\validators\RegularExpressionValidator
{
public $pattern = '/^[0-9]{4} {0,1}[a-z|A-Z]{2}$/'; // 1234AB or 1234 AB
}