Skip to content

Instantly share code, notes, and snippets.

View donaldallen's full-sized avatar

Donald Allen donaldallen

View GitHub Profile
@donaldallen
donaldallen / Lex
Created August 13, 2012 17:25
Lex
<nav id="primary">
{{ url:anchor
segments='/'
title='<span class="icon"></span><span class="text">Home</span><span class="arrow"></span>'
class='home {{ if { url:segments segment="1" } == "" }} active {{ endif }}' }}
{{ url:anchor
segments='newspaper'
title='<span class="icon"></span><span class="text">Newspaper</span><span class="arrow"></span>'
class='newspaper {{ if { url:segments segment="1" } == "newspaper" }} active {{ endif }}' }}
1. What I'd like to do, but doesn't work
<a href="{{ url:site uri="faq/{{ url:segments segment="1" default="" }}" }}">
2. My "solution" which feels kinda hacky:
<a href="{{ url:site }}faq/{{ url:segments segment="1" default="" }}">
Entering this into WYSIWYG:
{{ files:listing folder="6" }}
<a class="fancybox"
href="{{ files:image_path id='{{ id }}' }}"
rel="group"
style="background-image:url( {{ url:site }}files/thumb/{{ id }}/150/150 )">
</a>
{{ /files:listing }}
Current
$('.slides').anystretch("<img width="2000" height="620" src="http://samu.ca/wp-content/uploads/2012/11/samu_header-1_mini.jpg" class="attachment-slider-img wp-post-image" alt="samu_header-1_mini" title="samu_header-1_mini" />");
Fixed
$('.slides').anystretch('<img width="2000" height="620" src="http://samu.ca/wp-content/uploads/2012/11/samu_header-1_mini.jpg" class="attachment-slider-img wp-post-image" alt="samu_header-1_mini" title="samu_header-1_mini" />');
Template::set_partial([
['header', 'partials/frontend/header'],
['footer', 'partials/frontend/footer'],
['categories', 'partials/frontend/widgets/categories/tree', ['tree' => Categories::tree()]],
]);
class Businesses_m extends MY_Model {
function get_by_name($name)
{
return $this->db->select('*')
->from('businesses')
->join('locations', 'locations.business_id = businesses.id')
->where('name', $name)
->get()
->result();
}
// Routes.php
use Guzzle\Http\Client;
use Guzzle\Plugin\Oauth\OauthPlugin;
Route::get('/', function()
{
$client = new Client('http://api.twitter.com/1.1');
$oauth = new OauthPlugin(array(
'consumer_key' => '-',
Route::get('/', function()
{
$tweets = Cache::remember('tweets', 5, function() {
$client = new Client('http://api.twitter.com/1.1');
$oauth = new OauthPlugin([
'consumer_key' => '*',
'consumer_secret' => '*',
'token' => '*',
'token_secret' => '*'
]);
@donaldallen
donaldallen / gist:4686832
Created January 31, 2013 21:50
Lex parsing
// Stored in textarea in page via Page Types (any Lex tag in here has the same result)
{{ button:generate class="btn-primary btn-large" href="#" icon="icon-mobile-phone" icon-large="true" full-width="true" text="Available on the App Store" }}
// In layout file
{{ if product_links }}
<div class="well">{{ product_links }}</div>
{{ endif }}
// Result
Parse error: syntax error, unexpected 'null' (T_STRING)
while ($dir && ($file = readdir($dir)) !== false) {
if ($file != "." && $file != ".." && $file != ".DS_Store") {
}
}