Skip to content

Instantly share code, notes, and snippets.

@JeffreyVdb
JeffreyVdb / postinstall.sh
Last active August 29, 2015 14:01 — forked from evansd/postinstall.sh
Vagrant post box virtual machine installation script
#!/bin/bash
# Setup a debian based vagrant machine
TO_CLEAN_PKGS=()
nullify_free_space() {
echo 'clearing free space'
dd if=/dev/zero of=/EMPTY bs=1M
rm -f /EMPTY
}
@JeffreyVdb
JeffreyVdb / 0_reuse_code.js
Created May 22, 2014 18:43
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
@JeffreyVdb
JeffreyVdb / visit_urls.pl
Last active August 29, 2015 14:01
Perl async url getter for refreshing drupal cronjob links
#!/usr/bin/env perl
use Modern::Perl;
use autodie;
use warnings;
use threads;
use Thread::Queue qw( );
use Getopt::Long;
require LWP::UserAgent;
use Benchmark;
@JeffreyVdb
JeffreyVdb / install_ruby.sh
Last active August 29, 2015 14:01
Ruby install from source
install_ruby() {
# install dependencies
apt-get -y install zlib1g-dev libssl-dev libc6-dev libncurses5-dev
# due to problems on openssl on debian based distributions, install the
# openssl package from tvm and point to this location using the configure
# flags
#
# install rvm
apt-get -y install curl
@JeffreyVdb
JeffreyVdb / optimizations.sh
Last active August 29, 2015 14:01
Vagrant lucid base box scripts
#!/bin/bash
# exit script if not run as root
if [[ $EUID -ne 0 ]]; then
cat <<END
you need to run this script as the root user' >&2
use :privileged => true in Vagrantfile
END
exit 1
@JeffreyVdb
JeffreyVdb / Directory tree
Last active August 29, 2015 14:02
manifest.json
locales
|-- admin
| |-- en-US.l20n
| `-- nl-NL.l20n
`-- manifest.json

Conventions:

Defining Eloquent model (will assume that DB table named is set as plural of class name and primary key named "id"):

class Shop extends Eloquent {}

Using custom table name

protected $table = 'my_shops';

#!/bin/bash
onRemote() {
vagrant ssh -c "cd /var/www; $*"
}
cd "$(git rev-parse --show-toplevel)/www"
vagrant up --provision
npm install
bower install
grunt clean && grunt all
#!/bin/bash
onRemote() {
vagrant ssh -c "cd /var/www; $*"
}
cd "$(git rev-parse --show-toplevel)/www"
vagrant up --provision
npm install
bower install
grunt all
@JeffreyVdb
JeffreyVdb / postClone.sh
Last active August 29, 2015 14:03
Vagrant utils
#!/bin/bash
onRemote() {
vagrant ssh -c "cd /var/www; $*"
}
cd "$(git rev-parse --show-toplevel)/www"
vagrant up --provision
npm install
bower install
grunt all