Skip to content

Instantly share code, notes, and snippets.

View davidhemphill's full-sized avatar

Hemp davidhemphill

View GitHub Profile
<?php
namespace App\Billing;
use Laravel\Cashier\Cashier as LaravelCashier;
class Cashier extends LaravelCashier
{
/**
* The current currency.
@davidhemphill
davidhemphill / array.php
Last active January 18, 2016 20:47
Pretend you have a report that does a bunch of calculations and data query finagling and now you need to show it. How do you like to get that data back?
<?php
/**
* Send a data array back like an animal
*/
// Send an array back from the report
$data_array = $report->getAllTheData();
// Display the data and the totals
reset: false
site-width: 114rem
fonts:
sans: "'Helvetica Neue', Helvetica, Arial, sans-serif"
serif: Merriweather, Georgia, serif
code: Menlo, Consolas, Monaco, 'Andale Mono', monospace
sizes: [10,11,12,15,16.5,18,22.5,24.75,27,33.75,37.13,40.5,50.63,55.69,60.75, 75.94, 83.53]
weights: [100, 200, 300, 400, 500, 600, 700, 800, 900]
@davidhemphill
davidhemphill / SassMeister-input-HTML.html
Created October 15, 2015 22:40
Generated by SassMeister.com.
<a class="bgb :bgg05 tc2 :tcg60">Hi there little pilgrim</a>
@davidhemphill
davidhemphill / SassMeister-input.scss
Created October 15, 2015 22:32
Generated by SassMeister.com.
// ----
// libsass (v3.2.5)
// ----
// Global Colors
// ------------------------------------------------------------------------------------ */
$white: #fff !default;
$black: #000 !default;
$beard-success-color: #4AB471 !default;
$beard-warning-color: #F3AE4E !default;
@davidhemphill
davidhemphill / SassMeister-input-HTML.html
Last active October 15, 2015 22:13
Generated by SassMeister.com.
<link rel="stylesheet" href="http://buildwithbeard.com/css/app.css"></link>
<a href="#" class="bg1:2 tc1:2 ft4 pv2 ph3 dib">Click Me</a>
@davidhemphill
davidhemphill / post.md
Last active January 28, 2018 17:36
Command Buses and Simple Redirects

I've been busy developing a large application on Laravel. In the middle of this, I've been trying to also be a good PHP developer (oxymoron?) and look into using the Command Bus pattern, specifically using Laravel's implementation. I think I get the idea in theory: Fire a Command, the Handler deals with it, the Command is immutable, and all that. I've looked up tons of tutorials on the subject, and even watched Ross Tuck's talk Models and Service Layers; Hemoglobin and Hobgoblins which mentions the subject.

The one thing these tutorials do not mention is how one might use the data generated in the Handler. For example, say I have a controller method that fires off a command:

// Register the User
public function register(RegisterRequest $request)
{
  $this->dispatch(new CreateRegistrationCommand($request));
}
<?php
class Page extends BumbleModel
{
public function bumble()
{
return $this->hasAdmin('Monarkee\ModelAdmin\PageAdmin');
}
}
<?php namespace Monarkee\Bumble;
use Illuminate\Foundation\AliasLoader;
use Illuminate\Support\ServiceProvider;
use League\Flysystem\Filesystem;
use League\Flysystem\Adapter\Local as LocalAdapter;
use League\Flysystem\Adapter\AwsS3 as S3Adapter;
use Monarkee\Bumble\Models\BumbleModel;
use Monarkee\Bumble\Models\Module;
#301 Redirects for .htaccess
#Redirect a single page:
Redirect 301 /pagename.php http://www.domain.com/pagename.html
#Redirect an entire site:
Redirect 301 / http://www.domain.com/
#Redirect an entire site to a sub folder
Redirect 301 / http://www.domain.com/subfolder/