Skip to content

Instantly share code, notes, and snippets.

@woombo
woombo / jquery.touchstart.allow_second_click.js
Created June 5, 2014 07:27
Allow users on mobile devices to click through menu items, on menu item is touched a class is added assuring the next click will be allowed to perform its behaviour.
jQuery(document).ready(function($){
/**
* Allow users on mobile devices to click through menu items, on menu item is touched
* a class is added assuring the next click will be allowed to perform its behaviour.
*/
$('#menu-fsa-navigation li.menu-item-has-children > a').on({ 'touchstart' : function(e){
var $this = $(this),
next = $this.next('ul.sub-menu');
if (next.length) {
@woombo
woombo / drupal.sublime.conifg
Created June 19, 2014 03:44
Sublime, Drupal config.
{
"bold_folder_labels": true,
"caret_style": "wide",
"default_line_ending": "unix",
"ensure_newline_at_eof_on_save": true,
"fade_fold_buttons": false,
"fallback_encoding": "UTF-8",
"find_selected_text": true,
"font_options":
[
@woombo
woombo / gist:6eb7ea963360fb1ac298
Last active August 29, 2015 14:07
.bash_profile
# CUSTOMIZE BASH
export PS1='[\[\e[1;31m\]\u\[\e[0m\] - \[\e[32m\]\w\[\e[0m\]]$ '
export LS_COLORS='di=01;34'
# SUBLIME
alias sublime='open -a "Sublime Text 2"'
# MAMP + Drush
# -- https://www.drupal.org/node/954766
# export PATH="/usr/local/bin:$PATH"
@woombo
woombo / .gitignore
Created October 27, 2014 17:38
.gitignore
# IDEs
################################################################################
# workspace files are user-specific
*.sublime-workspace
# project files should be checked into the repository, unless a significant
# proportion of contributors will probably not be using SublimeText
# *.sublime-project
# PHPStorm
# SRC: http://mediadoneright.com/content/ultimate-git-ps1-bash-prompt
# Customize BASH PS1 prompt to show current GIT repository and branch.
# by Mike Stewart - http://MediaDoneRight.com
# SETUP CONSTANTS
# Bunch-o-predefined colors. Makes reading code easier than escape sequences.
# I don't remember where I found this. o_O
# Reset
Color_Off="\[\033[0m\]" # Text Reset
# bash/zsh git prompt support
#
# Copyright (C) 2006,2007 Shawn O. Pearce <spearce@spearce.org>
# Distributed under the GNU General Public License, version 2.0.
#
# This script allows you to see repository status in your prompt.
#
# To enable:
#
# 1) Copy this file to somewhere (e.g. ~/.git-prompt.sh).
/**
* Adds method arg to the Drupal object for grabbing url args
*
* @author Aaron Klump, In the Loft Studios, LLC
* @see http://www.intheloftstudios.com
* @see http://gist.github.com/3078482
*
* For use in a theme or module add the following to your .info file
* @code
* scripts[] = [path to js dir]/drupal.arg.js
@woombo
woombo / views_get_view_set_filter_or_argument
Last active December 8, 2015 18:41
views_get_view(): SET filter/argument
<?php
function function_name(){
// Load params.
$query_parameters = drupal_get_query_parameters();
// Load view.
$view = views_get_view('views_id');
$view->set_display('views_display_id');
// Load all exposed filters.
@woombo
woombo / mymodule.md
Last active September 21, 2016 17:15 — forked from juampynr/mymodule.md

This document contains a common database updates in Drupal 7 projects.

Change a field type from textarea to textfield (wipe out its data)

Let's suppose we want to change field_article_summary from text to textarea, but we do not care about loosing its current data.

Start by removing the field through the Admin Interface in your local environment. Then, add the field with the new configuration and recreate the feature where it was exported. Finally, add the following database update:

# http://www.millwoodonline.co.uk/blog/drupal-cron-failing-not-sure-why-heres-handy-drush-command
drush php-eval ' global $timers; $hook = 'cron'; $return = array(); foreach (module_implements($hook) as $module) { $function = $module . '_' . $hook; print($function ." - "); timer_start($function); $args = array(); $result = call_user_func_array($function, $args); if (isset($result) && is_array($result)) { $return = array_merge_recursive($return, $result); } else if (isset($result)) { $return[] = $result; } timer_stop($function); print($timers[$function]['time'] ."\r\n"); }'