Skip to content

Instantly share code, notes, and snippets.

View cal's full-sized avatar

Carl Johan Crafoord cal

View GitHub Profile
@cal
cal / dump.sh
Last active December 21, 2015 10:39
#!/bin/bash
credentials=''
database=''
TABLES=`mysql $credentials -B -N -e "select TABLE_NAME from information_schema.TABLES where TABLE_SCHEMA='$database'"`
for table in $TABLES; do
echo -n "dumping $database.$table... "
if [[ $table == cache* ]]; then
Vagrant::Config.run do |config|
# box
config.vm.box = "precise32"
config.vm.box_url = "http://files.vagrantup.com/precise32.box"
# ports
config.vm.forward_port 80, 8080
# puppet
config.vm.share_folder "puppet-files", "/etc/puppet/files", "puppet/files"
@cal
cal / gist:1640030
Created January 19, 2012 13:22
This is why you don't put content in code
global $language;
$original_path = drupal_lookup_path('source', 'your/source/language/path', 'en');
$translated_nodes = translation_path_get_translations($original_path);
$translated_node = $translated_nodes[$language->language] ? $translated_nodes[$language->language] : $original_path;
$translated_path = url($translated_node);