Skip to content

Instantly share code, notes, and snippets.

View 1stevengrant's full-sized avatar
🏠
Working from home

Steven Grant 1stevengrant

🏠
Working from home
View GitHub Profile
{preload_replace:master_channel_name="cloud_rss_feed"}
{exp:rss:feed channel="{master_channel_name}"}
<?xml version="1.0" encoding="{encoding}"?>
<rss version="2.0"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
xmlns:admin="http://webns.net/mvcb/"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:content="http://purl.org/rss/1.0/modules/content/">
@1stevengrant
1stevengrant / gist:5354836
Last active December 16, 2015 01:19
example of using Stash to replace image slugs
{sn_header}
{sn_mast}
<div class="container-fluid">
<div class="row-fluid">
<div class="span3">
{sn_sub}
</div><!--/span-->
<div class="span9">
<script type="text/javascript" src="jquery.validate.js"> </script>
<script type="text/javascript" src="localization/{freebie_1}.messages.js"> </script>
@1stevengrant
1stevengrant / gist:5395411
Created April 16, 2013 12:04
xml feed of articles for ExpressionEngine
{preload_replace:master_channel_name="articles"}
{exp:rss:feed channel="{master_channel_name}"}
<?xml version="1.0" encoding="{encoding}"?>
<rss version="2.0"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
xmlns:admin="http://webns.net/mvcb/"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:content="http://purl.org/rss/1.0/modules/content/">
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?charles-rennie-mackintosh-font.co.uk [NC]
RewriteRule \.(pdf)$ - [NC,F,L]
@1stevengrant
1stevengrant / gist:6131920
Created August 1, 2013 14:30
undo Gypsy config
$weblogs_to_groups = array(
8 => array('prefix' => 'news_', 'group_id' => 22),
13 => array('prefix' => 'press_', 'group_id' => 24),
11 => array('prefix' => 'position_', 'group_id' => 25),
15 => array('prefix' => 'confidential_', 'group_id' => 26),
16 => array('prefix' => 'staff_', 'group_id' => 23),
17 => array('prefix' => 'partners_', 'group_id' => 27),
7 => array('prefix' => 'content_', 'group_id' => 28),
9 => array('prefix' => 'footer_', 'group_id' => 20),
14 => array('prefix' => 'external_', 'group_id' => 19),
@1stevengrant
1stevengrant / gist:6413309
Created September 2, 2013 14:12
sql to update the image files on bulk after a CSV upload of dogs. The image files must match the url_title of the dog which, by default is the same as the dog's name but in lowercase
UPDATE exp_channel_data cd
INNER JOIN exp_channel_titles ct
ON cd.entry_id = ct.entry_id
SET cd.field_id_9 = CONCAT('{filedir_2}', ct.url_title, '.jpg')
WHERE ct.channel_id = '2'
@1stevengrant
1stevengrant / gist:6721123
Created September 26, 2013 21:53
Breaks Matrix out into individual fields in a safecracker form
$(".addrow").click(function(){
var m = Matrix.instances[0]; // gets the first Matrix instance on the page
m.addRow();
return false;
})
$(".remrow").click(function(){
var m = Matrix.instances[0]; // gets the first Matrix instance on the page
m.removeRow(m.totalRows - 1); // removes the last row
return false;
@1stevengrant
1stevengrant / gist:6776240
Created October 1, 2013 09:59
This is my current Sublime preference file
{
"auto_complete_commit_on_tab": true,
"bold_folder_labels": true,
"file_exclude_patterns":
[
".DS_Store"
],
"folder_exclude_patterns":
[
"bin",
@1stevengrant
1stevengrant / gist:6901184
Created October 9, 2013 13:22
MPL Vagrant file
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
config.vm.box = "lucid64"
config.vm.box_url = "http://files.vagrantup.com/lucid64.box"
config.vm.network :private_network, ip: "192.168.56.101"
config.ssh.forward_agent = true
config.vm.network :forwarded_port, guest: 80, host: 8888, auto_correct: true