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
// 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";
}
private function computeValidityPeriod($period)
{
return date('Y-m-d-H:i:s', strtotime("+$period min"));
}
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($) {
@cuonghuynh
cuonghuynh / RepositoryInterface.php
Last active November 22, 2016 03:22
Repository pattern in laravel
<?php
namespace App\Contracts\Repository;
interface IRepository
{
/**
* Get all
* @param array $columns
* @return mixed
@cuonghuynh
cuonghuynh / BaseEloquentRepository.php
Last active November 17, 2023 15:37
Implement Repository pattern by Eloquent model Laravel
<?php
namespace App\Repositories\Eloquent;
use App\Contracts\Repository\IRepository as InterfaceRepository;
class BaseEloquentRepository implements InterfaceRepository
{
protected $model;
@cuonghuynh
cuonghuynh / LogUtil.php
Last active November 22, 2016 03:20
Write logs into seperate files in laravel 5.x
class LogUtil
{
/**
* Write a content out file log
* @param string $file
* @param string $content
* @return boolean
*/
public static function write($file, $content)
{