Skip to content

Instantly share code, notes, and snippets.

View sydseter's full-sized avatar

Johan Sydseter sydseter

View GitHub Profile
@sydseter
sydseter / php5.3.php
Last active August 29, 2015 14:11 — forked from mbrowne/php5.3.php
<?php
namespace UseCases
{
class TransferMoney extends \DCI\Context
{
//These would ideally be private but they need to be public so that the roles can access them,
//since PHP doesn't support inner classes
public $sourceAccount;
public $destinationAccount;
@sydseter
sydseter / dci2.php
Last active August 29, 2015 14:11 — forked from mbrowne/dci2.php
<?php
//SEE ALSO: https://gist.github.com/mbrowne/5562643 (works in PHP 5.3 too)
//and related discussion: https://groups.google.com/d/msg/object-composition/g4BMSdluuC8/yPR3-a1b2sMJ
ini_set('display_errors', 1);
trait AssignableToRole
{
protected $roles = array();
protected $methods = array();
#!/bin/sh
# Converts a mysqldump file into a Sqlite 3 compatible file. It also extracts the MySQL `KEY xxxxx` from the
# CREATE block and create them in separate commands _after_ all the INSERTs.
# Awk is choosen because it's fast and portable. You can use gawk, original awk or even the lightning fast mawk.
# The mysqldump file is traversed only once.
# Usage: $ ./mysql2sqlite mysqldump-opts db-name | sqlite3 database.sqlite
# Example: $ ./mysql2sqlite --no-data -u root -pMySecretPassWord myDbase | sqlite3 database.sqlite