Skip to content

Instantly share code, notes, and snippets.

View Natetronn's full-sized avatar

Nathan Doyle Natetronn

View GitHub Profile
@Natetronn
Natetronn / hidden_configs.php
Created April 23, 2012 08:01
ExpressionEngine hidden configs
<?php
$EE = get_instance();
$config = $this->EE->config->config;
ksort($config);
foreach($config as $key => $value)
{
@Natetronn
Natetronn / state-abbrivated-dropdown.txt
Created June 20, 2012 18:28
P&T Dropdown ~ States with abbreviated value
AL : Alabama
AK : Alaska
AZ : Arizona
AR : Arkansas
CA : California
CO : Colorado
CT : Connecticut
DE : Delaware
FL : Florida
GA : Georgia
@Natetronn
Natetronn / _EXTENDED.htaccess
Created August 23, 2012 17:51 — forked from pauloelias/README.md
Extended ExpressionEngine .htaccess
# Secure .htaccess file
# ------------------------------
<Files .htaccess>
order allow,deny
deny from all
</Files>
# Don't show any directory without an index file
# ------------------------------
@Natetronn
Natetronn / .htaccess
Created August 23, 2012 18:20 — forked from MaxLazar/.htaccess
ExpressionEngine .htaccess template
# Standard .htaccess file
# Secure .htaccess file
<Files .htaccess>
order allow,deny
deny from all
</Files>
# Don't show any directory without an index file
Options -Indexes
@Natetronn
Natetronn / gist:3716607
Created September 13, 2012 18:45
Matrix naming conventions
{gallery_matrix_images}
<figure>
<img src="{mx_file_src}" alt="{mx_text_alt_tag}" />
<figcaption>{mx_textarea_caption}</figcaption>
</figure>
{/gallery_matrix_images}
@Natetronn
Natetronn / config.php
Created October 28, 2012 20:09 — forked from 1stevengrant/config.php
Fixes the daylight savings issue with EE
var $dateTime = new DateTime();
$dateTime->setTimezone(new DateTimeZone('America/New_york'));
$dateTime->setTimestamp(time());
$isDst = (bool)$dateTime->format('I') ? "y" : "n";
$conf['daylight_savings'] = $isDst;
@Natetronn
Natetronn / InputfieldTextarea.module
Created January 17, 2013 08:28
ProcessWire InputfieldTextarea.module w/ placeholder text
<?php
/**
* An Inputfield for handling XHTML "textarea" form inputs
*
*/
class InputfieldTextarea extends Inputfield {
const defaultRows = 5;
@Natetronn
Natetronn / windows-upload-issue.html
Created February 19, 2013 01:58
Windows upload issue
$slash_type = (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') ? '\\' : '/';
$env_config['upload_preferences'] = array(
1 => array(
'name' => 'Thumbnails',
'server_path' => $images_path . $slash_type. 'uploads' . $slash_type . 'thumbnails/',
'url' => $images_url . '/uploads/thumbnails/'
),
);
@Natetronn
Natetronn / safecracker-garbage-collection.md
Last active April 15, 2019 19:01
Safecracker Garbage Collection

Ever run into this error before?

Uncaught TypeError: Object [object Object] has no method 'markItUp'

If you've ever used Safecracker for ExpressionEngine chances are you have!

What's happening is Safecracker is including JavaScript for custom fields in your form for you. These custom fields rely on said js to function properly. This in itself isn't a big deal but, the issue arises because Safecracker spits out this js right smack in the middle of your template wherever your Safecracker form happens to be located.

Again not the biggest issue except:

<?php
// Look for this in mod.channel.php (around line 2635):
case 'custom_field' :
if (strpos($corder[$key], '|') !== FALSE)
{
$end .= "CONCAT(wd.field_id_".implode(", wd.field_id_", explode('|', $corder[$key])).")";
}
else
{