Skip to content

Instantly share code, notes, and snippets.

View leahtard's full-sized avatar

Leah Wagner leahtard

View GitHub Profile
@leahtard
leahtard / array-to-webhook.sh
Created January 17, 2020 20:14
Send array of values to webhook with bash
array=( 1 2 3 4 5 456 232131 232312 )
for i in "${array[@]}"
do
curl -v -H "Accept: application/json" \
-H "Content-type: application/json" \
-X POST \
-d '{"id":'${i}'}' \
https://hooks.zapier.com/hooks/catch/######/333333/
done
@leahtard
leahtard / node.twig.html
Last active June 9, 2022 18:32
Get file url in node for Drupal 8 twig template
{# Get URL of single file field #}
{{ node.field_file.entity.uri.value }}
{# Get URL of multi file field #}
{{ node.field_file['#items'].entity.uri.value }}
{# Trun into link #}
{{ file_url(node.field_file.entity.uri.value) }}
{# Check if there is at least one value #}
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. <a href="http://google.com">Donec nec mi quis</a> nibh elementum ornare et ut urna. Etiam nec dignissim quam, nec luctus tortor. Mauris in gravida ante, in euismod velit. Cras ac consequat metus. Aenean et sem eget ligula posuere maximus a a magna. Etiam viverra ullamcorper volutpat. Maecenas faucibus ultrices porta. Morbi pulvinar et dolor vitae volutpat.</p>
<h1>HEADING H2 font-size: XXem</h1>
<h2>HEADING H2 font-size: XXem</h2>
<h3>HEADING H3 font-size: XXem</h3>
<h4>HEADING H4 font-size: XXem</h4>
@leahtard
leahtard / chosen.scss
Last active May 11, 2016 21:09
Adaptation of chosen.scss (from chosen 1.5.1) for Drupal's Basic theme and Bourbon. Place this file in themes/basic/sass/components
@import "../config/config";
$chosen-sprite: image-url('../../images/optimized/chosen-sprite.png') !default;
$chosen-sprite-retina: image-url('../../images/optimized/chosen-sprite@2x.png') !default;
/* @group Base */
.chosen-container {
position: relative;
display: inline-block;
vertical-align: middle;
@leahtard
leahtard / hexagon-mixin.sass
Last active April 26, 2016 17:26
Sass hexagon mixin. Inspired by http://csshexagon.com/
@mixin hexagon($color: #333, $size: 200)
position: relative
width: $size + unquote("px")
height: $size * 0.577 + unquote("px")
background-color: $color
margin: $size * 0.288 + unquote("px") 0
&:before, &:after
content: ""
@leahtard
leahtard / field.tpl.php
Last active November 30, 2015 18:36
Simply markup output for Drupal 7 field with field.tpl.php
<?php
/**
* @file field.tpl.php
* Default template implementation to display the value of a field.
*
* This file is not used and is here as a starting point for customization only.
* @see theme_field()
*
* Available variables:
@leahtard
leahtard / HOOK_theme_suggestions_block_alter
Last active July 12, 2018 15:41
Create TWIG template suggestions for Drupal 8 custom block types. Enables block--custom-block-type.html.twig
function basic_theme_suggestions_block_alter(array &$suggestions, array $variables) {
$block = $variables['elements'];
$blockType = $block['#configuration']['provider'];
if ($blockType == "block_content") {
$bundle = $block['content']['#block_content']->bundle();
$suggestions[] = 'block__' . $bundle;
}
@leahtard
leahtard / thejibe_ckeditor_custom_config.js
Created May 20, 2015 15:36
Common config options for ckeditor.
/**
* @file thejibe_ckeditor_custom_config.js
* Includes custom js config - http://docs.ckeditor.com/#!/api/CKEDITOR.config
*/
CKEDITOR.editorConfig = function( config )
{
// Preserve class formatting.
config.allowedContent = true;
@leahtard
leahtard / field.html.twig
Created May 18, 2015 20:16
Simply markup output for Drupal 8 field with field.html.twig
{#
/**
* @file
* Theme override for a field.
*
* To override output, copy the "field.html.twig" from the templates directory
* to your theme's directory and customize it, just like customizing other
* Drupal templates such as page.html.twig or node.html.twig.
*
* Instead of overriding the theming for all fields, you can also just override