Skip to content

Instantly share code, notes, and snippets.

@tsi
tsi / equalHeights.js
Created May 30, 2012 13:10
equalHeights
(function($) {
// equalHeights - compare two or more elements and animate them all to the
// same (min-)height.
// You'll need jQuery for this to work.
$.fn.equalHeight = function() {
var heights = [];
var height;
$(this).each(function() {
// Cache the current height.
@tsi
tsi / mail_themer.php
Created June 20, 2012 13:07
HTML Mail Themer [Drupal 7]
<?php
/**
* Implements hook_mail_alter()
* Send mails to a file for easy debugging
*/
function mail_themer_mail_alter(&$message) {
$debug_dir = file_directory_temp() . '/mail_debug';
$debug_file = $debug_dir . '/mail_debug.html';
@tsi
tsi / newsite
Last active May 27, 2018 09:39
Bash script to create virtual hosts and prepare your drupal directory.
#!/bin/bash
# This script creates virtual hosts and prepares your mysql DB and drupal directory.
# you should put it under /usr/local/bin/
# and run it with sudo newsite
# Set the path to your localhost
www=/var/www
echo "Enter directory name under $www"
read sn
@tsi
tsi / dabblet.css
Created August 11, 2012 11:59 — forked from anonymous/dabblet.css
Media queries and @import rules
/**
* Media queries and @import rules
*/
@import "http://twitter.github.com/bootstrap/assets/css/bootstrap.css";
@tsi
tsi / fileWatcher.js
Last active October 8, 2015 14:58
Improved file watcher
/**
* This script will watch files for changes and
* automatically refresh the browser when a file is modified.
*
* Usage:
*
* - Include it:
* <script src="/js/fileWatcher.js"></script>
*
* - Call it from your script (or un-comment the call below):
@tsi
tsi / dabblet.css
Created August 15, 2012 07:39 — forked from anonymous/dabblet.css
CSS flipping tools
/**
* CSS flipping tools
*/
/* Original code */
.class {
padding: 1px 2px 3px 4px;
margin-right: 3em;
background: url(image.gif) no-repeat right center;
margin-bottom: 20px;
@tsi
tsi / dabblet.css
Created August 15, 2012 08:38
CSS flipping inheritance
/**
* CSS flipping inheritance
*/
/* Original code */
.class {
margin-left: 3em; /* Will be flipped */
margin-right: 2em; /* Will be flipped */
padding-left: 1em; /* Will be flipped and reseted */
}
@tsi
tsi / _inline-block.scss
Last active October 8, 2015 18:17
Inline block with ie7 support
/*
* ##### Sasson - advanced drupal theming. #####
*
* SASS mixins
* http://sass-lang.com/docs/yardoc/file.SASS_REFERENCE.html#mixins
*
*/
// Inline block with ie7 support
@mixin inline-block($alignment: false, $ie7-support: false) {
@tsi
tsi / salsa-demo.scss
Created October 2, 2012 17:48
salsa-demo.scss
@import "compass/css3";
@import "salsa/salsa";
// container grids
.container {
text-align: center;
.element {
@include border-radius(12px);
@include box-shadow(0 0 40px rgba(0,0,0,.3) inset);
@include transition(margin .5s);
@tsi
tsi / template.php
Created October 17, 2012 19:20
Add role based calsses to <body>
function THEME_preprocess_html(&$vars) {
if ($vars['user']) {
foreach($vars['user']->roles as $key => $role){
$vars['classes_array'][] = 'role-' . drupal_html_class($role);
}
}
}