Skip to content

Instantly share code, notes, and snippets.

View camfindlay's full-sized avatar

Cam Findlay camfindlay

View GitHub Profile
@camfindlay
camfindlay / mailcatcher-install.md
Last active October 31, 2017 19:54 — forked from pitpit/mailcatcher-install.md
Install Mailcatcher on OSX
@camfindlay
camfindlay / Install Composer to use MAMP's PHP.md
Last active August 29, 2015 14:25 — forked from kkirsche/Install Composer to use MAMP's PHP.md
How to install Composer globally using MAMP's PHP

##Create an alias to MAMP's PHP installation

To do this, we can simply create an alias for our bash profile. We'll be doing this is nano, though you can do it in vim or a number of other editors as well.

Within the terminal, run:

nano ~/.bash_profile

This will open nano with the contents, at the top in a blank line add the following line:

@camfindlay
camfindlay / mamp_install_composer.bash
Last active August 29, 2015 14:25 — forked from pwenzel/0. mamp_install_composer.bash
Global composer install for MAMP Users on OSX
# Global composer install for MAMP Users on OSX
# http://getcomposer.org/doc/00-intro.md#globally
# For PHP 5.4 Use:
# alias php=/Applications/MAMP/bin/php/php5.4.4/bin/php;
alias php=/Applications/MAMP/bin/php/php5.3.6/bin/php;
curl -sS https://getcomposer.org/installer | php;
mv composer.phar /usr/local/bin/composer;
composer help;
@camfindlay
camfindlay / SilverStripe on Heroku
Last active March 11, 2021 04:26
SilverStripe database setup on Heroku.
mysite/_config.php
<?php
// . . . config above
//Heroku ClearDB support
if(isset($_ENV['CLEARDB_DATABASE_URL'])) {
global $databaseConfig;
$parts = parse_url($_ENV['CLEARDB_DATABASE_URL']);
$databaseConfig['type'] = 'MySQLDatabase';
$databaseConfig['server'] = $parts['host'];
$databaseConfig['username'] = $parts['user'];
@camfindlay
camfindlay / go.sh
Last active August 29, 2015 14:15 — forked from AshKyd/go.sh
# Fedora-specific PHP environment setup
yum install php php-mbstring php-mysql php-gd
# Manually install composer via https://getcomposer.org/download/
# Install Silverstripe & sqlite driver
composer create-project silverstripe/installer ./ 3.1.10
composer require silverstripe/sqlite3 1.3.*@dev
# Set up router to simulate mod-rewrite
@camfindlay
camfindlay / pr.md
Last active August 29, 2015 14:13 — forked from piscisaureus/pr.md

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@camfindlay
camfindlay / ConfigYAML
Created June 25, 2014 09:41
Custom SiteConfig for Sponsor Links and Logos
SiteConfig:
extensions:
- CustomSiteConfig
@camfindlay
camfindlay / gist:10688811
Created April 14, 2014 23:02
SilverStripe: Switching template in custom controller using GET variable.
<?php
class MyController extends ContentController {
private static $allowed_actions = array(
'myaction',
'myotheraction'
);
//A deafult template named the same as the controller as a fall back.
private static $template = "MyController";
@camfindlay
camfindlay / gist:9264915
Created February 28, 2014 03:54
Happy Birthday SilverStripe!
<?php
$string = '';
for ($i = 0; $i < 4; $i++) {
$string .= "Happy birthday ";
if ($i != 2) {
$string .= "to you!\n";
} else {
$string .= "dear %s!\n";
}
}
@camfindlay
camfindlay / gist:9264205
Created February 28, 2014 02:49
SilverStripe 3.1.3 Release Candidates
"require": {
"silverstripe/cms": "3.1.*@RC",
"silverstripe/framework": "3.1.*@RC",
}