Skip to content

Instantly share code, notes, and snippets.

Here's how I installed VirtualBox, Vagrant, and Vagrant-Salt on my Ubunut 12.10 Desktop machine ...

cd ~/tmp/vbox-vagrant-salt-test

wget http://download.virtualbox.org/virtualbox/4.2.10/virtualbox-4.2_4.2.10-84104~Ubuntu~quantal_amd64.deb
sudo dpkg -i virtualbox*.deb

wget http://files.vagrantup.com/packages/476b19a9e5f499b5d0b9d4aba5c0b16ebe434311/vagrant_x86_64.deb
sudo dpkg -i vagrant_x86_64.deb
@jehoshua02
jehoshua02 / init.sls
Created March 30, 2013 05:50
Using salt to install apache, php5, mysql, etc
base:
pkg.installed:
- pkgs:
- debconf-utils
- rsync
- cronolog
- sudo
- vsftpd
- imagemagick
- libgd-tools
@jehoshua02
jehoshua02 / info.md
Created March 30, 2013 21:15
Installing php5 on Debian Squeeze via Salt

Here's some relevant output:

[INFO    ] Executing command 'apt-get -q -y -o DPkg::Options::=--force-confold -o DPkg::Options::=--force-confdef   install php5 php5-mysql php5-cli php5-dev libapache2-mod-php5 php5-mysql php5-gd php5-curl php-pear php5-memcache' in directory '/root'
... lines omitted ...
[DEBUG   ] stderr: 
Creating config file /etc/php5/apache2/php.ini with new version

Creating config file /etc/php5/cli/php.ini with new version
@jehoshua02
jehoshua02 / weirdness.php
Last active December 15, 2015 16:38
PHP script to determine if Josh or MIke is weirder.
<?php
$mike = new Person(array(
'name' => 'Mike',
'weirdness' => −999990,
));
$josh = new Person(array(
'name' => 'Josh',
'weirdness' => $mike->weirdness() + 1000000,
<?php
// instantiate pdo
$pdo = new PDO("mysql:host=localhost;dbname=test", 'root', 'root');
$pdo->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_ASSOC);
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
// create trigger
$sql = <<<SQL
DROP TRIGGER IF EXISTS table1InsertTrigger;
@jehoshua02
jehoshua02 / Config.php
Created April 9, 2013 22:09
Simple config class. Has a simple yet powerful way of handling nested configurations in files and arrays.
<?php
/**
* Config
*
* Simple class for accessing config values
*/
class Config
{
/**
@jehoshua02
jehoshua02 / Registry.php
Last active December 16, 2015 00:48
Simple registry. Static class so it can be autoloaded and accessed very easily.
<?php
/**
* Registry
*
* Simple class for accessing shared values
*/
class Registry
{
/**
@jehoshua02
jehoshua02 / function_poop.php
Last active December 16, 2015 06:19
For those days when you feel like pooping all over your PHP code :D Simply include, `poop($value)`, then look in your Firebug console.
<?php
function poop($value)
{
echo sprintf('<script type="text/javascript">console.log(%s)</script>', json_encode($value));
}

Shell Script

Using curl:

curl -sS https://gist.github.com/jehoshua02/5580345/raw/a011696ce1005d30fbf8ce8ce77faf274f3fb319/install_phpunit_3.5.sh | sudo sh

Using wget:

<div id="child">Hello!</div>