Skip to content

Instantly share code, notes, and snippets.

View mindmergedesign's full-sized avatar

Juan Giraldo mindmergedesign

View GitHub Profile
@mindmergedesign
mindmergedesign / time_class
Created June 15, 2013 22:42
Style your Drupal theme according to the time of the day by adding a "night" or "day" classes to the body.
/**
* Implements template_preprocess_html().
*/
function YOUR_THEME_preprocess_html(&$vars) {
// Day / night background theming.
$hour = date('G');
$theme = 'day';
if ($hour <= 6) {
$theme = 'night';
}
@mindmergedesign
mindmergedesign / gist:5896207
Created June 30, 2013 18:07
Using drush to generate Display Suite layout files. Execute this command from within your theme's "ds_layouts" folder, or move the generated folder into "ds_layouts" .
drush ds-build "Small Left Column" --regions="Left, Right" --css
//Try "drush help ds-build" for all options.
@mindmergedesign
mindmergedesign / Susy Bleed
Created July 9, 2013 04:24
Eric's Bleed Mixin
@mixin bleed($padding: $grid-padding, $sides: left right) {
@if $sides == 'all' {
margin: - $padding;
padding: $padding;
} @else {
@each $side in $sides {
margin-#{$side}: - $padding;
padding-#{$side}: $padding;
}
}
### Apache Rewrite
RewriteEngine on
# Force image styles that have local files that exist to be generated.
RewriteCond %{REQUEST_URI} ^/sites/([^\/]*)/files/styles/[^\/]*/public/((.*))$
RewriteCond %{DOCUMENT_ROOT}/sites/%1/files/%2 -f
RewriteRule ^(.*)$ $1 [QSA,L]
# Otherwise, send anything else that's in the files directory to the
# production server.
RewriteCond %{REQUEST_URI} ^/sites/[^\/]*/files/.*$
@mindmergedesign
mindmergedesign / st3_sync
Created February 14, 2014 18:33
Sync Sublime Text 3 Packages and Settings with Dropbox
####################
# FROM MAIN COMPUTER
####################
# Create the sync directory in Dropbox
$ mkdir ~/Dropbox/sublime-text-3
# Move your ST3 "Packages" and "Installed Packages" to Dropbox
$ cd ~/Library/Application\ Support/Sublime\ Text\ 3
$ mv Packages/ ~/Dropbox/sublime-text-3
$ mv Installed\ Packages/ ~/Dropbox/sublime-text-3
var gulp = require('gulp');
var minifycss = require('gulp-minify-css');
var autoprefixer = require('gulp-autoprefixer');
var notify = require('gulp-notify');
var sass = require('gulp-ruby-sass');
gulp.task('css', function() {
return gulp.src('sass/main.sass')
.pipe(sass({ style: 'compressed' }))
.pipe(autoprefixer('last 15 version'))
@mindmergedesign
mindmergedesign / laravel_create
Created February 21, 2014 03:39
Create a Laravel Project
composer create-project laravel/laravel your-project-name --prefer-dist
Redirect URLs with .htaccess
Here is a quick cheat-sheet for redirecting URLs with .htaccess.
Redirect a web page or directory
Redirect a specific page:
Redirect /old-resource.html http://example.com/path/to/new-resource.html
Redirect entire directory to new page:

This will enable Sass+Compass with LiveReload through Guard. (Guard screen cast)

You will also need a browser component to communicate with LiveReload. (browser extension, livereload.js)

If you prefer going through a GUI, that option is available. The following instructions is specific to Mac OS X and it works through the command line.

Note that this is not specific to Rails projects. This can work for any standalone front-end project.

Instructions

var gulp = require('gulp');
var minifycss = require('gulp-minify-css');
var autoprefixer = require('gulp-autoprefixer');
var notify = require('gulp-notify');
var sass = require('gulp-ruby-sass');
gulp.task('css', function() {
return gulp.src('sass/global.sass')
.pipe(sass({ style: 'compressed' }))
.pipe(autoprefixer('last 15 version'))