Skip to content

Instantly share code, notes, and snippets.

View bmadigan's full-sized avatar

Brad Madigan bmadigan

View GitHub Profile
<?
// this script receives a Stripe dispute / chargeback and:
//
// - immediately refunds the payment
// - closes the user's account (in my DB, add your own code there)
//
// this is to automate dispute handling (because you never win a dispute on Stripe anyway)
// and by refunding avoiding the chargeback fee
//
@bmadigan
bmadigan / Install Imagemagick PHP 7.0
Created August 15, 2018 17:30 — forked from grumpysi/Install Imagemagick PHP 7.0
Install Imagemagick on Laravel Homestead box Ubuntu 14 + PHP 7.0
sudo apt-get update && sudo apt-get install -y imagemagick php-imagick && sudo service php7.0-fpm restart && sudo service nginx restart
@bmadigan
bmadigan / RememberQueryStrings.php
Created August 4, 2017 20:10 — forked from reinink/RememberQueryStrings.php
Remember query strings
<?php
namespace App\Http\Middleware;
use Closure;
class RememberQueryStrings
{
public function handle($request, Closure $next)
{
@bmadigan
bmadigan / AppServiceProvider.php
Created August 4, 2017 20:09 — forked from reinink/AppServiceProvider.php
Eloquent addSubSelect()
<?php
use Illuminate\Database\Eloquent\Builder as EloquentBuilder;
use Illuminate\Database\Query\Builder as QueryBuilder;
use Illuminate\Database\Query\Expression;
use Illuminate\Support\ServiceProvider;
class AppServiceProvider extends ServiceProvider
{
public function boot()
@bmadigan
bmadigan / WebhooksTest.php
Created June 16, 2017 02:19 — forked from Vasiliy-Bondarenko/WebhooksTest.php
Webhooks testing experiment. Just for fun :)
<?php
namespace Tests\Feature;
use Tests\TestCase;
use Tests\withTestingEnvironment;
use Zttp\Zttp;
class WebhooksTest extends TestCase
{
@bmadigan
bmadigan / stream-s3-as-zip.php
Created February 15, 2017 15:38 — forked from tillkruss/stream-s3-as-zip.php
Stream files from S3 as ZIP file.
<?php
use Aws\S3\S3Client;
use ZipStream\ZipStream; // https://github.com/maennchen/ZipStream-PHP
protected function streamPhotosetAsZip($files)
{
$s3 = S3Client::factory('...');
$zip = new ZipStream("foobar.zip");

UI Statistic Pop Out CSS

Another UI piece in CSS. Hover over the stat box for a nice scale etc. This does need tidying up slightly and i will make it responsive at some point so it looks top banana on mobile.

A Pen by Jamie Coulter on CodePen.

License.

<script>
@if (App::environment('local'))
var $el = $("#card-number");
window.stripeData = {
valid: function() {
$el.val('4242424242424242');
},
successAddressFail: function() {
$el.val('4000000000000028');
},
@mixin box-shadow($top, $left, $blur, $color, $inset: false) {
@if $inset {
-webkit-box-shadow:inset $top $left $blur $color;
-moz-box-shadow:inset $top $left $blur $color;
box-shadow:inset $top $left $blur $color;
} @else {
-webkit-box-shadow: $top $left $blur $color;
-moz-box-shadow: $top $left $blur $color;
box-shadow: $top $left $blur $color;
}