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
auto_register = new Object(); | |
auto_register.add_member = function(member_id, group_id, ignore, callback) { | |
x = new XMLHttpRequest(); | |
x.onreadystatechange = function() { | |
if (x.readyState == 4) { | |
if (x.status == 200) { | |
if (callback) | |
callback(member_id, group_id); | |
console.log('success', member_id); | |
} else |
<?php | |
use Aws\Sns\SnsClient; | |
use Illuminate\Contracts\Broadcasting\Broadcaster; | |
class SnsBroadcaster implements Broadcaster | |
{ | |
/** @var SnsClient */ | |
private $sns; | |
/** @var array */ |
node { | |
// https://registry.hub.docker.com/_/maven/ | |
def maven32 = docker.image('maven:3.2-jdk-7-onbuild'); | |
stage 'Mirror' | |
// First make sure the slave has this image. | |
// (If you could set your registry below to mirror Docker Hub, | |
// this would be unnecessary as maven32.inside would pull the image.) | |
maven32.pull() | |
// We are pushing to a private secure docker registry in this demo. |
<?php | |
/** | |
* A helper file for Laravel 5, to provide autocomplete information to your IDE | |
* Generated for Laravel Lumen (5.1.1) (Laravel Components 5.1.*) on 2015-08-18. | |
* | |
* @author Barry vd. Heuvel <[email protected]> | |
* @see https://github.com/barryvdh/laravel-ide-helper | |
*/ | |
namespace { |
<?php | |
trait CastsValueObjects | |
{ | |
protected function castAttribute($key, $value) | |
{ | |
$castToClass = $this->getValueObjectCastType($key); | |
// no Value Object? simply pass this up to the parent | |
if (!$castToClass) { | |
return parent::castAttribute($key, $value); |
#!/bin/bash | |
if [ -f ~/Library/KeyBindings/DefaultkeyBinding.dict ]; then | |
echo "~/Library/KeyBindings/DefaultkeyBinding.dict already exists" | |
exit -1 | |
fi | |
mkdir -p ~/Library/KeyBindings | |
cat << EOF > ~/Library/KeyBindings/DefaultkeyBinding.dict | |
{ | |
"₩" = ("insertText:", "\`"); |
// CQS (Command-Query Separation) | |
// Bertrand Meyer devised the CQS principle | |
// It states that every method should either be a command that performs an action, or a | |
// query that returns data to the caller, but not both. In other words, asking a question | |
// should not change the answer. More formally, methods should return a value only if they | |
// are referentially transparent and hence possess no side effects. | |
// | |
// Example: | |
public class CustomerService |
If you have two days to learn the very basics of modelling, Domain-Driven Design, CQRS and Event Sourcing, here's what you should do:
In the evenings read the [Domain-Driven Design Quickly Minibook]{http://www.infoq.com/minibooks/domain-driven-design-quickly}. During the day watch following great videos (in this order):
#!/bin/sh | |
# option 2: paste this into user-data to automate install via boot script | |
# NOTE: update --label=owner=YOURNAME below if you want to easily identify yours | |
# renames the host to have a suffix of alexellisio | |
export original=$(cat /etc/hostname) | |
sudo hostname $original-master-alexellisio | |
echo $original-master-alexellisio | sudo tee /etc/hostname | |
apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D |