Skip to content

Instantly share code, notes, and snippets.

View danny-englander's full-sized avatar

Danny Englander (he/him) danny-englander

View GitHub Profile
@anthonyringoet
anthonyringoet / template.php
Created September 21, 2012 10:29
drupal - remove div.panel-separator crap
function theme_panels_default_style_render_region($vars) {
$output = '';
$output .= implode('', $vars['panes']);
return $output;
}
@angryobject
angryobject / template.php
Last active July 3, 2018 01:00
Drupal 7 menu extra classes
<?php
/**
* This snippet adds extra classes to Drupal
* menu leafs (li tags) and menu itself (ul tags).
*/
/**
* Since the standart preprocess function for menu tree, which is
* template_preprocess_menu_tree, located in includes/menu.inc,
@kevinquillen
kevinquillen / gist:4235124
Created December 7, 2012 18:02
Adding menu names to the ul menus in Drupal 7
function themename_menu_link(&$variables) {
$element = $variables['element'];
$sub_menu = '';
$element['#attributes']['data-menu-parent'] = $element['#original_link']['menu_name'] . '-' . $element['#original_link']['depth'];
if ($element['#below']) {
$sub_menu = drupal_render($element['#below']);
}
@jpetitcolas
jpetitcolas / even-odd-row.twig
Created January 8, 2013 06:29
How to differenciate odd and even rows with Twig?
<table>
{% for record in records %}
<tr class="record{% if loop.index is divisibleby(2) %}even{% else %}odd{% endif %}">
<td>{{ record.id }}</td>
<td>{{ record.title }}</td>
</tr>
{% endfor %}
</table>
@afryer
afryer / gruntfile.js
Created May 22, 2013 06:29
grunt boilerplate
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
compass: {
dev: {
options: {
@garystorey
garystorey / pxtorem.scss
Last active November 9, 2023 16:34
Sass to convert px to rem
/**
* Convert font-size from px to rem with px fallback
*
* @param $size - the value in pixel you want to convert
*
* e.g. p {@include fontSize(12px);}
*
*/
@use "sass:math";
@parkji
parkji / Gruntfile.js
Last active December 20, 2015 22:59
Grunt file for building and serving jekyll sites. Means you can just do grunt watch instead of running two Jekyll commands
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
shell: {
jekyllBuild: {
command: 'jekyll build'
},
jekyllServe: {
command: 'jekyll serve'
}
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',
@LordZardeck
LordZardeck / silder
Last active July 10, 2021 03:56
Allows videos within a flexslider to stop the slider when playing, and continue the slider when done.
$(function() {
var slider, // Global slider value to force playing and pausing by direct access of the slider control
canSlide = true; // Global switch to monitor video state
// Load the YouTube API. For some reason it's required to load it like this
var tag = document.createElement('script');
tag.src = "//www.youtube.com/iframe_api";
var firstScriptTag = document.getElementsByTagName('script')[0];
firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
@snrbrnjna
snrbrnjna / exclude_home.rb
Created November 29, 2013 20:24
To exclude some configurable posts from Jekyll's default pagination on index.html pages
module Jekyll
module Generators
class Pagination
# Monkey patch this method to exclude some cats and tags from all standard
# paginators
#
# For this to take effect, you have to define a ``exclude_home`` property in your _config.yml:
#
# exclude_home:
# categories: [notes]