Skip to content

Instantly share code, notes, and snippets.

@airways
airways / QUERY_PARAM.md
Created July 19, 2011 22:24
ExpressionEngine: new QUERY_PARAM protocol that always works

QUERY_PARAM Protocol

This is a simple technique which should work on ALL hosts to allow ExpressionEngine to handle URLs without index.php in them. Hopefully EllisLab will add this as a built-in option soon.

IJR

@scottjehl
scottjehl / hideaddrbar.js
Created August 31, 2011 11:42
Normalized hide address bar for iOS & Android
/*
* Normalized hide address bar for iOS & Android
* (c) Scott Jehl, scottjehl.com
* MIT License
*/
(function( win ){
var doc = win.document;
// If there's a hash, or addEventListener is undefined, stop here
if( !location.hash && win.addEventListener ){
@robflaherty
robflaherty / csv-to-json.php
Created September 1, 2011 02:26
Convert CSV to JSON
<?php
/*
* Converts CSV to JSON
* Example uses Google Spreadsheet CSV feed
* csvToArray function I think I found on php.net
*/
header('Content-type: application/json');
// Set your CSV feed
@brandonkelly
brandonkelly / gist:1671737
Created January 24, 2012 18:27
Cross-compatible get_upload_preferences() for EE 2.0 thru 2.4
<?php
/**
* Get Upload Preferences (Cross-compatible between ExpressionEngine 2.0 and 2.4)
* @param int $group_id Member group ID specified when returning allowed upload directories only for that member group
* @param int $id Specific ID of upload destination to return
* @return array Result array of DB object, possibly merged with custom file upload settings (if on EE 2.4+)
*/
function get_upload_preferences($group_id = NULL, $id = NULL)
{
@nicjansma
nicjansma / check-apache-access-log-spammers.sh
Created January 25, 2012 04:19
Auto-ban website spammers via the Apache access_log
#!/bin/bash
#
# Config
#
# if more than the threshold, the IP will be banned
THRESHOLD=100
# search this many recent lines of the access log
@arosenhagen
arosenhagen / magento-code-snippets.md
Last active April 8, 2024 09:21
[magento] - code snippets

Magento Code Snippets

Download extension manually using mage

./mage config-set preferred_state stable
./mage clear-cache
./mage sync
./mage download community Module_Name
@adrienne
adrienne / gist:2888431
Created June 7, 2012 12:01
stash events filtered by day of the week
{!-- Controller --}
{exp:channel:entries channel="events" dynamic="off" show_future_entries="yes" order_by="entry_date" sort="asc" }
{!-- group into lists by day of the week --}
{exp:stash:append_list name="events_list" context="{entry_date format='%D'}" }
{stash:entry}
<li><a href="{page_url}">{title}</a> {entry_date format="%d/%m/%y"}</li>
{/stash:entry}
{/exp:stash:append_list}
{/exp:channel:entries}
@wjnerdery
wjnerdery / scm_info.sh
Created June 22, 2012 16:53 — forked from claussni/gist:894310
Source Control Management Bash Prompt Highlighting
##
## SCM info
##
scm_info() {
local bzr_info=`bzr revno --tree 2> /dev/null`
if [ ${bzr_info} ]; then
if [ "$(bzr st -S)" ]; then
local bzr_color='\033[1;31m'
else
local bzr_color='\033[1;36m'
@john-henry
john-henry / gist:3179683
Created July 26, 2012 01:07
Infinite Scroll & Masonry in ExpressionEngine
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title></title>
<meta name="description" content="">
<meta name="author" content="">
<?php
public function settings()
{
$this->EE->cp->set_right_nav(array(
'&larr; Back to Schemas' => $this->cp_url('schemas'),
));
$fields = array(
'settings' => array(