Skip to content

Instantly share code, notes, and snippets.

View Version2beta's full-sized avatar

Rob Martin Version2beta

View GitHub Profile
@Version2beta
Version2beta / gist:6001107
Created July 15, 2013 15:58
Vagrant file and configuration cookbook for Vagrant + Chef, generating multiple unhappy errors
-> cat Vagrantfile
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
config.omnibus.chef_version = :latest
config.vm.box = "itvdev"
config.vm.network :private_network, ip: "10.42.42.2"
# config.vm.network :public_network
@Version2beta
Version2beta / gist:5986071
Created July 12, 2013 17:11
Problems with Vagrant 1.2.3 and Chef 11.4.4 on a Precise64-based box.
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
config.omnibus.chef_version = :latest
config.vm.box = "itvdev"
config.vm.network :private_network, ip: "10.42.42.2"
# config.vm.network :public_network
@Version2beta
Version2beta / gist:5040063
Created February 26, 2013 16:54
Bash script dies about a minute into the second sql file.
# execute 'DEBIAN_FRONTEND=noninteractive apt-get -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" dist-upgrade'
include_recipe "postgresql"
include_recipe "postgresql::server"
include_recipe "postgresql::ruby"
include_recipe "database"
databases_file = "pgdatabases.tar.bz"
cookbook_file "/var/lib/postgresql/#{databases_file}" do
source databases_file
@Version2beta
Version2beta / getIdTest.php
Created December 23, 2012 23:19
Testing an oddity in MODX Revolution's get('id') method.
<?php
// Get the children
error_log(print_r($modx->resource->get('id'), 1)); // prints 1
$children = $modx->resource->getMany('Children'); // returns children of 1
if ($children) {
// Parse children
$retVal = '<ul>';
foreach ($children as $child) {
$retVal .= '<li>Resource ' . $child->get('id') . ', child of resource ' . $child->get('parent') . '</li>';
@Version2beta
Version2beta / gist:3895882
Created October 15, 2012 22:05
A non-functional Tako route.
app.route('/')
.html(function (req, resp) {
db.get('home', function(err, body) {
if (err) return resp.error(err)
console.log(templates.home(body));
})
.pipe(templates.home())
.pipe(resp);
})
.methods('GET')