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
@1stevengrant
1stevengrant / gist:1884188
Created February 22, 2012 11:11
ngen file field upgrade - Swap out XX for your file field ID and swap out YY for your file upload location ID.
UPDATE exp_channel_data
SET field_id_XX = CONCAT('{filedir_YY}', field_id_XX)
WHERE field_id_XX != ''
AND field_id_XX NOT LIKE '{filedir_%'
{exp:nsm_transplant:body}
{exp:channel:entries channel="portugal_towns_info" limit="1" disable="categories|member_data|pagination|trackbacks"}
{exp:nsm_transplant:content id="{content_module backspace="1"}content_module_{row_count}|{/content_module}|slideshow_module1"}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
{exp:nsm_better_meta:template entry_id="{entry_id}"}
<link rel="stylesheet" type="text/css" media="all" href="{pp_html-framework_css}" />
<link rel="shortcut icon" href="http://www.portugalproperty.com/favicon.ico" />
{exp:channel:entries channel="portugal_towns_info" limit="1" disable="categories|member_data|pagination|trackbacks"}
{exp:lg_replace:haystack needles="{content_module backspace="1"}content_module_{row_count}|{/content_module}|slideshow_module1"}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
{exp:nsm_better_meta:template entry_id="{entry_id}"}
<link rel="stylesheet" type="text/css" media="all" href="{pp_html-framework_css}" />
<link rel="shortcut icon" href="http://www.portugalproperty.com/favicon.ico" />
<script type="text/javascript" src="http://use.typekit.com/vog8sdr.js"></script>
@1stevengrant
1stevengrant / gist:2463968
Created April 22, 2012 12:39
count entries with given status/channel in expressionengine
{exp:query sql="
SELECT
COUNT(entry_id) AS total_entry_count
FROM
exp_channel_titles
WHERE
channel_id = 1 AND status = 'open'
"}
{total_entry_count}
@1stevengrant
1stevengrant / gist:2761984
Created May 21, 2012 11:48
Function to display year in Roman numerals
<?php // A function to return the Roman Numeral, given an integer
function numberToRoman($num)
{
// Make sure that we only use the integer portion of the value
$n = intval($num);
$result = '';
// Declare a lookup array that we will use to traverse the number:
$lookup = array('M' => 1000, 'CM' => 900, 'D' => 500, 'CD' => 400,
'C' => 100, 'XC' => 90, 'L' => 50, 'XL' => 40,
@1stevengrant
1stevengrant / cleanee.sh
Created June 12, 2012 13:59
bash file to clean an ExpressionEngine install of unrequired themes etc - courtesy of @monooso
#!/bin/bash
# ------------------------------------------------------------------------------
# Simple script to tidy up a raw EE directory. It contains nothing in the way of
# error checking or the like. Use it at your own risk.
#
# Usage:
# Run the script from the command line, with a single argument: the path to the
# EE directory you'd like to clean. For example:
#
@1stevengrant
1stevengrant / gist:2991208
Created June 25, 2012 21:00
mongorestore function to restore whole db
mongorestore --db ua -drop ~/Desktop/ua
export PATH="/usr/local/mysql/bin:$PATH"
[[ -s "/Users/Steven/.rvm/scripts/rvm" ]] && source "/Users/Steven/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
}
@1stevengrant
1stevengrant / config.php
Created July 27, 2012 15:23
ExpressionEngine1.x bootstrapped config file
<?php
if ( ! defined('EXT')){
exit('Invalid file request');
}
$conf['app_version'] = "164";
$conf['license_number'] = "";
$conf['debug'] = "1";
$conf['install_lock'] = "1";
@1stevengrant
1stevengrant / post-receive
Created August 7, 2012 11:20
post-receive hook for git
#!/bin/sh
GIT_WORK_TREE=/home/user/public_html git checkout -f