Skip to content

Instantly share code, notes, and snippets.

View adamwathan's full-sized avatar

Adam Wathan adamwathan

  • Ontario, Canada
View GitHub Profile
testtttt
@adamwathan
adamwathan / scublish.sh
Created November 4, 2014 14:57
Sculpin GitHub publish script
function scublish() {
sculpin generate --env=prod
cd output_prod
git add --all
git commit -am "$1"
git push origin master
cd ..
}
@adamwathan
adamwathan / gistlog.yml
Last active September 27, 2015 02:36
A Sample Gistlog
published: true
<?php namespace Acme\Presenters;
use Illuminate\Support\Collection;
abstract class Presenter {
protected $resource;
public function __construct($resource)
{
@adamwathan
adamwathan / laravel4basecontroller.php
Last active December 27, 2015 10:39
Base controller for Laravel 4.0 that lets you use the new instance filter functionality from 4.1
<?php
class BaseController extends Controller {
/**
* Setup the layout used by the controller.
*
* @return void
*/
protected function setupLayout()
@adamwathan
adamwathan / database.php
Created May 2, 2014 20:07
Using an in-memory SQLite for functional testing in Laravel 4
<?php
// app/config/testing/database.php
return [
'default' => 'sqlite',
'connections' => [
'sqlite' => [
'driver' => 'sqlite',
'database' => ':memory:',
'prefix' => '',
@adamwathan
adamwathan / mocks.php
Last active October 19, 2016 08:26
Mocks are dangerous
<?php
// Our test
$songs = M::mock('SongCollection');
$songs->shouldReceive('sum')
->with('length')
->andReturn(500);
$album->songs = $songs;
@adamwathan
adamwathan / laravel-env.php
Created April 15, 2014 14:31
Better default for Laravel environment detection
<?php
// bootstrap/start.php
/*
|--------------------------------------------------------------------------
| Detect The Application Environment
|--------------------------------------------------------------------------
|
| Laravel takes a dead simple approach to your application environments
@adamwathan
adamwathan / import-reference.md
Last active December 5, 2016 06:58
Importing class mixins by reference

This is the workflow I really love with Less that's missing in Sass. Killer way to use a library like Bootstrap without coupling any of your markup to Bootstrap itself.

Import a bunch of vendor styles by reference only, mix in the classes you want to keep into your own aliases, no vendor class names end up in your compiled CSS.

Sass doesn't support reference import or the ability to mixin a class, only a mixin.

// Vendor less
.btn {
 // a bunch
<?php
use Illuminate\Contracts\Validation\Rule;
class ValidPaymentToken implements Rule;
{
private $gateway;
private $param1;
private $param2;