Skip to content

Instantly share code, notes, and snippets.

#Dinner Club Markdown

Making practical and effective use of SRP, the Dinner Club program consists of 3 different files; checksplitter.rb, dinnerclub.rb, and app.rb. CheckSplitter and DinnerClub are two different classes with different functions; carefully laid out to handle a single responsibility amongst themselves and return values to the method. The last file app.rb handles the interaction between the program and user. ##Great, so what does the program do? Programs do things - getting there is a long road but the outcome is sometimes simple to explain. This program, Dinner Club, outputs a few things: the amount each member of Dinner Club has paid, where they went, and who went on the outing. The program looks like this when you run it:

Who is in the dinner club? (Comma-separated)
Sam, James, Amy
Okay, great. Go out to eat?
@jeremeamia
jeremeamia / config.php
Last active March 26, 2016 11:36
Mini-PHP config system for fun. (MIT Licensed)
<?php
namespace config;
const DELIM = '.';
/**
* Loads a configuration array from a file, based on it's type.
*
* @param string $path
@gthln
gthln / gist:8401080
Created January 13, 2014 14:23
Install Composer on Managed Hosting at Domainfactory

Install Composer on Managed Hosting at Domainfactory

Step 1:

Log in to your Managed Hosting Server via SSH

Step 2:

Add these two lines to .bashrc:

@jbenet
jbenet / simple-git-branching-model.md
Last active April 9, 2024 03:31
a simple git branching model

a simple git branching model (written in 2013)

This is a very simple git workflow. It (and variants) is in use by many people. I settled on it after using it very effectively at Athena. GitHub does something similar; Zach Holman mentioned it in this talk.

Update: Woah, thanks for all the attention. Didn't expect this simple rant to get popular.

@mnapoli
mnapoli / DI containers summary.md
Last active May 7, 2018 07:58
DI containers usage comparison
@funkatron
funkatron / webandphp.txt
Created February 22, 2013 17:27
Letter I wrote to the editor of webandphp.com and their PR contact for conferences.
Hey,
On Twitter, my friend Cal Evans pointed this photo out:
https://twitter.com/mrhazell/status/304995296528715776
I do not know the intent of the shirt, but many have read it as a pun on "penis," as in "enhance your P H Pness."
This kind of thing really disappoints me as a member of the PHP and open source community. Many of us are working hard to address the extremely skewed gender numbers in open source, and this kind of thing -- intentional or not -- sends a "PHP is a guys-only club" message. That makes me actively much less interested in Web and PHP, and products or services provided by related companies.
while ($dir && ($file = readdir($dir)) !== false) {
if ($file != "." && $file != ".." && $file != ".DS_Store") {
}
}
// Require the file
$class = "ClassName";
$r = new ReflectionClass($class);
$str = '';
foreach($r->getMethods(ReflectionMethod::IS_PUBLIC) as $method) {
$rm = new ReflectionMethod($class, $method->name);
$pieces = array();
foreach($rm->getParameters() as $params ) {
@nikic
nikic / accessors.markdown
Created October 13, 2012 11:22
Analysis of getter/setter usage in Symfony and Zend Framework

In order to get a bit of "hard data" on what accessors will actually be used for once they are introduced I wrote a small script that scans through a codebase, finds all getter and setter methods and checks them for various characteristics. (The analyze.php file in this Gist.)

Here are the results of running it on a Symfony (Standard) skeleton.

absoluteTotal        => 18516 (486.6%)
total                =>  3805 (100.0%)
skipped              =>   124 (  3.3%)
@elazar
elazar / phpunit-log-junit.php
Created May 25, 2012 23:43
PHPUnit --log-junit processor
<?php
/**
* This script is used to process the output of a PHPUnit test run
* that uses --log-junit for the purposes of timing each executed
* test method. It outputs test methods with their respective
* runtimes in order from largest to smallest. Times are in
* seconds. The script accepts paths to any number of files in the
* JUnit log format.
*
* Ex: php phpunit-log-junit.php /path/to/junit-log1.xml /path/to/junit-log2.xml ...