Skip to content

Instantly share code, notes, and snippets.

Avatar

Oliver Davies opdavies

View GitHub Profile
View php.Dockerfile
FROM php:7.4-fpm-alpine AS base
ENV PATH=$PATH:/app/vendor/bin
WORKDIR /app
RUN apk add --no-cache \
libpng-dev \
mariadb-client \
&& docker-php-ext-install \
bcmath \
gd \
pdo_mysql
View ci.yml
name: CI
on:
pull_request:
branches:
- production
push:
branches:
- production
workflow_dispatch:
View station-facilities.html
<link href="https://unpkg.com/tailwindcss@^2/dist/tailwind.min.css" rel="stylesheet">
<script src="https://unpkg.com/petite-vue" defer init></script>
<div class="p-10">
<div class="max-w-4xl mx-auto p-4 bg-gray-100" v-scope="{
facilities: [
{ name: 'Toilets', available: false },
{ name: 'Parking', available: true },
{ name: 'ATM', available: false },
{ name: 'Ticket office', available: false },
@opdavies
opdavies / docker.md
Last active Apr 5, 2021
Docker resources
View docker.md

Books and video courses

YouTube videos

@opdavies
opdavies / Node.php
Last active May 11, 2020
Automatically updating the created date for talk nodes, to match the date of the latest event for that talk.
View Node.php
<?php
declare(strict_types=1);
namespace Drupal\custom\Entity;
use Drupal\node\Entity\Node as CoreNode;
use Drupal\paragraphs\ParagraphInterface;
use Illuminate\Support\Collection;
View rename-post-files.php
<?php
use Symfony\Component\Finder\Finder;
require_once __DIR__.'/vendor/autoload.php';
$finder = new Finder();
$files = $finder->in(__DIR__.'/source/_posts')->files();
/** @var \Symfony\Component\Finder\SplFileInfo $file */
View TodoistFilters.md

Dashboard: overdue, today, #inbox, @waiting

Focus: overdue, (p1 & today)

Morning Routines: (overdue|today) & ##Routines & p2

Morning:

View drupal_path_test.php
<?php
/**
* Tests Simple Smartling's path functionality.
*/
class SimpleSmartlingPathTest extends DrupalWebTestCase {
/**
* Implements getInfo().
*/
View totals-with-collections.php
<?php
// https://twitter.com/codebyjeff/status/1057057070460022784
$array1 = ['col1' => 2, 'col2' => 5];
$array2 = ['col1' => 4, 'col2' => 1];
$array_total = collect($array1)->zip($array2)
->map->sum();
View sass-map-each-loop.scss
$icons: (
camera: 'factsheet_bg.png',
ebook: 'library_bg.png',
newsletter: 'newsletter_bg.png',
pages: 'project_results_bg.png',
publications: 'publications_bg.png',
youtube: 'youtube_bg.png',
);
@each $class, $filename in $icons {