Skip to content

Instantly share code, notes, and snippets.

Avatar

Danny Englander danny-englander

View GitHub Profile
View gruntfile.js
module.exports = function (grunt) {
grunt.loadNpmTasks('grunt-cssbeautifier');
grunt.loadNpmTasks('grunt-strip-css-comments');
grunt.initConfig({
pkg: grunt.file.readJSON("package.json"),
// Define paths.
paths: {
sass: 'source/sass',
devCSS: 'css',
@danny-englander
danny-englander / SassMeister-input-HTML.html
Last active Aug 29, 2015
Generated by SassMeister.com.
View SassMeister-input-HTML.html
<div class="foo">
<p>Lorum Ipsum</p>
</div>
@danny-englander
danny-englander / drupal-sf-touch.js
Created Sep 13, 2012 — forked from dougalcampbell/drupal-sf-touch.js
Make Drupal Superfish dropdowns touch-friendly (for Drupal 7)
View drupal-sf-touch.js
// adapted from: http://snippets.webaware.com.au/snippets/make-css-drop-down-menus-work-on-touch-devices/
// forked from https://gist.github.com/3351233
(function ($) {
//add new drupal 7 code
Drupal.behaviors.touchdevice_dropdowns = {
attach:function (context, settings) {
//end drupal calls
@danny-englander
danny-englander / Custom.js
Created Oct 31, 2012
Unique Colorbox classes for better theming
View Custom.js
$(document).ready(function (){
// element-1 and element-2 are hrefs that trigger any given colorbox
$(".element-1").click(function() {
$('#colorbox').addClass("cb1").removeClass('cb2'); //add a custom class to #colorbox
});
$(".element-2").click(function() {
View magnific-popup-deep-linking.js
<script type="text/javascript">
function loadGalleryDeepLink()
{
var prefix = "#gallery-";
var h = location.hash;
if (document.g_magnific_hash_loaded === undefined && h.indexOf(prefix) === 0)
View local.settings.php
<?php
/**
* @file
* local.settings.php (Drupal 6.x)
*
* This settings file is intended to contain settings specific to a local
* development environment, by overriding options set in settings.php.
*
* Include this file from your regular settings.php by including this at the
* bottom:
@danny-englander
danny-englander / info-boilerplate.txt
Last active Dec 22, 2015
A Drupal boilerplate for updating Features when you are using Drush. These are examples of code you would add to your Feature's .info file. Once you add it, simply run drush --d fu my_feature and voila, all the magic happens.
View info-boilerplate.txt
;Content Type
features[node][] = event
;View
features[views_view][] = event_organizers
;User permission
features[user_permission][] = edit own event content
;Image style
View gist:6442459
<?php
function NAMEOFTHEME_preprocess_page(&$vars) {
// Use grouped import technique for more than 30 un-aggregated stylesheets (css limit fix for IE)
$css = drupal_add_css();
if (NAMEOFTHEME_css_count($css) > 26) {
$styles = '';
$suffix = "\n".'</style>'."\n";
foreach ($css as $media => $types) {
$prefix = '<style type="text/css" media="'. $media .'">'."\n";
View mp-history-deeplinking.js
function urlFromHash() {
if (location.hash.substr(0, 2) != '#!') {
return null;
}
// why not location.hash? => http://stackoverflow.com/q/4835784/298479
return location.href.split('#')[1].substr(1);
}
$('#gallery').magnificPopup({
type: 'image',
@danny-englander
danny-englander / gruntfile.js
Last active Mar 2, 2016
gruntfile.js for Jekyll and Sass
View gruntfile.js
// based on https://github.com/nicolashery/nicolashery.com
module.exports = function(grunt) {
// Load all NPM grunt tasks
require('matchdep').filterAll('grunt-*').forEach(grunt.loadNpmTasks);
// Project configuration
grunt.initConfig({
meta: {
scripts: [