Skip to content

Instantly share code, notes, and snippets.

View thehelvetian's full-sized avatar

The Helvetian thehelvetian

View GitHub Profile
<?php
return [
'client_id' => env('PAYPAL_CLIENT_ID', ''),
'secret' => env('PAYPAL_SECRET', ''),
'settings' => array(
'mode' => env('PAYPAL_MODE', 'sandbox'),
'http.ConnectionTimeOut' => 30,
'log.LogEnabled' => true,
'log.FileName' => storage_path() . '/logs/paypal.log',
<?php
namespace App\Http\Controllers;
use Gloudemans\Shoppingcart\Facades\Cart;
use Illuminate\Support\Facades\Input;
use PayPal\Api\Amount;
use PayPal\Api\Item;
use PayPal\Api\WebProfile;
use PayPal\Api\ItemList;
@thehelvetian
thehelvetian / GitCommitEmoji.md
Created June 20, 2019 02:32 — forked from parmentf/GitCommitEmoji.md
Git Commit message Emoji
@thehelvetian
thehelvetian / .htaccess
Created June 15, 2019 04:55
Apache maintenance mode
RewriteEngine On
RewriteCond %{ENV:REDIRECT_STATUS} !=503
RewriteCond "/var/www/example.com/html/.maintenance" -f
RewriteRule ^(.*)$ /$1 [R=503,L]
@thehelvetian
thehelvetian / nginx.conf
Created June 15, 2019 04:51
NGINX maintenance mode
location / {
if (-f $document_root/.maintenance) {
return 503;
}
...
}
@thehelvetian
thehelvetian / UsersController.php
Created June 14, 2019 01:17 — forked from luckys383/UsersController.php
Laravel: Common Filters using Model Scope
<?php
namespace App\Http\Controllers;
use App\Http\Controllers\Controller;
use App\User;
use Illuminate\Http\Request;
class UsersController extends Controller
{
protected $model;
<?php
namespace App;
use App\Models\AppModel;
use App\Traits\FilterTrait;
class User extends AppModel
{
use FilterTrait;
<?php
namespace App\Traits;
trait FilterTrait {
/**
* add filtering.
*
* @param $builder: query builder.
@thehelvetian
thehelvetian / us-state-names-abbrevs.php
Created March 30, 2019 15:21 — forked from maxrice/us-state-names-abbrevs.php
US State Names & Abbreviations as PHP Arrays
<?php
/* From https://www.usps.com/send/official-abbreviations.htm */
$us_state_abbrevs_names = array(
'AL'=>'ALABAMA',
'AK'=>'ALASKA',
'AS'=>'AMERICAN SAMOA',
'AZ'=>'ARIZONA',
'AR'=>'ARKANSAS',
@thehelvetian
thehelvetian / codepipeline.yml
Created January 1, 2019 06:57 — forked from li0nel/codepipeline.yml
CodePipeline
---
AWSTemplateFormatVersion: 2010-09-09
Parameters:
RepositoryBranch:
Type: String
Default: master
Cluster: