Skip to content

Instantly share code, notes, and snippets.

@grayside
grayside / menutrace.php
Created August 11, 2012 19:01
Menu Trace
#!/usr/bin/env drush
<?php
/**
* Menu Trace
*
* Drush snippet that traces the Drupal modules that define and modify a given menu
* route.
*
* @see menu_router_build(), drupal_alter().
*/
@grayside
grayside / Drush Warm.php
Last active December 10, 2015 01:09
Brainstorming a Drupal Drush Command to facilitate cache warming after site deployment. Rename to warm.drush.inc for actual use.
<?php
/**
* @file
* Command definition for Drush Cache Warm.
*/
/**
* Implements hook_drush_command().
*/
function warm_drush_command() {
@grayside
grayside / FindX.php
Created February 25, 2013 04:57
Simple Binary Search implementation to find an unbounded integer.
<?php
class FindX {
function __construct($x) {
$this->x = $x;
}
/**
@grayside
grayside / .bash_prompt
Created May 9, 2013 18:34
Terminal Prompt Snippet
##
# Copy this into your .bash_profile.
#
# It will show timestamp, working directory, and if available, your git branch.
#
# This snippet may evolve as I change my personal preferences, be sure to create your own canonical copy.
##
function prompt_command() {
local branch=`git rev-parse --abbrev-ref HEAD 2>/dev/null`
@grayside
grayside / grunt-bin.js
Created August 22, 2014 21:41
Expose all shellscripts in a bin/ directory suffixed .sh as grunt tasks
module.exports = function(grunt) {
/**
* Define "bin" wrapper tasks.
*/
var files = grunt.file.expand("bin/*.sh");
if (files) {
for (var f in files) {
var name = files[f].split('/').pop().split('.').shift();
grunt.config(['shell', name], {
{
"fundingDocumentURL": "http://reliefweb.int/updates?advanced-search=(C226.C122)_(F4)_!(S1242)_!(S1741)_!(S1255)_!(PC254)_!(S4304)#content",
"dataSources": [
{
"dataItemTitle": "Iraq Strategic Response Plan 2014-2015",
"dataSourceURL": "http://fts.unocha.org/reports/daily/OCHA_R32sum_A983.PDF",
"clusters": {
"type": "request",
"source": "fts",
"path": "v1/cluster/appeal/983.json",
{
"title": "Crisis Overview",
"dataSource": "Data Sources <cite><a href=\"http://reliefweb.int/sites/reliefweb.int/files/resources/2015_SRP_Syria_\" target=\"_top\">Syria IDPs</a>, <a href=\"http://reliefweb.int/report/iraq/fast-track-priorities-iraq-february-jun\" target=\"_top\">Iraq IDPs</a>, <a href=\"https://data.hdx.rwlabs.org/dataset/unhcr-refugee-pop-stats\" target=\"_top\">Syria Refugees - UNHCR via HDX</a>, <a href=\"http://www.unhcr.org/pages/49e486426.html#\" target=\"_top\">Iraq Refugees</a></cite>",
"map": {
"src": "http://crisis.rwdev.org/img/overview-map.jpg",
"alt": "Syria/Iraq"
},
"content": {
"syria": {
"title": "Syria",
{
"filters": [
{
"id": "situation-reports",
"title": "Situation reports by UN agencies",
"location": "http://reliefweb.int/updates?advanced-search=(C226.C122)_(F10)_(ST272)#content",
"data": {
"type": "request",
"source": "reliefweb",
"method": "POST",
{
"emptyImage": "http://crisis.rwdev.org/img/overview-map.jpg",
"items": {
"type": "request",
"source": "reliefweb",
"method": "POST",
"path": "v1/reports?limit=50&fields[include][0]=date&fields[include][1]=headline&fields[include][2]=primary_country&fields[include][3]=url",
"payload": {
"facets": [
{
@grayside
grayside / CONTRIBUTING.md
Created May 21, 2015 22:26
Default development practices & processes documentation to be included in new Drupal project repositories.

This extension to the README is necessary for all developers working on the {projectName} codebase.

Build Process

As described in the README, the many steps of assembling, installing, and managing the site have been combined into a few simple commands using Grunt Drupal Tasks.

You can see a list of all available actions by running grunt help.