Skip to content

Instantly share code, notes, and snippets.

coding away

Jérôme Coupé jeromecoupe

coding away
View GitHub Profile
jeromecoupe / package.json
Created Dec 2, 2020
Minimal NPM script Sass
View package.json
"name": "sass-npm-scripts",
"version": "1.0.0",
"author": "Jérôme Coupé",
"description": "Minimal Sass NPM scripts",
"main": "index.js",
"scripts": {
"build:styles": "sass --style=compressed src/scss/:dist/css/",
"watch:styles": "onchange src/scss/**/*.scss -- npm run build:styles",
"watch": "npm-run-all --parallel watch:**",
jeromecoupe / deploy.yaml
Last active Mar 5, 2021
Github actions: build and deploy Craft sites (WIP)
View deploy.yaml
name: Craft CMS deployments
branches: [master]
runs-on: ubuntu-latest
jeromecoupe / getnews.twig
Last active Nov 2, 2020
Probably not a good idea: normalize array of objects in Craft
View getnews.twig
{# variables #}
{% set allNews = [] %}
{% set today = "now"|date("Y-m-d") %}
{# create custom allNews array of objects #}
{% set news = craft.entries()
jeromecoupe / cases.js
Last active Nov 18, 2019
Sort post by categories with 11ty data files
View cases.js
const cases = [
id: "123456",
title: "This is a case red blue",
categories: [
{ id: "1", slug: "red" },
{ id: "2", slug: "blue" }
View hamburger.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
jeromecoupe / bitbucket-pipelines.yml
Last active Aug 2, 2019
Minimal Bitbucket Pipelines
View bitbucket-pipelines.yml
# Only use spaces to indent your .yml configuration.
# $SSH_USER $ROOT_PATH $SSH_IP:$SSH_PATH are environment variables
# image
image: node:latest
# pipelines
- step:
jeromecoupe / webstoemp-gulpfile.js
Last active May 4, 2021
Gulp 4 sample gulpfile.js. For a full explanation, have a look at
View webstoemp-gulpfile.js
"use strict";
// Load plugins
const autoprefixer = require("autoprefixer");
const browsersync = require("browser-sync").create();
const cp = require("child_process");
const cssnano = require("cssnano");
const del = require("del");
const eslint = require("gulp-eslint");
const gulp = require("gulp");
jeromecoupe / gulpfile.js
Last active Nov 27, 2020
responsive image pipeline in Gulp
View gulpfile.js
"use strict";
// ---------------------------------------
// packages
// ---------------------------------------
const del = require("del");
const deleteEmpty = require("delete-empty");
const globby = require("globby");
const gulp = require("gulp");
jeromecoupe / craft_matrix_events_lowblocks.twig
Last active Jun 1, 2016
Implement an event calendar with Matrix: all event occurrences are stored as matrix blocks / fields
View craft_matrix_events_lowblocks.twig
{% extends "_layouts/default" %}
{% block content %}
Events just have a Matrix fields with multiple dates.
The goal is to get all dates within a certain date range, ordered by date asc
All event details should be repeated when an event occurs at multiple dates
Events are presented in a calendar view and should only appear for a given day if they have
a corresponding occurence on that day.
jeromecoupe / test_dates_matrix_native.twig
Last active May 26, 2016
Discontinuous events with multiple dates: native method with date fields and matrix
View test_dates_matrix_native.twig
{% extends "_layouts/default" %}
{% block content %}
Tackling discontinuous events without duplication
- Each event has a 'startDate' and an 'endDate' (those are just a date interval, the first date corresponds the the first occurrence of the event and the mast one corresponds to the last occurence of the events). This matching is done manually but we could also use the preparse plugin.
- Each event has got a matrix field 'timetable' with just a block 'mxBlockDate' and date field 'mxDate' for each occurence of the event