Skip to content

Instantly share code, notes, and snippets.

@tomdavies
tomdavies / palette.scss
Last active August 29, 2015 13:56
Better colour names with palettes & SASS maps
// Declare colours
$_color-base-grey: rgb(229,231,234);
$palettes: (
purple: (
base: rgb(42,40,80),
light: rgb(51,46,140),
dark: rgb(40,38,65)
),
grey: (
base: $_color-base-grey,
@tomdavies
tomdavies / set-project-perms.sh
Created December 8, 2015 13:49 — forked from khalwat/set-project-perms.sh
Properly set permissions for a Craft CMS install, including ensuring that files are all g-x. Set CHOWN_USER, CHOWN_GROUP, and BASE_DIR to whatever is appropriate, add directories that need to be writeable by the web server to DIRS[], then execute: ./set-project-perms.sh PROJECT_NAME
#!/bin/bash
# Execute via: ./set-project-perms.sh PROJECT_NAME
# The paradigm is the entire project dir is owned by $CHOWN_USER with the group set to $CHOWN_GROUP
# $CHOWN_USER is an admin or user account that is used to edit files/templates, etc.
# $CHOWN_GROUP is the group of the webserver (e.g.: 'apache', 'nginx', 'httpd', etc.)
# The project dir permissions are set to 755 (-rwxr-xr-x) for directories and to 644 (-rw-r--r--) for files
# The permissions to $DIRS[] that need to be writeable are set to 775 (-rwxrwxr-x) for directories and
# 664 (-rw-rw-r--) for files. Add any assets directories, etc. as necessary.
# Change $BASE_DIR to the absolute path where your websites are stored (leaving it appended with '/$1')
@tomdavies
tomdavies / _disabled.twig
Created August 18, 2016 14:28
application form
<div class="island island--light">
<div class="wrapper">
<div class="cell-v30">
<div class="g">
<div class="g__col
g__col--12
g__col--7--medium g__col--center--medium">
<div class="island cell-40 rule rule--all rule--grey">
{% include '_includes/body' %}
</div>
@tomdavies
tomdavies / .eslintrc.js
Last active January 17, 2021 21:03
Make eslint-loader (+ prettier) play nice with gridsome
module.exports = {
root: true,
env: {
node: true,
},
parserOptions: {
parser: "babel-eslint",
},
settings: {
'import/resolver': 'webpack',
@tomdavies
tomdavies / Plugin.php
Created December 6, 2022 12:20
Register custom image transformers in CraftCMS
<?php
use Craft;
use craft\base\Plugin;
use craft\elements\Asset;
use craft\events\GenerateTransformEvent;
use craft\events\RegisterComponentTypesEvent;
use craft\services\ImageTransforms;
@tomdavies
tomdavies / CustomJsonDatatype.php
Last active August 2, 2023 11:06
Adding a custom DataType to Feed Me for CraftCMS
<?php
namespace modules\datatypes;
use craft\feedme\datatypes\Json;
use illuminate\Support\Collection;
class CustomJsonDatatype extends Json
{
/**