Skip to content

Instantly share code, notes, and snippets.

@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.
/**
* 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
# bash/zsh git prompt support
#
# Copyright (C) 2006,2007 Shawn O. Pearce <[email protected]>
# 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).
# 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
@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
@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 / 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 / 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) {