Skip to content

Instantly share code, notes, and snippets.

View hascoulijn's full-sized avatar
:octocat:
Not contributing

Hasco Ulijn hascoulijn

:octocat:
Not contributing
View GitHub Profile
@hascoulijn
hascoulijn / example.twig
Created September 1, 2020 07:13
Entry URI Format With Parent Section Handle
{parent.uri ?? section.handle}/{slug}
@hascoulijn
hascoulijn / main.dart
Last active September 3, 2020 07:51
Remove the Flutter debug banner from iOS Simulator and Android emulators
MaterialApp(
// Disable the debug mode banner in emulation and simulation devices.
debugShowCheckedModeBanner: false
)
@hascoulijn
hascoulijn / gulpfile.js
Created August 4, 2020 10:25
Default Gulp 4 JavaScript document
'use strict';
const { src, dest, watch, series, parallel } = require('gulp'),
autoprefix = require('gulp-autoprefixer'),
compress = require('gulp-clean-css'),
concat = require('gulp-concat'),
rev = require('gulp-rev'),
del = require('delete');
const gulpCleanCss = require('gulp-clean-css');
@hascoulijn
hascoulijn / date.twig
Created July 27, 2020 14:48
Date Macro
{#
# Calculates the difference between an entry's post date and now and displays
# the difference in a readable date format.
#}
{% macro postdate(date) %}
{% set hourago = now.modify('- 1 hour') %}
{% set elapsed = '' %}
{% if not (date < hourago) %}
{% set elapsed = date.diff(now)|duration|split('and')|first ~ ' ago' %}
{% else %}
@hascoulijn
hascoulijn / validate.js
Last active August 4, 2020 11:36
Validate email address JavaScript function.
/**
* Validates the passed argument against a regular expression according to
* RFC 2822 (https://tools.ietf.org/html/rfc2822#section-3.4.1).
*
* @param {String} email - The string to be tested.
* @return {Boolean} - Returns true or false.
*/
function validate(arg) {
var pattern = regex;
return pattern.test(arg);
@hascoulijn
hascoulijn / custom-ordered-lists.css
Last active September 3, 2020 08:02
Custom incrementing counter for ordered lists and sublists
/**
* A way to number sections and subsections on ordered lists
*/
ol {
counter-reset: section;
}
/**
* Disable the default list style type behavior,
@hascoulijn
hascoulijn / index.html
Created May 31, 2017 14:35
Common Prefetch Links
<!-- Google CDN -->
<link rel="dns-prefetch" href="//ajax.googleapis.com">
<!-- Google Analytics -->
<link rel="dns-prefetch" href="//www.google-analytics.com">
<!-- Google Fonts -->
<link rel="dns-prefetch" href="//fonts.googleapis.com">
<!-- Bootstrap CFN (FontAwesome) -->