This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// This relates to Matthias Verraes talk on unbreakable domain models | |
// (which is very good). Slides are http://verraes.net/2013/06/unbreakable-domain-models/ | |
// and this is about the end of the talk (about three-quarters through the slide deck). | |
// | |
// I like the whole specification thing, but want to be able to combine them | |
// dynamically (in the language of the talk, the tenant can create their own | |
// specification of what a premium custom is), using building blocks we provide. | |
class CustomerSpecificationSet |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// This is another response to Mattias Verraes talk on unbreakable domain | |
// models (slides at http://verraes.net/2013/06/unbreakable-domain-models/) | |
// Near the end there's a bit where he suggests you implement business logic | |
// rules initially as code (i.e. an array filter) and secondly as sql. | |
// You can then test that these are consistent (though the tests in the talk | |
// don't show correctness, there needs to be a test against a known good result | |
// too). But with that, it seems like a nice way to have testable SQL. | |
// A problem for me with the example (which is obviously shortened for the slide example) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Domain expert says: | |
// Tenant can construct their own 'premium customer specification' from a list of ingredients | |
// Tenant chooses 3 orders, one in the last month: | |
$spec1 = new CustomerWith3OrdersIsPremium(); | |
$spec2 = new CustomerWithRecentOrderIsPremium(); | |
$allSpecs = new CompositeCustomerSpecification(); | |
$allSpecs->add($spec1)->add($spec2); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// this: https://twitter.com/raganwald/status/445938910808391680 | |
// Wrap a function f (which accepts two arguments, and b) to enforce | |
// preconditions (if I understand them correctly) are guards on | |
// parameter values | |
// You can also optionally add a postcondition afterwards | |
// though it'd be nicer to add this in the main preCondition function really |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Marvellous implements Community { | |
public function smart () { | |
return true; | |
} | |
public function helpful () { | |
return true; | |
} | |
public function join (Anyone $person) { | |
return true; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
error_reporting(E_ALL); | |
$host = 'mongodb://127.0.0.1/test'; | |
echo "\n Testing deprecated MongoClient::connected property \n"; | |
$client1 = new \MongoClient($host); | |
echo "done"; // breakpoint on this line triggers deprecation notice |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
javascript:(function () { | |
var d = document.createElement('canvas'), | |
ctx = d.getContext('2d'), | |
w = window.innerWidth, | |
h = window.innerHeight, | |
x = 0, | |
code_to_0256 = function (code) { | |
if (code < 32 || code > 127) { | |
code = 90; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
javascript:(function () { | |
var d = document.createElement('canvas'), | |
ctx = d.getContext('2d'), | |
tweet = document.querySelector('.expanded-conversation .tweet .tweet-text'), | |
box, | |
w, | |
h = 80, | |
x = 0, | |
code_to_0256 = function (code) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> | |
<html> | |
<head> | |
<title>Example</title> | |
<link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/combo?2.8.0r4/build/reset-fonts-grids/reset-fonts-grids.css&2.8.0r4/build/assets/skins/sam/skin.css"> | |
<style> | |
.yui-skin-sam .yui-toolbar-container .yui-toolbar-personal { | |
width: 120px; | |
} | |
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function() { | |
var Dom = YAHOO.util.Dom, | |
Event = YAHOO.util.Event, | |
Lang = YAHOO.lang, | |
Toolbar = YAHOO.widget.Toolbar; | |
/** | |
* The Rich Text Editor is a UI control that replaces a standard HTML textarea; it allows for the rich formatting of text content, including common structural treatments like lists, formatting treatments like bold and italic text, and drag-and-drop inclusion and sizing of images. The Rich Text Editor's toolbar is extensible via a plugin architecture so that advanced implementations can achieve a high degree of customization. | |
* @constructor | |
* @class SimpleEditor |
OlderNewer