Skip to content

Instantly share code, notes, and snippets.

View Ticolyle's full-sized avatar

Lyle Ticolyle

View GitHub Profile
@Ticolyle
Ticolyle / formlabel pop
Created September 11, 2014 14:39
Clever JS
// Pop Labels
$(function() {
var onClass = "on";
var showClass = "show";
$("input, textarea").bind("checkval", function() {
var label = $(this).prev("label");
if (this.value !== "") {
label.addClass(showClass);
} else {
@Ticolyle
Ticolyle / blacklist.txt
Last active August 29, 2015 14:05
Bad Words
viagra
cialis
sex
sex*
kardashian
porn
nude
celebrities
oops
insurance
@Ticolyle
Ticolyle / filename.js
Created August 6, 2014 05:27
Pass a jquery file input object and get the filename
// Pass a jquery file input object and get the filename
function $getFilename($input) {
var filename = $input.val().split('\\').pop();
return filename;
}
@Ticolyle
Ticolyle / Exp:resso store modifier variation loop variables
Last active August 29, 2015 14:04
The following are undocument variables in the Exp:resso store modifier_options loop for use (usually) when a product has ONLY 1 MODIFIER TYPE. This loop displays variant SKUs and their details. Via DevDeamon help ticket and http://expressionengine.stackexchange.com/questions/1224/expresso-store-possible-to-add-out-of-stock-to-size-drop-down
{modifiers}
{modifier_options}
{option_name}
{option_sku}
{option_track_stock}
{option_stock_level}
{option_min_order_qty}
{/modifiers_options}
{/modifiers}
@Ticolyle
Ticolyle / php_mail_example
Created June 12, 2014 20:44
This snippet is the most simple example of php mail function possible
<?php
$to = 'name@domain.com';
$subject = 'This is a test subject';
$message = 'Hello Message';
$headers = 'From: Test Email' . "\r\n" .
'Reply-To: noreply@domain.com' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
mail($to, $subject, $message, $headers);
@Ticolyle
Ticolyle / current_week_date_range.php
Last active August 29, 2015 14:01
PHP this weeks beginning and end dates - week range
<?php
date_default_timezone_set("America/New_York"); // Dont use server localized timezone
$day = date('w'); // How many days into the current week we currently are (ex: Fri=5)
$week_start = date('m-d-Y', strtotime('-'.$day.' days')); // Today minus $(day) days = first day of the week
$week_end = date('m-d-Y', strtotime('+'.(6-$day).' days')); // Today plus (days in week - ($day) days) = last weekday
echo ('day: '.$day.'<br/>');
echo ('week start: ' . $week_start . '<br/>');
@Ticolyle
Ticolyle / ce_img regex name
Created May 13, 2014 20:36
CE_Img for ExpressionEngine while site under /~dev_url/
$config['ce_image_document_root'] = '/usr/home/site_username/www/';
//remove the extra '/~site_username' from the source
$config['ce_image_src_regex'] = array( '/~site_username' => '' );
//after the image is manipulated, replace the first '/'
//with the extra '/~site_username/' so it works with the URL
$config['ce_image_made_regex'] = array( '^/' => '/~site_username/' );