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
@laurentsab
laurentsab / twig_merge_attributes
Created January 20, 2016 09:02
Twig merge attributes
// parent_template.html.twig
{% include "AppBundle:fields:input_text.html.twig" with {
'form_id': form_id,
'field_name': 'Numéro',
'required': true,
'attr': {
'data-minlength': '\\d{7}',
'minlength': '7',
'maxlength': '7',
'data-error': 'e0.message_error'|trans()
@c-vetter
c-vetter / gulp-watch-ng-annotate-lazypipe-fix.js
Created December 14, 2015 13:06
Using gulp-ng-annotate with lazypipe inside gulp-watch without triggering tasks still crashes even with plumber. This setup results in a continuous pipe setup resilient against syntax errors with very little overhead.
var gulp = require('gulp')
var gulpIf = require('gulp-if')
var gulpNgAnnotate = require('gulp-ng-annotate')
var gulpPlumber = require('gulp-plumber')
var gulpWatch = require('gulp-watch')
var lazypipe = require('lazypipe')
var processPipe
gulp.task('watch-annotate', watch)
@zellwk
zellwk / gulpfile.js
Last active February 3, 2019 21:57
Gulpfile-development-phase
var gulp = require('gulp');
var sass = require('gulp-sass');
var plumber = require('gulp-plumber');
var notify = require('gulp-notify');
var browserSync = require('browser-sync');
var autoprefixer = require('gulp-autoprefixer');
var sourcemaps = require('gulp-sourcemaps');
var spritesmith = require('gulp.spritesmith');
var gulpIf = require('gulp-if');
var nunjucksRender = require('gulp-nunjucks-render');
@Phlow
Phlow / for-loop-sorted-collection
Last active April 30, 2024 13:30
This Liquid loop for Jekyll sorts a collection by date in reverse order
{% comment %}
*
* This loop loops through a collection called `collection_name`
* and sorts it by the front matter variable `date` and than filters
* the collection with `reverse` in reverse order
*
* To make it work you first have to assign the data to a new string
* called `sorted`.
*
{% endcomment %}
@aFarkas
aFarkas / focus-within.js
Last active August 20, 2020 10:49
simple focus-within polyfill
(function(window, document){
'use strict';
var slice = [].slice;
var removeClass = function(elem){
elem.classList.remove('focus-within');
};
var update = (function(){
var running, last;
var action = function(){
var element = document.activeElement;
@petebrowne
petebrowne / bem.scss
Created March 5, 2015 17:35
BEM Mixins
// BEM mixins for laying out modules.
// Based on:
//
// https://medium.com/@marcmintel/pushing-bem-to-the-next-level-with-sass-3-4-5239d2371321
$element-separator: '__' !default;
$modifier-separator: '--' !default;
// Creates a "block" in a BEM module.
//
@jibran
jibran / terms_from_term.inc
Last active August 29, 2015 14:15
Plugin to provide an relationship handler for all terms from term. plugins/relationships/terms_from_term.inc
<?php
/**
* @file
* Plugin to provide an relationship handler for all terms from term.
*/
/**
* Plugins are described by creating a $plugin array which will be used
* by the system that includes this file.
@AllThingsSmitty
AllThingsSmitty / accessible-menu.css
Last active October 1, 2021 14:42
Accessible dropdown menu
/* Top level nav */
.nav {
float: left;
margin: 20px 0;
}
/* Dropdowns */
.nav ul {
position: absolute;
top: 2.5em;
@daraskolnick
daraskolnick / gulpfile.js
Last active March 13, 2016 17:00
Current gulpfile.js
// Include gulp
var gulp = require('gulp');
// Include plugins
var jshint = require('gulp-jshint'),
plumber = require('gulp-plumber'),
sass = require('gulp-sass'),
spritesmith = require('gulp.spritesmith'),
resize = require('gulp-image-resize'),
uglify = require('gulp-uglify'),
@Evanion
Evanion / grid-push-pull.less
Last active October 26, 2021 08:57
Responsive push/pull for uikit
/* Small */
@media (max-width: @breakpoint-small-max) {
[class*='uk-push-small-'],
[class*='uk-pull-small-'] { position: relative; }
/*
* Push
*/