Skip to content

Instantly share code, notes, and snippets.

The problem with Faking it

The Problem

Developer (A) creates 2 classes, MyClass and Dependency:

class MyClass
{
    private $dependency;
{
"results": [
{
"@id": "http://www.bbc.co.uk/things/ea9f4166-b41c-43c2-9bcd-832a68d41a4e#id",
"@type": [
"LiveEventPage",
"CreativeWork"
],
"dateCreated": "2013-10-04T14:56:01+00:00",
"dateModified": "2013-10-04T14:56:12+00:00",
<?php
class Parser
{
public function parse($json = null)
{
return array_reduce($this->parseItems($json), array($this, 'parseItem'), new Collection());
}
private function parseItems($json)
@danscotton
danscotton / gel-grid.js
Last active December 20, 2015 05:39
gel grid
(function() {
var columns = 12,
css = '.bbcnews-debug-grid{position:fixed;left:0;top:0;right:0;bottom:0;z-index:9999;display:block;pointer-events:none;}.bbcnews-debug-grid__inner{margin:0 auto;padding:0 4px;height:100%}.bbcnews-debug-column{float:left;width:8.333333333%;height:100%}.bbcnews-debug-column__inner{margin-left:4px;margin-right:4px;height:100%;background-color:rgba(0,171,236,0.2)}@media(min-width:400px){.bbcnews-debug-grid__inner{padding:0 12px}}@media(min-width:600px){.bbcnews-debug-grid__inner{padding:0 8px}.bbcnews-debug-column__inner{margin-left:8px;margin-right:8px}}@media(min-width:1008px){.bbcnews-debug-grid__inner{padding:0;width:992px;max-width:992px}}';
function createColumn(i) {
var column = document.createElement('div'),
inner = document.createElement('div');
column.className = 'bbcnews-debug-column bbcnews-debug-column--'+i;
<div class="correspondent__stories" <?= $this->next ?>>
<? foreach($this->stories as $story): ?>
<h2><?= $story['headline'] ?></h2>
<? endforeach; ?>
</div>
<?
// ...
<div class="correspondent__stories" <?= $this->hasNext ? 'data-next="'.$this->nextLink.'"' : '' ?>>
<? foreach($this->stories as $story): ?>
<h2><?= $story['headline'] ?></h2>
<? endforeach; ?>
</div>
<? if($this->hasNext): ?>
<div class="correspondent__stories" data-next="<?= $this->nextLink ?>">
<? else: ?>
<div class="correspondent__stories">
javascript:(function() {var script = document.createElement('script'); script.setAttribute('src', 'https://gist.github.com/danscotton/56189f7251439232e84e/raw/grid_bookmarklet.js'); document.body.appendChild(script); }());
.device--feature .hide--feature,
.device--smart .hide--smart,
.device--tablet .hide--tablet,
.device--desktop .hide--desktop {display: none !important;}
{
"bold_folder_labels": true,
"color_scheme": "Packages/RailsCasts Colour Scheme/RailsCastsColorScheme.tmTheme",
"draw_white_space": "all",
"folder_exclude_patterns":
[
".git",
".svn",
".hg",
"CVS",
// ------------------------------------------------------------
@mixin group-1 { @media (max-width: 399px) { @content }}
@mixin group-2 { @media (min-width: 400px) { @content }}
@mixin group-3 { @media (min-width: 600px) { @content }}
@mixin group-4 { @media (min-width: 1008px) { @content }}
// ------------------------------------------------------------
.fixed-margins {