Skip to content

Instantly share code, notes, and snippets.

View peinwag's full-sized avatar
:octocat:

Patrick Einwag peinwag

:octocat:
View GitHub Profile
@peinwag
peinwag / StringCalculatorTest.php
Last active December 23, 2015 15:59
tdd session phpunconference2013
<?php
class StringCalculator
{
public function add($numbers)
{
$separators = array(',', "\n");
$matches = null;
preg_match_all("~^\[(.)\]*~", $numbers, $matches);
if(isset($matches[1][0]) && $matches[1][0] != null) {
- http://de.wikipedia.org/wiki/Work_Hard_%E2%80%93_Play_Hard
- http://jungle-world.com/artikel/2012/15/45254.html
- http://www.faz.net/aktuell/feuilleton/dokumentarfilm-work-hard-play-hard-fuehren-durch-weichspuelen-11715703.html
- http://www.zeit.de/kultur/film/2012-04/work-hard-film
- http://www.fes.de/gerechtigkeitswoche/pdf/2014_Bericht_Film&Diskussion.pdf
- http://zurueckgespult.jimdo.com/alle-kritiken/9-sterne/work-hard-play-hard/
<?php
$checklist = [
'Checkliste für Facebook' => [
'Benutzen Sie Facebook über eine SSL-Verschlüsselung?',
'Möchten Sie Inhalte mit allen Personen in der Freundesliste teilen?',
'Soll Sie jede Person kontaktieren können?',
'Soll Ihr Profil von Suchmaschinen angezeigt werden?',
'Soll jeder Inhalte in Ihre Chronik posten können?',
'Soll jeder sehen, was anderen Personen in Ihrer Chronik posten?',
'Wollen Sie Beiträge überprüfen in denen Sie von Freunden markiert wurden?',
<?php
$mapping = [
'fb' => 'Checkliste für Facebook',
'google' => 'Checkliste für Google+',
'linkedin' => 'Checkliste für LinkedIn',
'xing' => 'Checkliste für Xing',
];
Vorarbeit:
Die Fragen sind auf bestimmte Einstellungen gemapped:
-----------------------------------------------------------
<?php
$questions = [
'fb' => [
'Nutzen Sie Facebook verschlüsselt?',
'Sind Ihre Beiträge öffentlich?',
Anschließend erfolgt noch das audit anhand der Usereingabe:
-------------------------------------------------------------
Das Audit ist wiederum auf die entsprechenden Fragen gemapped:
<?php
$mappingQuestionToAudit = [
0 => ['Ja' => 'Geschützter Zugriff auf den Dienst', 'Nein' => 'Möglicherweise können Login-Daten gestohlen werden.'],
1 => ['Ja' => 'Beiträge sind für alle Nutzer von Facebook zugänglich. ', 'Nein' => 'Beiträge werden nur mit ausgewählten Personen geteilt.'],
<?php
$mapping = [
'fb' => 'Checkliste für Facebook',
];
$questions = [
'fb' => [
'Nutzen Sie Facebook verschlüsselt?',
'Sind Ihre Beiträge öffentlich?',

Keybase proof

I hereby claim:

  • I am peinwag on github.
  • I am peinwag (https://keybase.io/peinwag) on keybase.
  • I have a public key ASD0m3um-6C0OhDXEOd1V8gW2dKJm18czvryLyCMFLFbNAo

To claim this, I am signing this object:

<?php
require_once __DIR__ . '/vendor/autoload.php';
$type = 'pdf';
if (isset($argv[1]) && $argv[1] == 'html') {
$type = 'html';
}
// Step1: https://developers.google.com/identity/protocols/OAuth2ServiceAccount => create service account
// Step2: https://console.developers.google.com/apis/api/drive.googleapis.com/overview?project=801063020741 => enable drive api

Keybase proof

I hereby claim:

  • I am peinwag on github.
  • I am peinwag (https://keybase.io/peinwag) on keybase.
  • I have a public key ASBPBgy0I2S7LSas7taam22PXcAyOG0QtPZrslwx9fhDuQo

To claim this, I am signing this object: