Skip to content

Instantly share code, notes, and snippets.

View leevigraham's full-sized avatar
🍹

Leevi Graham leevigraham

🍹
View GitHub Profile
msg_regexp = new RegExp("<div class=['\"]message['\"]>[\\s\\S]+<\/div>", "m")
ee_ajax_response_marker_reg_exp = new RegExp("<!-- EE_ajax_response(?: -->([\\s\\S]+)<!-- )?End EE_ajax_response -->");
function parse_interstitial_response(str)
{
if((response = str.match(ee_ajax_response_marker_reg_exp)) && (message = response[1].match(msg_regexp)))
{
error = (str.match(/Error<\/title>/)) ? true : false;
link = response[1].match(/href=["'](.*)["']/) || false;
message = message[0].replace(/(class=['"]message)/gi, ( error ? "$1 error" : "$1 success") );
<?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
*
{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
/**
* EE Affiliate link automations

*
* Original concept and code by: Leevi Graham <http://leevigraham.com>
* Modified by: Brandon Kelly <http://pixelandtonic>
*/
var ee_affiliate_name = 'expressionengineaddons',
external_re = new RegExp('^https?://(?!'+document.location.hostname+')'),
external_ee_re = new RegExp('^(https?://(secure\\.|www\\.)?expressionengine.com'
{!--
Custom channel fields: http://cl.ly/e047e8b070dd08a74f8d
* {test_matrix}
- Cells:
- {test_matrix_image}
- {test_matrix_text}
* {page_content}
Entry Content: http://cl.ly/e21bf6f23fa4f1e8fe2d
--}
<?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
*/
@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
<?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;
<?php
namespace NSM\UserBundle\Form\DataTransformer;
use NSM\UserBundle\Entity\Invitation;
use Doctrine\ORM\EntityManager;
use Symfony\Component\Form\DataTransformerInterface;
use Symfony\Component\Form\Exception\UnexpectedTypeException;
/**
@leevigraham
leevigraham / gist:4689228
Created February 1, 2013 04:31
Assets2 / NSM Override Css Fix
--- mcp.assets.php (saved version)
+++ (current document)
@@ -100,8 +100,8 @@
Assets_helper::insert_css('#mainContent .rightNav span { position: relative; z-index: 1; }
#mainContent .heading { position: relative; top: -32px; margin-bottom: -32px; background: none; }
- #mainContent .heading h2 { padding: 0; color: #34424b; text-shadow: none; background: none; font-size: 25px; font-family: HelveticaNeue-Light, HelveticaNeue, sans-serif; }
- #mainContent .pageContents { margin: 0 -19px -25px -25px; padding: 0; background: none; overflow: visible; }');
+ #mainContent .heading h2 { padding: 0; color: #34424b; text-shadow: none; background: none; font-size: 25px; font-family: HelveticaNeue-Light, HelveticaNeue, sans-serif; border:none }
+ #mainContent .pageContents { margin: 0 -19px -25px -25px; padding: 0; background: none; overflow: visible; border:none !important }');