Skip to content

Instantly share code, notes, and snippets.

View ex-jedi's full-sized avatar
🏠
Working from home

Mark Phoenix ex-jedi

🏠
Working from home
View GitHub Profile

Statamic 3 Notes

These notes are for my hosting environment which is a Linux server running cPanel and Apache.

Deployment to webserver

This is what worked for me and if anyone suggests a better method I'll update accordingly.

Assuming files are committed to GitHub, a deploy key is setup and you are logged into the web server via SSH.

@ryangittings
ryangittings / PerchTemplateFilter_Length
Created May 13, 2019 10:24
Perch template filter for getting a Perch item's reading length in minutes
<?php
class PerchTemplateFilter_length extends PerchTemplateFilter
{
public function filterBeforeProcessing($value, $valueIsMarkup = false)
{
$word = str_word_count(strip_tags($value));
$m = floor($word / 200);
$s = floor($word % 200 / (200 / 60));
@clivewalker
clivewalker / sidebarcode.php
Last active December 6, 2017 08:18
Showing a blog post excerpt that isn't the current post in a sidebar using Perch CMS. Use this on your post page.
<?php
perch_blog_custom(array(
'filter' => 'postSlug',
'match' => 'neq',
'value' => perch_get('s'),
'sort'=>'postDateTime',
'sort-order'=>'DESC',
'count'=>1,
'template'=>'blog/post_in_list_sidebar.html'
));
@clivewalker
clivewalker / config.js
Last active December 7, 2018 06:33
A config file to load additional plugins for Perch CMS default Redactor editor
Perch.UserConfig.redactor = function(){
var get = function(profile, config, field) {
if (config.plugins.indexOf('source') === -1) config.plugins.push('source');
if (config.plugins.indexOf('fontcolor') === -1) config.plugins.push('fontcolor');
if (config.plugins.indexOf('alignment') === -1) config.plugins.push('alignment');
return config;
};
@jacobovidal
jacobovidal / .htaccess
Last active July 2, 2023 22:31
Upgrade Insecure Requests via .htaccess or meta tag to prevent mixed content
<ifModule mod_headers.c>
Header always set Content-Security-Policy "upgrade-insecure-requests;"
</IfModule>
@mdo
mdo / 00-intro.md
Last active March 24, 2024 08:04
Instructions for how to affix an Ikea Gerton table top to the Ikea Bekant sit-stand desk frame.

Ikea Bekant standing desk with Gerton table top

// Vanilla version of FitVids
// Still licencened under WTFPL
//
// Not as robust and fault tolerant as the jQuery version.
// It's BYOCSS.
// And also, I don't support this at all whatsoever.
;(function(window, document, undefined) {
'use strict';
@Jamesyps
Jamesyps / cookie_notice.html
Created May 18, 2016 12:33
Perch Cookie Consent
@gradosevic
gradosevic / gulpfile_react.js
Last active November 24, 2022 06:27
Working gulpfile.js with gulp-babel ES6 and React
var gulp = require('gulp');
var babel = require("gulp-babel");
var sourcemaps = require('gulp-sourcemaps');
var concat = require('gulp-concat');
var uglify = require('gulp-uglify');
gulp.task('default', () => {
return gulp.src('js/main.js')
.pipe(sourcemaps.init())
.pipe(babel({
@alkrauss48
alkrauss48 / gulpfile.js
Last active February 17, 2020 12:45
Base gulpfile config for babel, browserify, and uglify - with sourcemaps and livereload
var gulp = require('gulp');
var browserify = require('browserify');
var babelify = require('babelify');
var source = require('vinyl-source-stream');
var buffer = require('vinyl-buffer');
var uglify = require('gulp-uglify');
var sourcemaps = require('gulp-sourcemaps');
var livereload = require('gulp-livereload');