Skip to content

Instantly share code, notes, and snippets.

View shane-reaume's full-sized avatar

Shane Reaume shane-reaume

View GitHub Profile
@shane-reaume
shane-reaume / public.php
Created October 19, 2012 17:51
a public gist
public
@shane-reaume
shane-reaume / shane.js
Created October 23, 2012 20:07
jQuery scroll function, first jQuery set
/*global window */
/*global jQuery */
jQuery.noConflict();
/* scroll and viewportwidth functions start shane *************************************************************** */
jQuery(window.document).scroll(function () {
"use strict";
// Declare variables
var $el, viewportWidth, $ezblogmenu, $discussRight, $s_right;
@shane-reaume
shane-reaume / .htaccess
Created October 23, 2012 22:02
bullet proof expires, gzip, FileEtag and cache control
<IfModule mod_mime.c>
AddType text/css .css
AddType application/x-javascript .js
AddType text/html .html .htm
AddType text/richtext .rtf .rtx
AddType image/svg+xml .svg .svgz
AddType text/plain .txt
AddType text/xsd .xsd
AddType text/xsl .xsl
AddType text/xml .xml
@shane-reaume
shane-reaume / .htaccess
Created October 23, 2012 22:34
Better htaccess cache handling
<IfModule mod_headers.c>
Header unset ETag
Header unset Last-Modified
</IfModule>
FileETag None
<FilesMatch "\.(ico|gz|JPG|jpg|jpeg|png|gif|js|css|swf)$">
Header unset Cache-control
Header set Expires "access plus 1 month"
</FilesMatch>
<IfModule mod_expires.c>
@shane-reaume
shane-reaume / shane.js
Created November 1, 2012 21:24
Phone mask for phone field, taken off for mobile devices
jQuery(function ($e) {
"use strict";
var isMobile = navigator.userAgent.match(/(iPhone|iPod|iPad|Android|BlackBerry)/);
if (!(isMobile)) {
$e('#refer').val(window.location.href);
$e.mask.definitions['~'] = '[+-]';
$e('#phone').mask('(999)999-9999');
$e('#field_phone_number').mask('999-999-9999');
}
});
@shane-reaume
shane-reaume / validation.php
Created November 2, 2012 23:13
Server-side(PHP) validation of phone number that also prevents multiple of same digit, i.e. all 1's
function phonenumber($value)
{
$areacode = '[2-9]{1}\d{1}\d{1}'; // You might want to specify '2\d\d' (200 to 299)
$prefix = '[2-9]{1}\d{1}\d{1}';
$regex = '#^(\('.$areacode.'\)|'.$areacode.')[\s\.-]?'.$prefix.'[\.-]?\d{4}$#';
if (preg_match($regex, $value))
{
// Number now is in a suitable format
// extract digits -- remove this section to not test repeated pattern
@shane-reaume
shane-reaume / footer.php
Created January 21, 2013 23:36
Copyright start year, and update every year
@shane-reaume
shane-reaume / testdatapull.php
Created February 21, 2013 01:04
JSCharts, improve label and tooltip values for larger data with PHP
<?php
$e1 = 1;
$e2 = $e1;
$e3 = --$e2;
while ($e1 <= $counting) {
echo "myChart.setLabelX([".$e1.",'".$e1++."']);";
}
while( $e2 <= $counting ) {
$value = $teststring[$e3++];
@shane-reaume
shane-reaume / js_bottom.js
Last active December 15, 2015 18:39
Remove attributes then add with mouse or click
(function($){
$('form.ProductReviewForm').attr('action', '')
.attr('method', '');
$(".demo").remove();
$(document).ready(function() {
$('#TopMenu').css({
'border-radius':'0 0 5px 5px'
,'box-shadow':'2px 2px 3px #999999'
});
$('#Menu').css({
@shane-reaume
shane-reaume / allsite.js
Created April 10, 2013 16:33
Form filters
/**
* Created By: Shane Reaume
* Date: 12/17/12
* Time: 10:20 AM
*/
/* form filters -Shane */
$(function() {
var yourFacilityinput = $('label:contains("Your Facility")').parent('div').find('input');