Skip to content

Instantly share code, notes, and snippets.

@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], {
@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 / 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 / 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 / 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().
*/