Skip to content

Instantly share code, notes, and snippets.

Avatar

Jérôme Foray Meroje

View GitHub Profile
View 1-Entity-Repository-Controller-Pattern.md

Some Key points

[21:35:16] 1. Controllers call out to a repository to answer questions (like give me comments for a post, or are there any active users)
[21:35:27] so the repositories contain those business rules
[21:35:37] the entities (orm models) contain the application agnostic business rules
[21:35:42] like what makes a valid person
[21:36:09] 2. The repository interacts with the ORM to get the entities
[21:36:42] 3. The controller is merely responsible for processing the request, calling out to the appropriate repositories, and constructing the response
[21:36:52] All of the interactions are injected of course

@Meroje
Meroje / global.php
Created Dec 14, 2012
Illuminate custom Router (from JasonLewis)
View global.php
$app['router'] = $app->share(function($app)
{
return new Feather\Routing\Router($app);
});
View gist:50427926a655f8aa5f97
Verifying that +meroje is my blockchain ID. https://onename.com/meroje
View dabblet.css
/**
* .elem outline box
*/
.elem {
border: solid #6AC5AC 3px;
position: relative;
}
.elem p {
View 0-usage.php
<?php
with(new Page())->makeRoot();
with(new Page())->makePreviousSiblingOf(Page::find(1))
with(new Page())->makeNextSiblingOf(Page::find(1))
with(new Page())->makeLastChildOf(Page::find(5))
with(new Page())->makeFirstChildOf(Page::find(2))
Page::find(2)->children()
Page::find(2)->parent()
Page::find(2)->sibling()
Page::find(2)->isDescendant(Page::find(3))
@Meroje
Meroje / cloud-config-bootstrap.sh
Last active Jan 20, 2016
Coreos ipxe provision
View cloud-config-bootstrap.sh
#!/bin/bash
wget -O cloud-config.yaml http://10.10.20.1/cloud-config.php
coreos-install -d /dev/vda -c cloud-config.yaml
reboot
@Meroje
Meroje / comment.php
Created Dec 4, 2013
TimeDiff For Humans
View comment.php
<?php
use Carbon\Carbon;
class Comment extends Eloquent {
protected $guarded = array();
protected $softDelete = true;
public static $rules = array();
View settings.php
<?php
class DBconfiguratorObject implements ArrayAccess, Serializable {
protected $config = array();
protected $table = null;
private static $_instance = null;
public static function instance($tableName = 'config'){
if(self::$_instance === null){
self::$_instance = new self($tableName);
View webpack.config.js
/*! webpack.config.js | Build JS, CSS,.. client assets and StyleGuide */
'use strict';
var webpack = require('webpack');
var ExtractTextWP = require('extract-text-webpack-plugin');
var HtmlWP = require('html-webpack-plugin');
var path = require('path');
var moment = require('moment');
View setup-tinc-peer.sh
#!/usr/bin/env bash
# Based on https://github.com/edanaher/scaleway-utils/blob/45d89a534d0ff9427a120e509d215e195fe083dc/tinc/add-tinc.sh
export PS4="\[\033[32;1m++\[\033[0m "
set -ex
HOST=$1
TINCIP=$2
TINCNAME=${3:-$1}
You can’t perform that action at this time.