Skip to content

Instantly share code, notes, and snippets.

@cirpo
cirpo / 0_reuse_code.js
Created January 19, 2014 20:07
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
memory_limit=2048M
<?php
class Cart {
private $status;
public function __construct() {
$this->status = new EmptyCartStatus($this);
}
@cirpo
cirpo / gist:4760759
Last active December 12, 2015 10:39
<?php
if (in_array($name, array_keys($this->calls))) {
if ($this->$name($data)) {
return $this->dialIn($name, $data);
}
} else {
return "Non-existent call";
}
@cirpo
cirpo / Foo.php
Last active December 11, 2015 21:29
<?php
class Foo
{
public function hello($name)
{
echo "hello".$name;
}
public function sayWhat()
@cirpo
cirpo / gist:3888183
Created October 14, 2012 10:19
brew install -V /usr/local/Library/Formula/php53.rb
➜ ~ brew install -V /usr/local/Library/Formula/php53.rb
==> Downloading http://www.php.net/get/php-5.3.17.tar.bz2/from/this/mirror
Already downloaded: /Users/cirpo/Library/Caches/Homebrew/php53-5.3.17
==> ./configure --prefix=/usr/local/Cellar/php53/5.3.17 --localstatedir=/usr/local/var --sysconfdir=/usr/local/etc/php/5.3 --with-config-file-path=/usr/local/etc/php/5.3 --with-config-f
checking whether to enable LIBXML support... yes
checking libxml2 install dir... /usr/local/Cellar/libxml2/2.8.0
checking for xml2-config path... /usr/local/Cellar/libxml2/2.8.0/bin/xml2-config
checking whether libxml build works... no
configure: error: build test failed. Please check the config.log for details.
Error: uncaught throw `Failed executing: ./configure --prefix=/usr/local/Cellar/php53/5.3.17 --disable-debug --localstatedir=/usr/local/var --sysconfdir=/usr/local/etc/php/5.3 --with-config-file-path=/usr/local/etc/php/5.3 --with-config-file-scan-dir=/usr/local/etc/php/5.3/conf.d --with-iconv-dir=/usr --enable-dba --w
~/Sites/ideato/jeep-travel/vagrant(master ✗) vagrant provision
[default] Running provisioner: Vagrant::Provisioners::Puppet...
[default] Running Puppet with /tmp/vagrant-puppet/manifests/sandbox.pp...
stdin: is not a tty
warning: Could not retrieve fact fqdn
notice: /Stage[main]//Exec[/usr/bin/apt-get update]/returns: executed successfully
notice: /Stage[main]/Mysql::Server/Service[mysqld]/enable: enable changed 'false' to 'true'
notice: /Stage[main]/Sandbox/Exec[pear-init]/returns: executed successfully
notice: /Stage[main]/Sandbox/Exec[phpunit-init]/returns: executed successfully
notice: /Stage[main]/Sandbox/Mysql::Db[mydb]/Database[mydb]/ensure: created
class sandbox {
package {
["php5-cli", "php-pear", "php5-xdebug", "php5-sqlite", "php5-intl", "php5-curl", "php-apc", "apache2", "mysql-server", "php5-mysql", "libapache2-mod-php5"]:
ensure => latest;
}
package {
"git-core":
ensure => latest;
}
function parse_git_dirty {
[[ $(git status 2> /dev/null | tail -n1) != "nothing to commit (working directory clean)" ]] && echo "*"
}
function parse_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/[\1$(parse_git_dirty)]/ "
}
PS1='\[\033[01;31m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\[\033[01;33m\]$(parse_git_branch)\[\033[0m\]\$ '
export PSI
<?xml version="1.0" encoding="UTF-8"?>
<!-- http://www.phpunit.de/manual/current/en/appendixes.configuration.html -->
<phpunit
backupGlobals = "false"
backupStaticAttributes = "false"
colors = "true"
convertErrorsToExceptions = "true"
convertNoticesToExceptions = "true"
convertWarningsToExceptions = "true"