Skip to content

Instantly share code, notes, and snippets.

Avatar

Oliver Davies opdavies

View GitHub Profile
@opdavies
opdavies / st2-d7-project.json
Last active Dec 16, 2015
A default Drupal 7 project file for Sublime Text 2
View st2-d7-project.json
{
"folders":
[
{
"path": "/",
"file_exclude_patterns":
[
"drupal/.gitignore",
"drupal/.htaccess",
"drupal/authorize.php",
@opdavies
opdavies / hook-form-alter-add-action-classes.php
Last active Dec 29, 2015
Add classes to form actions in Drupal 7
View hook-form-alter-add-action-classes.php
<?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 Dec 29, 2015
A library of custom classes to include within a SCSS project.
View _classes.scss
// 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.
// }
View each-loops.scss
@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 Aug 29, 2015
A base config.rb file, including sass-globbing, susy and breakpoint.
View config.rb
require "sass-globbing"
require "susy"
require "breakpoint"
http_path = "/"
css_dir = "css"
sass_dir = "sass"
images_dir = "images"
javascripts_dir = "js"
fonts_dir = "fonts"
View slick-centermode.js
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
});
}
View _mixins.scss
@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 Nov 26, 2014
A common settings file to include on all Drupal sites.
View settings.common.php
<?php
// Disable self-updates.
$conf['allow_authorize_operations'] = FALSE;
// Disable poormanscron.
$conf['cron_safe_threshold'] = 0;
@opdavies
opdavies / settings.local.php
Last active Aug 29, 2015
A base local settings file for Drupal sites.
View settings.local.php
<?php
$databases = array();
$base_url = '';
$conf['site_name'] = '';
// Display all messages.
// $conf['error_level'] = 2;
View sculpin-deploy.sh
#!/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}