Skip to content

Instantly share code, notes, and snippets.

@robballou
robballou / gist:5871098
Last active December 19, 2015 00:49
Use dpq() in Drupal to write the SQL query to a file.
<?php
$query = db_select('node', 'n');
$string = dpq($query, TRUE);
dd($string);
#!/usr/bin/env python
import argparse
import sh
import re
import os
def verbose(message, options={}):
"""Display a message if we are using verbose mode"""
if 'verbose' not in options or not options.verbose:
@robballou
robballou / sha.py
Last active December 28, 2015 10:39
Output hash for a string
#!/usr/bin/env python
"""
Output hash for a string
If not string is specified, then prompt for one (good for passwords). By default
the script will use SHA1, but you can specify any of the following:
--all (or -a)
--base64 (or -b)
@robballou
robballou / settings.php
Last active December 29, 2015 00:29
A basic Drupal dev site settings file.
<?php
/**
* @file
* Settings.
*/
$databases = array(
'default' => array(
'default' => array(
'database' => '',
@robballou
robballou / graph.js
Created December 20, 2013 16:22
Step 1: run our D3 script with node!
require('d3');
var xmldom = require('xmldom');
var dataset = {
apples: [53245, 28479, 19697, 24037, 40245],
};
var width = 460,
height = 300,
radius = Math.min(width, height) / 2;
@robballou
robballou / graph.js
Created December 20, 2013 16:27
Step 2: save the graph to a file
require('fs');
require('d3');
var xmldom = require('xmldom');
var dataset = {
apples: [53245, 28479, 19697, 24037, 40245],
};
var width = 460,
height = 300,
context switch my-project
context switch my-project
context git edit
context vagrant up
context vagrant ssh
context www