Skip to content

Instantly share code, notes, and snippets.

@setup
function env(string $key) {
$dotenv = file_get_contents('.env');
$rows = explode("\n", $dotenv);
$search = array_filter($rows, function ($row) use ($key) {
if (strstr($row, $key)) {
return $row;
}
});
@jaggy
jaggy / Contract Killer 3.md
Created November 9, 2015 09:09
The latest version of my ‘killer contract’ for web designers and developers

Contract Killer

The popular open-source contract for web designers and developers by Stuff & Nonsense

  • Originally published: 23rd December 2008
  • Revised date: October 8th 2015
  • Original post

@jaggy
jaggy / Mock.php
Last active September 9, 2015 08:11
<?php
class Mock
{
/**
* Full path of the class name to mock.
*
* @var string
*/
protected $class;
<?php
/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
<?php
namespace App;
use ReflectionClass;
trait RecordsActivity
{
public static $_recordableEvents;
@jaggy
jaggy / csstyle.styl
Created March 17, 2015 07:39
My --csstyle micro port
component(name) {
.{name} {
{block}
}
}
part(name) {
&__{name} {
{block}
@jaggy
jaggy / json_editor.css
Last active August 8, 2016 16:21
My JSON Editor theme.
* {
font-family: 'Operator Mono', 'Inconsolata-dz for Powerline', 'Fira Code', Monaco !important;
}
html {
background: rgb(12, 26, 33);
color: rgba(200, 169, 111, 1);
}
var gulp = require('gulp');
var stylus = require('gulp-stylus');
var jade = require('gulp-jade');
var jeet = require('jeet');
var rupture = require('rupture')
var path = {
views: './app/*.jade',
styles: './app/stylus/*.styl'
};
<?php
class Object
{
public static function property($object, $property)
{
if (! property_exists($object, $property)) {
return null;
}
<?php
// model
public function paginate($page = 1, $order = [], $limit = 10)
{
// default values
$order = ($order) ?: [];
$limit = ($limit) ?: 10;
$query = $this->product->take($limit);