Skip to content

Instantly share code, notes, and snippets.

Martin Bean martinbean

Block or report user

Report or block martinbean

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
martinbean / WHOIS look-up bookmark
Created Oct 26, 2010
Want to quickly do a WHOIS look-up of the domain of the current website you're browsing? Simple save the following snippet as a bookmark in your favourite WebKit-enabled web browser...
View WHOIS look-up bookmark
View toro_example_index.php
// include both our template library and the Toro framework
// set our template directory and a new instance
$tpl_path = dirname(__FILE__) . '/templates/';
$tpl = new Template($tpl_path);
View gist:874640
var myVideo:NetConnection = new NetConnection();
var newStream:NetStream = new NetStream(myVideo);
martinbean / gist:1037465
Created Jun 21, 2011
CSS pseudo selected styles
View gist:1037465
body.home #navigation li.home a, #navigation a, #navigation a,
body.wrestlers #navigation li.wrestlers a, #navigation a {
background: #ff9900;
View gist:1042394
$file_to_upload = array(
'ticket_attachment[attachment]' => '@' . $_SERVER['DOCUMENT_ROOT'] . '/nmsworkbacklog/crown.jpg',
'ticket_attachment[description]' => 'test description'
$headers = array();
$headers[] = 'Authorization: Basic ' . base64_encode('nms/martinbean:' . $this->registry->get('authenticate')->getApiKey());
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, '');
curl_setopt($ch, CURLOPT_POST, true);
martinbean / xml.php
Created Nov 16, 2012
Building an XML file with DOMDocument
View xml.php
$products = array(
'title' => 'Product #1',
'description' => 'Lorem ipsum'
'title' => 'Product #2',
'description' => 'Lorem ipsum'
martinbean / composer.json
Created Nov 23, 2012
Code samples for “Uploading files with Amazon’s new PHP SDK” blog post.
View composer.json
"require": {
"aws/aws-php-sdk": "dev-master"
martinbean / gist:4162031
Created Nov 28, 2012
Martin’s fantastic naming convention document
View gist:4162031

Martin’s fantastic naming convention document

Controllers: plural

  • For example: UsersControllers

Models: singular

  • A model representes one item, i.e. a record from a database. So: User or UserModel.
martinbean / google-feed.php
Created Dec 20, 2012
Building a Google RSS feed with DOMDocument.
View google-feed.php
$xml = new DOMDocument('1.0', 'UTF-8');
$xml->formatOutput = true;
$rss = $xml->createElement('rss');
$rss->setAttribute('version', '2.0');
$rss->setAttributeNS('', 'xmlns:g', '');
martinbean / NewsArticle.php
Last active Dec 10, 2015
Fetching records from one table based on existence of records in a HABTM relation.
View NewsArticle.php
class NewsArticle extends AppModel {
public $name = 'NewsArticle';
public $hasAndBelongsToMany = array(
'Image' => array(
'joinTable' => 'news_articles_images'
You can’t perform that action at this time.