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
@Phlow
Phlow / for-loop-sorted-collection
Last active December 8, 2023 07:28
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 %}
@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";
@franxo
franxo / .lando.yml
Created June 9, 2023 08:10
Lando file for angular app + storybook
#Lando file for angular app + storybook
name: angular-app
excludes:
- ./node_modules
proxy:
front:
- angular-app.lndo.site:4200
- storybook-app.lndo.site:6006
services:
front:
@krisrobinson
krisrobinson / custom.theme.php
Last active December 7, 2022 12:27
Drupal 8 check paragraph bundles and print out view modes in node.hml.twig
<?php
use Drupal\paragraphs\Entity\Paragraph;
/**
* Implements template_preprocess_node
*
* Add variables for paragraphs available to node templates
*/
function CUSTOM_preprocess_node(&$variables) {
// Convenience Variables
@leymannx
leymannx / gulpfile.js
Last active December 7, 2022 10:57
Gulp 4 Sass BrowserSync Kickstart Example
// Requires Gulp v4.
// $ npm uninstall --global gulp gulp-cli
// $ rm /usr/local/share/man/man1/gulp.1
// $ npm install --global gulp-cli
// $ npm install
const { src, dest, watch, series, parallel } = require('gulp');
const browsersync = require('browser-sync').create();
const sass = require('gulp-sass');
const autoprefixer = require('gulp-autoprefixer');
const sourcemaps = require('gulp-sourcemaps');
@vkechagias
vkechagias / hook.theme.php
Created October 21, 2019 12:32
Drupal 8 get page title from route and set this to page_title block
function HOOK_preprocess_block__page_title_block(&$variables) {
$request = \Drupal::request();
$route_match = \Drupal::routeMatch();
$page_title = \Drupal::service('title_resolver')->getTitle($request, $route_match->getRouteObject());
if (!empty($page_title) && empty($variables['content']['#title'])) {
$variables['content']['#title'] = $page_title;
}
}
@froboy
froboy / nucular-option.sh
Last active May 19, 2022 19:15
Sometimes composer (in your Drupal 8 environment) gets grupmy... when that happens, it's time to go nucular.
######
# This script intentionally deletes a lot of things that could be important!!!!!
# Please be sure you have a backup before you go nucular!!!!!
#####
# Depending on where your web root is...
rm -rf vendor/ && rm -rf web/core && rm -rf web/modules/contrib/ && rm -rf composer.lock
# or
rm -rf vendor/ && rm -rf docroot/core && rm -rf docroot/modules/contrib/ && rm -rf composer.lock
@illepic
illepic / particle-deps.sh
Last active May 18, 2022 21:50
Particle from scratch with all dependencies
#!/usr/bin/env bash
# 1. Skip steps if you already have the tools listed
# 2. Run source ~/.bashrc or source ~/.zshrc after each step to ensure command is registered
# Install Homebrew, if not installed
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
# Update Homebrew installed packages
brew update && brew upgrade
@aarongustafson
aarongustafson / responsive-iframes.css
Created October 25, 2011 17:07
Responsive iFrames with jQuery
iframe {
max-width: 100%;
}
@wwwebman
wwwebman / add-remove-input-class.js
Created May 27, 2017 08:18
Add/Remove class when on input Focus/Blur with Pure JS
var IputEffect = function(){
var placeholderPosition, appendInputWhenSelect, actions;
actions = {
activate: function(el) {
el.parentNode.parentNode.addClass('active');
},
deactivate: function(el) {
if (el.value === '') el.parentNode.parentNode.removeClass('active');