Skip to content

Instantly share code, notes, and snippets.

@Meroje
Meroje / 1-Entity-Repository-Controller-Pattern.md
Created November 18, 2012 20:53
Entity Repository in Laravel4

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 December 14, 2012 11:45
Illuminate custom Router (from JasonLewis)
$app['router'] = $app->share(function($app)
{
return new Feather\Routing\Router($app);
});
Verifying that +meroje is my blockchain ID. https://onename.com/meroje
@Meroje
Meroje / dabblet.css
Last active December 14, 2015 22:39
.elem outline box, from http://learnlayout.com/
/**
* .elem outline box
*/
.elem {
border: solid #6AC5AC 3px;
position: relative;
}
.elem p {
<?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 January 20, 2016 22:17
Coreos ipxe provision
#!/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
<?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);
/*! 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');
#!/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}
@Meroje
Meroje / scw_facts.py
Last active September 6, 2017 10:13
Ansible Scaleway custom facts, based on https://github.com/br0ziliy/ansible-module-gce-facts
#!/usr/bin/python
# -*- coding: utf-8 -*-
DOCUMENTATION = '''
---
module: scw_facts
'''
EXAMPLES = '''
# To see the list of all the facts use command below: