Skip to content

Instantly share code, notes, and snippets.

@strarsis
strarsis / guide.md
Last active February 19, 2023 00:29
Object caching with Bedrock (and Trellis) using Redis

Object caching with Bedrock (and Trellis) using Redis

What is object caching

While nginx microcaching already solves page caching (as of static, rarely changing WordPress pages), the performance for dynamically generated pages (like WooCommerce shop pages and admin backend in general) can benefit greatly from additionally using an object cache. Object caching allows an application (in this case WordPress with its plugins, theme, etc.) to store prepared objects (mostly database queries) in a database and quickly retrieve them, therefore improving the performance of dynamic page generation. Object caching is (usually) transparent, which means that it shouldn't be noticeable by users and developers (except for the performance improvements of course).

Implementations

@carthegian
carthegian / Vagrantfile
Last active May 24, 2024 23:20
A quick gist for Vagrant with Amazon Linux 2 + PHP 7.4. Specifically for kickstart communicating with Google APIs using gRPC.
# -*- mode: ruby -*-
# vi: set ft=ruby :
@script = <<SCRIPT
# Install php and extensions
# PHPと拡張をインストールする
sudo amazon-linux-extras install php7.4
sudo ln -s /usr/bin/php /usr/local/bin/php
@dkozar
dkozar / .zshrc
Created November 1, 2019 00:09
"Flattens" the structure of files in ~/Splice/ folder to ~/SpliceFlat/ folder
# MacOS!
# "Flattens" the structure of files in ~/Splice/ folder to ~/SpliceFlat/ folder
# Copyright 2019 by Danko Kozar
alias splice-flatten="find ~/Splice/ -mindepth 2 -type f -exec rsync --update --quiet '{}' ~/SpliceFlat/ ';'"
splice () {
echo "watching for Splice folder changes"
splice-flatten
while true; do sleep 5; echo "... checking..."; splice-flatten; done
@ammmze
ammmze / ConverterDateAndJavaTime.java
Last active June 7, 2024 09:27
opencsv HeaderColumnNameAndOrderMappingStrategy
package com.example.csv;
import com.opencsv.bean.ConverterDate;
import com.opencsv.exceptions.CsvDataTypeMismatchException;
import java.lang.reflect.InvocationTargetException;
import java.time.LocalDate;
import java.time.LocalTime;
import java.time.format.DateTimeFormatter;
import java.time.temporal.Temporal;
import java.util.Locale;
@ajmalafif
ajmalafif / aws.md
Last active December 27, 2021 15:24
[aws] - AWS Powered WordPress (Bedrock)
@Fasani
Fasani / Simple-Backbone-WordPress-Example.html
Last active February 4, 2022 04:38
A simple Backbone WordPress Example. Using JSON API plugin. (http://wordpress.org/plugins/json-api/)
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Simple Backbone WordPress Example</title>
<link rel="stylesheet" href="base.css">
</head>
<body>
<ul id="post-list"></ul>
@jjgod
jjgod / CCacheMacNinja.md
Last active October 31, 2023 06:57
Using ccache for Mac builds

Introduction

ccache is a compiler cache. It speeds up recompilation of C/C++ code by caching previous compilations and detecting when the same compilation is being done again. This often results in a significant speedup in common compilations, especially when switching between branches. This page is about using ccache on Mac with clang and ninja build system. If you want to use Xcode, please refer to the old CCacheMac page.

In order to use ccache with clang, you need to use the current git HEAD, since the most recent version (3.1.9) doesn't contain the patch needed for using chromium style plugin.

Installation

To install ccache with [homebrew](http://mxcl.

@ircmaxell
ircmaxell / php.sh
Created July 8, 2012 17:15
PHP Run Script
#!/bin/bash
BIN=""
if [ "$PHP" == "/usr/local/bin/php" ]
then
PHP=""
fi
BIN="/usr/local/php/$1/bin/php"
@ircmaxell
ircmaxell / php-build.sh
Created July 8, 2012 16:58
PHP Build Script
#!/bin/bash
function checkError {
if [ $1 -ne 0 ]; then
echo -e "Error in build step\n"
exit
fi
}
VERSION=$1