Skip to content

Instantly share code, notes, and snippets.

View leevigraham's full-sized avatar
🍹

Leevi Graham leevigraham

🍹
View GitHub Profile
@leevigraham
leevigraham / gist:1277716
Created October 11, 2011 09:43
Select top 5 entries grouped by category
SELECT *
FROM
(
SELECT cp.cat_id, cp.entry_id, ct.title,
@num := if(@group = cp.cat_id, @num + 1, 1) as row_number,
@group := cp.cat_id as group_key
FROM (SELECT @group:=null,@num:=0) n
CROSS JOIN exp_category_posts cp
LEFT JOIN exp_channel_titles ct on cp.entry_id = ct.entry_id
ORDER BY cp.cat_id
'articles/details/:url_title' => function (\rsanchez\ResourceRouter\Router $router, $wildcard) {
$ee = ee();
$ee->load->helper('date');
$query = $ee->db->select('edit_date')
->from('channel_titles')
->join('channels', 'channel_titles.channel_id = channels.channel_id')
->where('url_title', (string) $wildcard)
->where('channel_name', 'articles')
@leevigraham
leevigraham / gist:d1f5a4e7572d1249e89b
Last active April 8, 2018 01:49
Assets 2.5 patch to add :revved_url manipulation
diff -ENwbur /Users/leevigraham/Downloads/Assets2.5/ee2/third_party/assets/ft.assets.php /Volumes/Sites/Work/Internal/example.com/app/third_party/assets/ft.assets.php
--- /Users/leevigraham/Downloads/Assets2.5/ee2/third_party/assets/ft.assets.php 2014-11-11 10:30:36.000000000 +1100
+++ /Volumes/Sites/Work/Internal/example.com/app/third_party/assets/ft.assets.php 2015-03-13 14:26:27.000000000 +1100
@@ -1900,6 +1900,14 @@
}
/**
+ * Replace Revved URL
+ */
+ function replace_revved_url($data, $params)
DOMAIN.buildbox.newism.com.au,
www.DOMAIN.buildbox.newism.com.au,
dev.DOMAIN.buildbox.newism.com.au,
stage.DOMAIN.buildbox.newism.com.au,
master.DOMAIN.buildbox.newism.com.au
0xab13d6983e7fe97b0c873f58536ad33412edc0a2
{if logged_in == FALSE}
<p class='alert' style="background:#fffced; margin-top:0">Please login before posting a new ticket.</p>
{embed="account/.form-login"}
{/if}
{if gv_get_r == 200}
<p class="msg success">Ticket created successfully and our developers have been alerted. Expect a response generally within 48 hrs with priority given to commercial addons.</p>
{/if}
{exp:channel:entry_form
{!--
Custom channel fields: http://cl.ly/e047e8b070dd08a74f8d
* {test_matrix}
- Cells:
- {test_matrix_image}
- {test_matrix_text}
* {page_content}
Entry Content: http://cl.ly/e21bf6f23fa4f1e8fe2d
--}
@leevigraham
leevigraham / index.html
Created April 11, 2013 13:44
A CodePen by Leevi Graham.
<div id="page" class="box stacked">
<div class="primary toolbar">Toolbar</div>
<div class="box flex">
<div class="primary sidebar">
Width:
<button onclick="$(this).parent().width('+=100');">Increase</button>
<button onclick="$parent = $(this).parent(); if($parent.width() >= 200) { $parent.width('-=100') } ;">Decrease</button>
</div>
<div class="box stacked flex">
<div class="secondary toolbar">
<?php
/**
* Load member data into cache for performance
*
* @access public
* @param $Channel The current Channel object including all data relating to categories and custom fields
* @param $query_result array Entries for the current tag
* @return array The modified query result
* @see http://expressionengine.com/public_beta/docs/development/extension_hooks/module/channel/index.html
*/
<?php
namespace Newism\ActivityBundle\Form;
use Symfony\Component\Form\AbstractType,
Symfony\Component\Form\FormBuilder,
Symfony\Component\Form\FormEvents,
Symfony\Component\Form\Event\DataEvent;
use Newism\ProjectBundle\Form\EventListener\AddTaskFieldSubscriber;