Skip to content

Instantly share code, notes, and snippets.

View juddlyon's full-sized avatar

Judd Lyon juddlyon

View GitHub Profile
<?php
// Dynamic paths for cross-server compatibility
$protocol = (isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == "on") ? "https://" : "http://";
$base_url = $protocol . $_SERVER['HTTP_HOST'];
$base_path = $_SERVER['DOCUMENT_ROOT'];
$system_folder = "system";
$images_folder = "images";
$images_path = $base_path . "/" . $images_folder;
@jamiepittock
jamiepittock / ExpressionEngine template
Created November 23, 2012 11:48
Inject events from low_events:entries into low_events:calendar cells
{exp:low_events:calendar
events_field="cf_events_date_time"
date="{freebie_4}"
}
<table class="calendar" cellspacing="0" cellpadding="0">
<thead>
<tr id="month_pager">
<th colspan="1" class="previous"><a href="{structure:page:uri}
on/{prev_month_url}" title="{prev_month format='%F %Y'}">&larr;</a></th>
<th colspan="5" class="month_title"><a href="{structure:page:uri}
<?php
namespace Craft;
/**
* The class name is the UTC timestamp in the format of mYYMMDD_HHMMSS_pluginHandle_migrationName.
*/
class m150904_071603_inspections_DistanceText extends BaseMigration
{
/**
@alexkingorg
alexkingorg / hex_color_mod.php
Created September 3, 2011 23:42
Change the brightness of the passed in hex color in PHP
<?php
/**
* Change the brightness of the passed in color
*
* $diff should be negative to go darker, positive to go lighter and
* is subtracted from the decimal (0-255) value of the color
*
* @param string $hex color to be modified
* @param string $diff amount to change the color
@DavidWittman
DavidWittman / clouddns-export.py
Last active December 12, 2018 01:06
Exports all domains for a Rackspace Cloud account in BIND9 format
#!/usr/bin/env python
import json
import os
import time
import clouddns
USERNAME = ''
APIKEY = ''
@johanneslamers
johanneslamers / craftcms_varnish.vcl
Last active February 26, 2019 02:46 — forked from aelvan/gist:eba03969f91c1bd51c40
Varnish 4.0 file for our Craft CMS projects
# Varnish 4.0 file for our Craft CMS projects
# Based on https://github.com/mattiasgeniar/varnish-4.0-configuration-templates/blob/master/default.vcl
#
# This is still work in progress, comments appreciated.
vcl 4.0;
import std;
import directors;
@croxton
croxton / stash_nested_embeds.md
Created October 29, 2012 14:23
Stash & template partials - nested embed

Required:

Stash 2.3.4 (beta) or later

Stash template directory

	/layouts/
		standard.html

	/partials/

listing.html

@jamshedazhar
jamshedazhar / fix_content_type_s3.py
Created June 22, 2018 12:27
Sample script to fix ContentType of object stored in AWS S3.
import boto3
s3 = boto3.client('s3')
bucket_name = '<bucket name>'
valid_content_type = ['image/jpeg', 'image/png', 'image/gif']
def is_valid_header(bucket, key):
try:
@cmalven
cmalven / craft-localization-nginx
Last active October 22, 2019 12:59
nginx config for Craft CMS localization
server {
listen 80;
server_name site.production.designcompany.com;
root /home/forge/site.production.designcompany.com/public;
# enable gzip compression
gzip on;
gzip_min_length 1100;
gzip_buffers 4 32k;
gzip_types text/plain application/x-javascript image/svg+xml text/xml text/css;
@jeroenlammerts
jeroenlammerts / gist:de0471dc210749f4afe8d2e69bab46d8
Created August 31, 2017 20:33
Craft CMS 3 content migrations - create field
<?php
namespace craft\contentmigrations;
use Craft;
use craft\db\Migration;
/**
* m170831_195046_second_migration migration.
*/