Skip to content

Instantly share code, notes, and snippets.

Greg Brock gbrock

Block or report user

Report or block gbrock

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@gbrock
gbrock / Extensions\Postmaster.php
Created Nov 12, 2015
Laravel 5.1 example of abstracting e-mail sending into its own dedicated class
View Extensions\Postmaster.php
<?php
namespace App\Extensions;
use Illuminate\Support\Facades\Mail;
class Postmaster {
/**
* Send an e-mail to a specific user. Pass in the User object,
* the name of the view, any data needed by the view, and the subject.
@gbrock
gbrock / 100% CSS custom checkboxes and radios.markdown
Last active Sep 20, 2015
100% CSS custom checkboxes and radios
View 100% CSS custom checkboxes and radios.markdown

100% CSS custom checkboxes and radios

The HTML structure is very specific. It allows for selecting the based on :checked state. Otherwise it's a fairly standard replacement, except it's very capable of being further styled while reacting to :active, :hover, etc.

Requires Bootstrap.

A Pen by Greg Brock on CodePen.

License.

@gbrock
gbrock / CommaSeparatedList.php
Created Aug 24, 2015
Joins an array of strings into a comma-separated string of readable output.
View CommaSeparatedList.php
<?php
/**
* Joins an array of strings into a comma-separated string of readable output.
* Array ['John', 'Paul', 'George', 'Ringo'] becomes the string "John, Paul, George, and Ringo".
*
* @param array $items
* @param bool|true $oxfordComma
* @param string $conjunction
* @return string
@gbrock
gbrock / BladeTemplates.md
Last active Feb 7, 2018
Starter Blade templates
View BladeTemplates.md

Starter Blade Templates

A simple starting point for use in Laravel 5.1. Based on Flexible master layout by Sercan Çakır.

Usage

  1. Download html5.blade.php and app.blade.php into your application's resources/views folder.
  2. In your app's custom views, extend app and hook into the yield points to flesh out your pages:
    {{--  myfile.blade.php  --}}
    @extends('app', [
View index.html
<ul class="selector">
<li data-name="red">Red</li>
<li data-name="blue">Blue</li>
</ul>
<ul class="people">
<li class="red">
Ann
<p>Lorem ipsum</p>
</li>
@gbrock
gbrock / parties_import.sql
Last active Apr 15, 2019
MySQL setup of a simple Party Model-based address book.
View parties_import.sql
#
# Basic Party Model implementation for MySQL.
# - Parties are either People or Organizations.
# - Party names are tracked separately, including first_used and last_used as dates.
# - Parties can have e-mails addresses, phone numbers, and physical addresses.
# - Parties can have Relationships with one another.
#
#
# Party Model: http://www.tdan.com/view-articles/5014/
# SO answer that helped me get started: http://stackoverflow.com/questions/5466163/same-data-from-different-entities-in-database-best-practice-phone-numbers-ex/5471265#5471265
@gbrock
gbrock / includes.php
Created Dec 13, 2014
Includes controller for CodeIgniter (JS and CSS) w/ caching
View includes.php
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/**
* Includes for CodeIgniter
*
* @author gBrock
*
* Reads the passed URLs and renders the appropriate CSS and JS files from
* the application's /views/ folder. Hopefully self-explanatory.
*
@gbrock
gbrock / html5.php
Last active Aug 29, 2015
A basic HTML5 template for starting CodeIgniter projects
View html5.php
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/**
* HTML5 Template for CodeIgniter
*
* @author gBrock
*
* Sets up a basic HTML5 document with some sensible setup,
* also allowing you to pass arrays of CSS and JS files as
* well as a view from your controller, which will be loaded
@gbrock
gbrock / debug.php
Last active Aug 29, 2015
A function to output variables on-screen for debugging purposes.
View debug.php
<?php
/**
* output whatever variable is passed on-screen for debugging purposes
*
* @param mixed $oVar the variable to be debugged
* @param bool $bContinue if false, sends a full-stop to the running script
* @return void
*
* @author gBrock
You can’t perform that action at this time.