Skip to content

Instantly share code, notes, and snippets.

@cirpo
cirpo / 0_reuse_code.js
Created Jan 19, 2014
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
View Cart.php
<?php
class Cart {
private $status;
public function __construct() {
$this->status = new EmptyCartStatus($this);
}
View gist:4760759
<?php
if (in_array($name, array_keys($this->calls))) {
if ($this->$name($data)) {
return $this->dialIn($name, $data);
}
} else {
return "Non-existent call";
}
View Foo.php
<?php
class Foo
{
public function hello($name)
{
echo "hello".$name;
}
public function sayWhat()
@cirpo
cirpo / gist:3888183
Created Oct 14, 2012
brew install -V /usr/local/Library/Formula/php53.rb
View gist:3888183
➜ ~ 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
View gist:2971258
~/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
View gist:2920185
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;
}
View gist:2775366
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
View gist:2383218
<?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"
You can’t perform that action at this time.