Skip to content

Instantly share code, notes, and snippets.

View gabesullice's full-sized avatar

Gabe Sullice gabesullice

View GitHub Profile
/**
* Implements hook_menu_alter()
*
* Swaps out default taxonomy page callback to use a custom callback.
*
* @param $items
*
* @see og_vocab_grid_taxonomy_term_page().
*/
function og_vocab_grid_menu_alter(&$items) {
@gabesullice
gabesullice / exclude_paths
Created May 28, 2014 16:36
Drupal Common Exclude Paths
// This is a list of common Drupal paths you may want to exclude.
// I often use these when I'm placing a block "globally"
admin
admin/*
batch
node/add*
node/*/*
user/*/*
docCookies: {
getItem: function (sKey) {
return decodeURIComponent(document.cookie.replace(new RegExp("(?:(?:^|.*;)\\s*" + encodeURIComponent(sKey).replace(/[\-\.\+\*]/g, "\\$&") + "\\s*\\=\\s*([^;]*).*$)|^.*$"), "$1")) || null;
},
setItem: function (sKey, sValue, vEnd, sPath, sDomain, bSecure) {
if (!sKey || /^(?:expires|max\-age|path|domain|secure)$/i.test(sKey)) {
return false;
}
var sExpires = "";
if (vEnd) {

test

@mixin header($size) {
font-size: $size;
line-height: $size;
@include breakpoint($small) { font-size: 1.125 * $size; }
}
$header-sizes: $h1-font-size,
$h2-font-size,
$h3-font-size,
$h4-font-size,
type Clock struct {
h, m int
}
func (c *Clock) set(h, m int) {
var dh int
dh, c.m = c.decompose(m, 60)
_, c.h = c.decompose(h+dh, 24)
}
<?php
foo(){
return function(){
// work.
}
}
bar((function) f){
return function(){
@gabesullice
gabesullice / insert function
Created November 26, 2014 22:07
Insert function
<?php
function my_array_insert(&$array, $insert, $key_before) {
$offset = 1;
while (key($array) != $key_before) {
next($array);
$offset++;
}
$array_before = array_slice($array, 0, $offset, TRUE);
$array_after = array_slice($array, $offset, NULL, TRUE);
@gabesullice
gabesullice / sunrst.sh
Last active August 29, 2015 14:10
Sunpower Reset Function
sunrst () {
if [[ $# < 2 ]]; then
echo "You must specify at least an alias and a multisite directory name."
fi
read -p "Would you like to run updates (y/n)? " UPDB
alias=$1
site=$2
@gabesullice
gabesullice / siterst.sh
Created December 22, 2014 21:48
Drupal Site Reset
#!/bin/bash
sitereset () {
if [[ $# < 2 ]]; then
echo "You must specify at least an alias and a multisite directory name."
return
fi
read -p "Would you like to run updates (y/n)? " updb
alias=$1
site=$2