Skip to content

Instantly share code, notes, and snippets.

View IngmarBoddington's full-sized avatar

Ingmar Boddington IngmarBoddington

View GitHub Profile
@IngmarBoddington
IngmarBoddington / Symfony
Last active August 29, 2015 14:01
Symfony Setup / Config / Some Fundamentals
SETUP (Vanilla Demo Install)
Install apc
sudo pecl install apc
Install composer
curl -sS https://getcomposer.org/installer | php
sudo mv composer.phar /usr/local/bin/composer
composer create-project symfony/framework-standard-edition myproject/ ~2.4
- Example new project through composer
@IngmarBoddington
IngmarBoddington / mail_headers.php
Created June 1, 2014 15:45
Basic function for sending html / txt mixed content email via native php mail() function
function sendMail($toEmail, $fromEmail, $fromName, $replyEmail, $subject, $html = '', $text = '') {
$boundary = "nextPart";
$headers = 'From: '.$fromName.' <'.$fromEmail.'>'."\r\n";
$headers .= 'Reply-To: '.$replyEmail."\r\n";
$headers .= 'X-Mailer: PHP/'.phpversion()."\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: multipart/alternative; boundary = $boundary\r\n";
//text version
@IngmarBoddington
IngmarBoddington / template_class.php
Created June 1, 2014 15:56
Verbose - toString and get / set enforcement
<?php
class templateClass {
private $variable = 'pretest'; //Test variable
function __contruct() {
//Init
}
@IngmarBoddington
IngmarBoddington / pearPeclEtc
Created June 4, 2014 15:11
pear useful commands + setup for pear / PHPCS / PHPUnit / PHPMD / PHPDocumentor /
pear clear-cache
pear update-channels
- Housekeeping
pear config-get php_dir
- Displays directory which should be included in php include_path for correct working of packages
pear list -a
- List installed packages by channel
@IngmarBoddington
IngmarBoddington / LaunchDaemons
Created June 5, 2014 11:50
Example launch Deamon config for OSX (should live in /Library/LaunchDaemons) (Example is for local Sonar install)
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.sonar.services</string>
<key>ProgramArguments</key>
<array>
<string>/Users/iboddington/apps/sonar-3.6/bin/macosx-universal-64/sonar.sh</string>
<string>start</string>
@IngmarBoddington
IngmarBoddington / companyNumbers
Created June 11, 2014 11:41
UK Company Numbers
Company Registration Number Formats English and Welsh companies have registration numbers that consist of 8 digits. Companies registered in Scotland and Northern Ireland and those registered by the Financial Services Authority have a 1 or 2 character alphabetic prefix. The following are possible values for the prefix. Value Description AC Assurance Company England and Wales FC Foreign Company England and Wales GE European Economic Interest Grouping (EEIG) England and Wales GN EEIG Northern Ireland GS EEIG Scotland IC Investment Company with Variable Capital (ICVC) England and Wales IP Industrial and Provident England and Wales LP Limited Partnership England and Wales NA Assurance Company Northern Ireland NF Foreign Company Northern Ireland NI Northern Ireland Company NL Limited Partnership Northern Ireland (This prefix is not applicable to CT and should not be used) NO Other Northern Ireland NP Industrial and Provident Northern Ireland NR Royal Charter Northern Ireland NZ Not Companies Act Northern Irelan
@IngmarBoddington
IngmarBoddington / unitTesting
Last active August 29, 2015 14:02
Basic PHPUnit Notes
A few gard won lessons!
1. You cannot set expectations on a non-mocked method
2. Don't use multiple mocks of the same class and then inject these into another mock
3. When using at, this applies at an object level, not method
4. When using at, any mocked methods will be expected in the ordering
phpunit
- Standard use (consumes phpunit.xml.dist)
@IngmarBoddington
IngmarBoddington / pom.xml
Created July 6, 2014 21:10
Apache Maven pom for (basic + junit + sonar requirements)
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.mycompany.app</groupId>
<artifactId>my-app</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>NAME</name>
@IngmarBoddington
IngmarBoddington / phpdocTemplates
Last active August 29, 2015 14:11
Doc Block templates (PHPDoc style)
/**
* IspPrimitives Product_SupplierProductRules
*
* @category category
* @package package
* @subpackage sub package
* @author Name <email>
*
* @copyright year company
* @link doc link
@IngmarBoddington
IngmarBoddington / JMS
Last active August 29, 2015 14:16
JMS Specific Java Notes (Glassfish, ActiveMQ)
Message Types (http://docs.oracle.com/javaee/6/api/javax/jms/Message.html)
- String - Commonly used to avoid versioning issues
- Object (serialised)
- ByteMessage
- MapMessage
- StreamMessage
JNDI
- Java Naming Directory Index
- Dependancy Injections