Skip to content

Instantly share code, notes, and snippets.

@nathandaly
nathandaly / uk_postcode_validator.php
Created October 13, 2020 09:33 — forked from sepehr/uk_postcode_validator.php
PHP: UK Postcode Validation
/**
* Custom validation callback to validate UK postcodes.
*
* It also tries to format provided postcode in correct format.
*
* Note: It's only usable for "postcode" fields.
*/
public function check_postcode_uk($original_postcode)
{
// Set callback's custom error message (CI specific)
@nathandaly
nathandaly / JWT.php
Created August 28, 2019 00:14 — forked from aliboy08/JWT.php
Generate JWT Token using Firebase JWT php library
<?php
/**
* JSON Web Token implementation, based on this spec:
* https://tools.ietf.org/html/rfc7519
*
* PHP version 5
*
* @category Authentication
* @package Authentication_JWT
* @author Neuman Vong <neuman@twilio.com>
version: '2.3'
services:
mysql:
restart: always
image: mariadb:10.3
container_name: mariadb
ports:
- "3307:3306"
volumes:
@nathandaly
nathandaly / vagrant-scp
Last active May 31, 2018 10:23 — forked from mykter/vagrant-scp
Copy a file between a Vagrant VM and the host with scp
#!/bin/sh
# Change these settings to match what you are wanting to do
FILE=/File/To/Copy
PATH=/Where/To/Put/File
OPTIONS=`vagrant ssh-config | awk -v ORS=' ' 'NF{print "-o " $1 "=" $2}'`
# To copy a file from a Vagrant VM to the host:
# scp -rp ${OPTIONS} v:/srv /srv
@nathandaly
nathandaly / .gitignore
Created December 7, 2017 12:36 — forked from cebe/.gitignore
script to mirror svn repository
# subversion
.subversion
# mirror dirs
/mirror/*
/tmp/*