Skip to content

Instantly share code, notes, and snippets.

@lewisnyman
lewisnyman / lunch.js
Last active November 23, 2021 12:21
Random lunch status textexpander snippet
const emoji = [
  "🍔",
  "🍕",
  "🌭",
  "🥪",
  "🥗",
  "🌯",
  "🍱",
  "🍝",
  "🍜"
@lewisnyman
lewisnyman / .gitignore
Last active October 14, 2018 14:08
Node.js hello world
node_modules
@lewisnyman
lewisnyman / HelloWorld.template
Created February 10, 2017 12:21
React component template files
<div className="hello-world">
<p>Hello world!</p>
</div>
@lewisnyman
lewisnyman / field.html.twig
Last active December 21, 2016 14:49
minimal field.html.twig — Drupal 8
{% for item in items %}
{{ item.content }}
{% endfor %}
@lewisnyman
lewisnyman / widont.html
Created October 7, 2016 11:35
Prevent widows in Jekyll on Github pages
<!-- { Prevent widows without using a liquid filter } -->
{% assign split_title = page.title | split: ' ' %}
{% capture title %}
{% for word in split_title %}{% if forloop.last == true %}&nbsp;{{ word | strip }}{% else %} {{ word }}{% endif %}{% endfor %}
{% endcapture %}
@lewisnyman
lewisnyman / halifax-online.co.uk
Created January 2, 2016 11:23
Remove the advertising and noise from Halifax's new online banking design
@-moz-document domain("secure.halifax-online.co.uk") {
.mvt_content,
.layout-default .layout-side,
.m-672-dm-sticker,
.sp-505-d-newly-upgraded-user-header,
.sp-pat-m-hf-01-bank-bar .m-01-menu-bar,
.productPromo {
display: none;
}
.secondary {
@lewisnyman
lewisnyman / flexslider-init.js
Created November 9, 2015 13:37
A JS file to initialise flexslider.js in Drupal 8
(function ($, Drupal) {
'use strict';
/**
* Initialise the flexslider JS.
*/
Drupal.behaviors.felxsliderInit = {
attach: function (context, settings) {
var slider = $(context).find('.js-slider');
@lewisnyman
lewisnyman / example.twig
Created October 16, 2015 15:42
Loading Twig templates in Drupal 8
{# Load a template from the current active theme registry #}
{% include "table.html.twig" %}
{# Load a template relative to a module or theme's template directory #}
{% include "@module_or_theme/table.html.twig" %}
{# Load from the full path #}
{% include "themes/mytheme/table.html.twig" %}
@lewisnyman
lewisnyman / box.twig
Last active November 27, 2017 17:39
Patternab twig example patterns
<div class="box {{class}}">
<h2 class="box__title">{{title}}</h2>
<div class="box__content">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p>
</div>
<div class="box__actions">
{% include "atoms-button" with
{
"element": "a",
"text": "Find out more",
@lewisnyman
lewisnyman / gist:10c756cb6f7a204485ca
Created February 6, 2015 14:23
Current CSSlint output for all CSS files in Drupalcore
[15:23:30] Using gulpfile /Library/WebServer/Documents/drupalcore-frontend-toolkit/gulpfile.js
[15:23:30] Starting 'csslint'...
[15:23:30] Finished 'csslint' after 6.32 ms
[15:23:31] 4 errors found in /Library/WebServer/Documents/core/modules/block/css/block.admin.css
[15:23:31] [L46:C1] Don't use IDs in selectors. Selectors should not contain IDs. (ids)
[15:23:31] [L49:C1] Don't use IDs in selectors. Selectors should not contain IDs. (ids)
[15:23:31] [L52:C1] Don't use IDs in selectors. Selectors should not contain IDs. (ids)
[15:23:31] [L64:C5] Using width with padding-right can sometimes make elements larger than you expect. Don't use width or height when using padding or border. (box-model)
[15:23:31] 2 errors found in /Library/WebServer/Documents/core/modules/ckeditor/css/ckeditor-iframe.css
[15:23:31] [L21:C3] Property with star prefix found. Checks for the star property hack (targets IE6/7) (star-property-hack)