Skip to content

Instantly share code, notes, and snippets.

@opdavies
opdavies / st2-d7-project.json
Last active December 16, 2015 08:39
A default Drupal 7 project file for Sublime Text 2
{
"folders":
[
{
"path": "/",
"file_exclude_patterns":
[
"drupal/.gitignore",
"drupal/.htaccess",
"drupal/authorize.php",
@opdavies
opdavies / hook-form-alter-add-action-classes.php
Last active December 29, 2015 15:19
Add classes to form actions in Drupal 7
<?php
/**
* Implements hook_form_alter().
*/
function MYTHEME_form_alter(&$form) {
// Add additional classes to each form action.
if (isset($form['actions'])) {
$actions = element_children($form['actions']);
foreach ($actions as $action) {
@opdavies
opdavies / _classes.scss
Last active December 29, 2015 15:59
A library of custom classes to include within a SCSS project.
// Include this within your main "_init.scss" file using
// @import "classes";
// The opposite of Drupal's .js-hide class which hides an element when
// JavaScript is enabled (this hides an element when JavaScript is disabled).
// Add this to an element using the @extend directive. For example:
//
// .tabs {
// @extend %no-js-hide.
// }
@opdavies
opdavies / each-loops.scss
Created June 29, 2014 17:43
SASS each loops
@each $family in futura-book, futura-bold, futura-bold-italic, futura-italic {
@font-face {
font-family: #{$family};
src: url('../fonts/#{$family}/#{$family}.eot');
src: url('../fonts/#{$family}/#{$family}.eot?#iefix') format('embedded-opentype'),
url('../fonts/#{$family}/#{$family}.woff') format('woff'),
url('../fonts/#{$family}/#{$family}.ttf') format('truetype'),
url('../fonts/#{$family}/#{$family}.svg##{$family}') format('svg');
font-weight: normal;
font-style: normal;
@opdavies
opdavies / config.rb
Last active August 29, 2015 14:03
A base config.rb file, including sass-globbing, susy and breakpoint.
require "sass-globbing"
require "susy"
require "breakpoint"
http_path = "/"
css_dir = "css"
sass_dir = "sass"
images_dir = "images"
javascripts_dir = "js"
fonts_dir = "fonts"
jQuery(document).ready(function ($) {
"use strict";
if ($('#block-views-hero-slideshow-block').length > 0) {
$('#block-views-hero-slideshow-block .view-content ul').slick({
centerMode: true,
slide: 'li',
slidesToShow: 1
});
}
@mixin styled-select($width: 200px, $margin: 30px) {
overflow: hidden;
width: $width;
select {
@include appearance(none);
@include border-radius(0);
background: none;
border: none;
cursor: pointer;
@opdavies
opdavies / settings.common.php
Created November 26, 2014 19:16
A common settings file to include on all Drupal sites.
<?php
// Disable self-updates.
$conf['allow_authorize_operations'] = FALSE;
// Disable poormanscron.
$conf['cron_safe_threshold'] = 0;
@opdavies
opdavies / settings.local.php
Last active August 29, 2015 14:10
A base local settings file for Drupal sites.
<?php
$databases = array();
$base_url = '';
$conf['site_name'] = '';
// Display all messages.
// $conf['error_level'] = 2;
#!/bin/sh
SOURCE=~/path/to/source
TARGET=~/path/to/target
ENV=prod
REMOTE_NAME=origin
REMOTE_BRANCH=master
echo "Ensure that the target repository is up to date."
cd ${TARGET}