Skip to content

Instantly share code, notes, and snippets.

@ifnull
ifnull / gist:4342241
Created December 20, 2012 01:17
Make bootable from ISO
# Convert iso to img
hdiutil convert -format UDRW -o crucial-c400.040H.04.00.img crucial-c400.040H.04.00.iso
# Get the disk id
diskutil list
# Copy files to drive
dd if=./crucial-c400.040H.04.00.img.dmg of=/dev/rdisk2
@ifnull
ifnull / gist:4342345
Created December 20, 2012 01:49
Drupal files permission fix
#!/bin/bash
if [ $(id -u) != 0 ]; then
echo "This script must be run as root."
exit 1
fi
drupal_path=${1%/}
drupal_user=${2}
httpd_group="${3:-www-data}"
@ifnull
ifnull / gist:4570012
Last active December 11, 2015 07:58
List running virtual boxes to shutdown busted vagrant boxes
VBoxManage list runningvms
VBoxManage controlvm {foobar} poweroff
@ifnull
ifnull / gist:4576872
Last active December 11, 2015 08:58
Drupal GMaps
// Get IDs
gmap_tool = jQuery('#tools .view-partners-map .gmap').attr('id').split('-')[1]
gmap_home = jQuery('#page-content .view-partners-map .gmap').attr('id').split('-')[1]
// Resize fix
google.maps.event.trigger(Drupal.gmap.getMap('auto2map').map, "resize")
// Add map styles
Drupal.gmap.getMap('auto2map').map.setOptions({styles: styles});
@ifnull
ifnull / gist:4576905
Created January 20, 2013 06:02
Make the enter key work with Drupal login
Drupal.behaviors.loginAJAXSubmit = {
attach: function (context, settings) {
var ajax = Drupal.ajax[$('#tab-login .form-submit').attr('id')];
if(typeof ajax != 'undefined'){
$('input',ajax.element_settings.element.parentElement.parentElement).bind("keypress", function (e) {
var code = (e.keyCode ? e.keyCode : e.which);
if(code == 13) { //Enter keycode
$(ajax.element_settings.element).trigger(ajax.element_settings.event);
}
});
@ifnull
ifnull / gist:4582766
Created January 21, 2013 00:18
Drupal Google Maps
// GMap Functional Overrides
if(Drupal.gmap !== undefined) {
// Set boot options
Drupal.gmap.addHandler('gmap', function (elem) {
var obj = this;
obj.bind("boot", function () {
obj.map.setOptions({
styles: styles,
mapTypeControl: false,
scrollwheel: false
@ifnull
ifnull / gist:4641308
Created January 26, 2013 09:28
Show file changes in Git
git log -p ./filename.js
@ifnull
ifnull / gist:4641325
Created January 26, 2013 09:30
Show file changes in Git
git log --name-status
@ifnull
ifnull / gist:4679602
Last active December 11, 2015 23:49
Drupal: Get English path from translated page.
var BLITZ_englishPath,
BLITZ_languageFormInputs = document.getElementById('lang-dropdown-form').firstChild.children;
for (var i = 0; i < BLITZ_languageFormInputs.length; i++) {
if(BLITZ_languageFormInputs[i].name === 'en'){
BLITZ_englishPath = BLITZ_languageFormInputs[i].value;
break;
}
}
@ifnull
ifnull / gist:4752499
Last active December 12, 2015 09:38
Fix user folder permissions
shopt -s dotglob
sudo chmod -R -v -N ~/
sudo chown -R -v $(whoami):staff ~/
sudo chmod -R -v 700 ~/
sudo chmod -v 755 ~/