Skip to content

Instantly share code, notes, and snippets.

View carlalexander's full-sized avatar

Carl Alexander carlalexander

View GitHub Profile
INITIALISATION
==============
load wp-config.php
set up default constants
load wp-content/advanced-cache.php if it exists
load wp-content/db.php if it exists
connect to mysql, select db
load object cache (object-cache.php if it exists, or wp-include/cache.php if not)
load wp-content/sunrise.php if it exists (multisite only)
@isotrope
isotrope / iso_gf_min_sum_validation.php
Last active April 28, 2021 20:44
Sum total of all fields with a class of XXXX and throw a validation error if the sum is == 0
<?php
//Don't forget to change the _1 in the hook to the ID of your form
add_filter('gform_validation_1', 'iso_min_sum_validate');
// Most code taken from http://www.gravityhelp.com/documentation/page/Using_the_Gravity_Forms_%22gform_validation%22_Hook
function iso_min_sum_validate($validation_result) {
// We'll base our loop on CSS class
@kevin-smets
kevin-smets / iterm2-solarized.md
Last active April 16, 2024 14:21
iTerm2 + Oh My Zsh + Solarized color scheme + Source Code Pro Powerline + Font Awesome + [Powerlevel10k] - (macOS)

Default

Default

Powerlevel10k

Powerlevel10k

@jbenet
jbenet / simple-git-branching-model.md
Last active April 9, 2024 03:31
a simple git branching model

a simple git branching model (written in 2013)

This is a very simple git workflow. It (and variants) is in use by many people. I settled on it after using it very effectively at Athena. GitHub does something similar; Zach Holman mentioned it in this talk.

Update: Woah, thanks for all the attention. Didn't expect this simple rant to get popular.

@karmi
karmi / movie-titles.rb
Created January 13, 2013 20:42
Multiple analyzers and query fields in Elasticsearch for auto-completion
require 'tire'
# Tire.configure { logger STDERR, level: 'debug' }
Tire.index('movie-titles') do
delete
create \
settings: {
index: {
analysis: {