Skip to content

Instantly share code, notes, and snippets.

View cuonghuynh's full-sized avatar
🏠
Working from home

Cuong Huynh cuonghuynh

🏠
Working from home
View GitHub Profile
private function computeValidityPeriod($period)
{
return date('Y-m-d-H:i:s', strtotime("+$period min"));
}
// Paypal checkout express, payment type settings for Paypal or Credit Card
if ($paymentMethod == 'paypal') {
$nvpstr .= "&LANDINGPAGE=Login";
$nvpstr .= "&SOLUTIONTYPE=Mark";
} else {
$nvpstr .= "&LANDINGPAGE=Billing";
$nvpstr .= "&SOLUTIONTYPE=Sole";
}
function randomPassword($length = 6) {
$chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()_-=+;:,.?";
$password = substr( str_shuffle( $chars ), 0, $length );
return $password;
}
# How to install Laravel in Ubuntu 16.04
## basic stuff install (optional)
sudo apt-get install git
sudo apt-get install zip
## LAMP
sudo apt-get install tasksel
@cuonghuynh
cuonghuynh / strong-passwords.php
Created October 26, 2016 10:38 — forked from tylerhall/strong-passwords.php
A user friendly, strong password generator PHP function.
<?PHP
// Generates a strong password of N length containing at least one lower case letter,
// one uppercase letter, one digit, and one special character. The remaining characters
// in the password are chosen at random from those four sets.
//
// The available characters in each set are user friendly - there are no ambiguous
// characters such as i, l, 1, o, 0, etc. This, coupled with the $add_dashes option,
// makes it much easier for users to manually type or speak their passwords.
//
// Note: the $add_dashes option will increase the length of the password by
(function($) {
$.pluginName = function(element, options) {
var defaults = {
foo: 'bar',
onFoo: function() {}
}
var plugin = this;
/*
|----------------------------------------------
| ReadMore Jquery Plugin
|----------------------------------------------
|
| Created by Cuong Huynh
|
*/
(function($) {
namespace App\Support;
abstract class AbstractValidator
{
protected $errors;
/**
* handle checking data is valid
* @return boolean
<?php
namespace App\Validators;
use App\Support\AbstractValidator;
class CreateItemDataValidator extends AbstractValidator
{
/**
* handle checking data is valid
<?php
namespace App\Validators;
class ValidationException extends \Exception
{
public function __construct($message, $errors, $code = 0, \Exception $previous = null)
{
$this->errors = $errros;