Skip to content

Instantly share code, notes, and snippets.

View mount_ebs.sh
#!/bin/bash
#attach the EBS to /dev/sdf before running it
#format EBS
mkfs -t ext4 /dev/xvdf
#copy original /var to /dev/xvdf
mkdir /mnt/new
mount /dev/xvdf /mnt/new
cd /var
@cowlby
cowlby / generate.php
Created Dec 3, 2013
This script can be used for generating PHP model for PDT. It builds PHP functions according to the loaded extensions in running PHP, using complementary information gathered from PHP.net documentation.
View generate.php
<?php
/**
* This script can be used for generating PHP model for PDT.
* It builds PHP functions according to the loaded extensions in running PHP,
* using complementary information gathered from PHP.net documentation
*
* @author Michael Spector <michael@zend.com>
*/
if (version_compare(phpversion(), "5.0.0") < 0) {
@cowlby
cowlby / gist:1603241
Created Jan 12, 2012 — forked from tankchintan/gist:1335220
Procedure for installing and setting Sun JDK Java on Default Amazon Linux AMI
View gist:1603241
# Get the latest Sun Java SDK from Oracle http://www.oracle.com/technetwork/java/javase/downloads/jdk-7u1-download-513651.html
wget http://download.oracle.com/otn-pub/java/jdk/7u1-b08/jdk-7u1-linux-i586.rpm
# Rename the file downloaded, just to be nice
mv jdk-7u1-linux-i586.rpm\?e\=1320265424\&h\=916f87354faed15fe652d9f76d64c844 jdk-7u1-linux-i586.rpm
# Install Java
sudo rpm -i jdk-7u1-linux-i586.rpm
# Check if the default java version is set to sun jdk
@cowlby
cowlby / reflector.conf.php
Created Dec 7, 2011
PHP script that creates PHP stubs for PDT from extensions and docbooc XML
View reflector.conf.php
<?php
define('DOCBOOK', '/var/www/Reflector/phpdoc/reference/');
@cowlby
cowlby / CacheInterface.php
Created Nov 4, 2011
Write-through caching of session data
View CacheInterface.php
<?php
/**
* Cache interface to provide a uniform interface for the SessionStorage classes.
*
* @author Jose Prado <pradador@me.com>
*/
interface CacheInterface
{
/**
@cowlby
cowlby / collection_widget.twig
Created Oct 17, 2011
Customizing form collections in Symfony2
View collection_widget.twig
{% block collection_widget %}
{% spaceless %}
<div class="collection">
{% if prototype is defined %}
{% set attr = attr|merge({'data-prototype': block('collection_item_widget') }) %}
{% endif %}
<div {{ block('widget_container_attributes') }}>
{{ form_errors(form) }}
<ul>
{% for rows in form %}
@cowlby
cowlby / form_div_layout.html.twig
Created Oct 17, 2011
Customizing form collections in Symfony2
View form_div_layout.html.twig
{% block collection_widget %}
{% spaceless %}
{% if prototype is defined %}
{% set attr = attr|merge({'data-prototype': block('collection_item_widget') }) %}
{% endif %}
<div class="collection" {{ block('widget_container_attributes') }}>
{{ form_errors(form) }}
<table>
<thead>
<tr>
@cowlby
cowlby / PSR-0-final-proposal.md
Created Oct 17, 2011 — forked from Thinkscape/PSR-0-final-proposal.md
PSR-0 Final Proposal (PHP Standards Working Group)
View PSR-0-final-proposal.md

PSR-0 Final Proposal (PHP Standards Working Group)

The following describes the mandatory requirements that must be adhered to for autoloader interoperability.

Mandatory:

  • A fully-qualified namespace and class must have the following structure \ <Vendor Name> \ (<Namespace>)* \ <Class Name>
  • Each namespace must have a top-level namespace ("Vendor Name").
  • Each namespace can have as many sub-namespaces as it wishes.
  • Each namespace separator is converted to a DIRECTORY_SEPARATOR when loading from the file system.
  • Each "_" character in the CLASS NAME is converted to a DIRECTORY_SEPARATOR. The "_" character has no special meaning in the namespace.
View Challenge.php
<?php
use DateTime;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
use Symfony\Bridge\Doctrine\Validator\Constraints as DoctrineAssert;
/**
* @ORM\Entity
* @ORM\Table(name="challenges")
@cowlby
cowlby / Schema.sql
Created Apr 19, 2011
Scrapes the Potato Counter off the Aperture Science website using Zend_Http_Client as the client, DOMDocument as the DOM browser, and Zend_Db as the interface to a simple database.
View Schema.sql
CREATE TABLE `potatoes` (
`id` smallint(11) NOT NULL AUTO_INCREMENT,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`count` int(11) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=64 DEFAULT CHARSET=latin1;
You can’t perform that action at this time.