Skip to content

Instantly share code, notes, and snippets.

View objectivehtml's full-sized avatar

Justin Kimbrell objectivehtml

View GitHub Profile
@objectivehtml
objectivehtml / gist:1254367
Created September 30, 2011 17:05
Simple Rtrim EE Plugin
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
$plugin_info = array(
'pi_name' => 'Rtrim',
'pi_version' => '1.0',
'pi_author' => 'Justin Kimbrell',
'pi_author_url' => 'http://objectivehtml.com/',
'pi_description' => 'Removes characters form the end of a string.',
'pi_usage' => Rtrim::usage()
);
{exp:rtrim string="{exp:low_replace find="^http:\\/\\/(www\\.)?(.*)\\/$" replace="$2" regex="yes"}http://www.domain.com/folder/{/exp:low_replace}" trim="/"}
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
$plugin_info = array(
'pi_name' => 'Rtrim',
'pi_version' => '1.0',
'pi_author' => 'Justin Kimbrell',
'pi_author_url' => 'http://objectivehtml.com/',
'pi_description' => 'Removes characters form the end of a string.',
'pi_usage' => Rtrim::usage()
);
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
$plugin_info = array(
'pi_name' => 'Rtrim',
'pi_version' => '1.0',
'pi_author' => 'Justin Kimbrell',
'pi_author_url' => 'http://objectivehtml.com/',
'pi_description' => 'Removes characters form the end of a string.',
'pi_usage' => Rtrim::usage()
);
{exp:rtrim string="http://www.wonderifthisworks.com/" trim="/" remove="http://|https://|www."}
@objectivehtml
objectivehtml / gist:1265123
Created October 5, 2011 17:44
Standard .htaccess
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.*) index.php/$1 [L]
</IfModule>
{exp:channel:entries channel="map_demo" class="open|closed"}
{if group_id == 1 || group_id == 5 && status == "open"}
{title} <br>
{/if}
{/exp:channel:entries}
<!--
Note, the id parameter will become a prefix to the javascript variables. In this example, the map's id is "map", thus all javascript variables have a prefix of "map_".
-->
{exp:gmap:init id="map" style="width:400px;height:300px"}
{exp:channel:entries channel="map"}
{exp:gmap:marker id="map" latitude="{map_latitude}" longitude="{map_longitude}"}
{title}
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=true"></script>
<div id="content" class="container_12 clearfix stockists">
<h1 class="noborder">Find stockists in your area</h1>
<br/>
{exp:gmap:search channel="stockists" return="/the/page/with-the-gmap-results-tag" geocode_field="postal_code|country" distance_field="radius_max" require="postal_code"}
$('.tabs').tabs();
$('.tabs a').click(function() {
var $t = $(this);
var href = $t.attr('href');
if(href == '#map') {
google.maps.event.addListener(map_canvas, 'resize', function() {
map_canvas.setCenter(map_bounds.getCenter());
});