Skip to content

Instantly share code, notes, and snippets.

<?php
/**
* Custom configuration bootstrap file for ExpressionEngine
*
* Place config.php in your site root
* Add require(realpath(dirname(__FILE__) . '/../../config_bootstrap.php')); to the bottom of system/expressionengine/config/config.php
* Add require(realpath(dirname(__FILE__) . '/../../config_bootstrap.php')); to the bottom of system/expressionengine/config/database.php
* If you have moved your site root you'll need to update the require_once path
*
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
{if segment_1 == "search" && segment_2 != ""}
<script type="text/javascript">
try {
var pageTracker = _gat._getTracker("UA-000000-1");
pageTracker._initData();
@masugadesign
masugadesign / .bash_profile prompt (remote server, Git branch)
Created February 15, 2010 17:49
.bash_profile prompt (remote server, Git branch)
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
# non git dir: [email protected]:~/var/www: _
# in git dir: [email protected]:~/var/www/site.tld (branchname): _
PS1="\[\e[01;31m\]\u@\H:\w\$(parse_git_branch): \[\e[00m\]"
@choonkeat
choonkeat / ee-localize-mysqldump.rb
Created November 26, 2009 02:05
Because customizing config.php is insufficient (3rd party code get left out, config.php get overwritten on update, ...) http://boblet.tumblr.com/post/68095239/ee-localhost
#!/bin/env ruby
if ARGV.empty?
$stderr.puts <<-EOM
ExpressionEngine (1.x) MYSQL DUMP Localizer
1. Reads MYSQL DUMP of ExpressionEngine website from STDIN
2. Replaces ALL HOSTNAME & PATH data (config) with LOCAL SETTINGS
3. Output corrected MYSQL DYMP file.
@erikreagan
erikreagan / tm-serialization-command1.php
Created October 27, 2009 21:28
Work with serialized data easier
#!/usr/bin/env php
<?php
// This command simply prints out the serialized data in a readable printed array format
// Found on a blog via a google search
// @see http://top-frog.com/2009/08/28/quickly-unserialize-data-in-textmate/
$data = unserialize(file_get_contents('php://stdin'));
print_r($data);
@erikreagan
erikreagan / ExpressionEngine Body Tags
Created October 5, 2009 12:59
ExpressionEngine Body Tags
<!-- A few samples of body tag use in ExpressionEngine templates -->
<!-- This uses embedded variables if they are sent from another template. I use this one often -->
<body{if embed:body_id} id="{embed:body_id}"{/if}{if embed:body_class} class="{embed:body_class}"{/if}>
<!-- This works well when sticking to the template_group/template structure -->
<body{if segment_1 !=''} id="{segment_1}"{if segment_2 != ''} class="{segment_2}"{/if}{/if}>