Skip to content

Instantly share code, notes, and snippets.

View greylabel's full-sized avatar

Grant Gaudet greylabel

View GitHub Profile
@greylabel
greylabel / osx .gitignore
Last active September 28, 2015 17:38
.gitignore
.DS_Store
# Thumbnails
._*
ehthumbs.db
Thumbs.db
# Files that might appear on external disk
.Spotlight-V100
.Trashes
@greylabel
greylabel / viz.sh
Created March 27, 2012 20:09
Shell script to toggle visibility of .hidden in the Mac OS X Finder
#!/bin/sh
# based on: http://www.brooksandrus.com/blog/2007/03/23/mac-os-x-show-hide-hidden-files-in-finder/
# check if hidden files are visible and store result in a variable
isVisible="$(defaults read com.apple.finder AppleShowAllFiles)"
# toggle visibility based on variables value
if [ "$isVisible" = false ]
then
@greylabel
greylabel / service-links.scss
Created August 8, 2012 19:05
SASS mixin image replacement helper for a series of links
@greylabel
greylabel / dPerms.sh
Created August 17, 2012 18:31
Secure Drupal permission on OS X apache -- http://drupal.org/node/244924
#!/bin/bash
DRUPAL_PATH=${1%/}
DRUPAL_USER=${2}
APACHE_GROUP="_www"
HELP="\nHELP: This script is used to fix permissions of a drupal installation\nyou need to provide the following arguments:\n\t 1) path to your drupal installation\n\t 2) Username of the user that you want to give files/directories ownership\nNote: \"_www\" (apache default) is assumed as the group the server is belonging to, if this is different you need to modify it manually by editing this script\n\nUsage: (sudo) bash ${0##*/} drupal_path user_name\n"
if [ -z "${DRUPAL_PATH}" ] || [ ! -d "${DRUPAL_PATH}/sites" ] || [ ! -f "${DRUPAL_PATH}/modules/system/system.module" ]; then
echo "Please provide a valid drupal path"
echo -e $HELP
@greylabel
greylabel / thumbnail-grid-lists.scss
Created September 11, 2012 21:39
SASS thumbnail-grid lists
/**
* @mixin thumbnail-grid($thumbnail-grid-columns, $thumbnail-grid-item-width, $thumbnail-grid-item-height, $thumbnail-grid-item-hspace, $thumbnail-grid-item-vspace)
*
* Apply to a <ul> to style children <li> elements as a thumbnail grid
*
* @param: $thumbnail-grid-columns
* number of columns for the thumbnail grid
* @param: $thumbnail-grid-item-width
* with of <li> element
* @param: $thumbnail-grid-item-height
@greylabel
greylabel / thumbnail-grid.scss
Created September 11, 2012 21:43
SASS thumbnail-grid
/**
* @mixin thumbnail-grid($thumbnail-grid-columns, $thumbnail-grid-item-width, $thumbnail-grid-item-height, $thumbnail-grid-item-hspace, $thumbnail-grid-item-vspace)
*
* Apply to a selector to its style children elements as a thumbnail grid
*
* @param: $thumbnail-grid-columns
* number of columns for the thumbnail grid
* @param: $thumbnail-grid-item-width
* with of each grid element
* @param: $thumbnail-grid-item-height
@greylabel
greylabel / retina-sprites.scss
Created October 15, 2012 18:23
retina-sprites.scss
#site-name {
a {
@include hide-text();
@include inline-block();
@include sprites-sprite(logo);
background-size: sprites-sprite-width(logo) sprites-sprite-height(logo);
height: sprites-sprite-height(logo);
width: sprites-sprite-width(logo);
}
}
@greylabel
greylabel / views_arg_related_refs.php
Last active December 12, 2015 03:38
Views default argument handler to show content that references the same noderef nids that this content references
@greylabel
greylabel / get_attr_value.php
Created February 25, 2013 23:41
regex to get html tag attribute value
<?php
/**
* regex to get html tag attribute value
*/
function get_attribute_value($attrib, $tag){
//get attribute from html tag
$re = '/' . preg_quote($attrib) . '=([\'"])?((?(1).+?|[^\s>]+))(?(1)\1)/is';
if (preg_match($re, $tag, $match)) {
return urldecode($match[2]);
@greylabel
greylabel / height-lineheight.scss
Created October 16, 2013 15:10
height-lineheight.scss
/**
* @mixin height-lineheight($height)
*
* Allows single-line vertical centering of text
*
* @param: $height
* height of element, text will centern vertically within
*/
@mixin height-lineheight($height){
height: $height;