Skip to content

Instantly share code, notes, and snippets.

View sublimecoder's full-sized avatar

Jared Smith sublimecoder

View GitHub Profile
@sublimecoder
sublimecoder / equalHeight.js
Created April 22, 2014 18:18
Equal Height Elements
// snippet requires jquery.
function equalHeight(group) {
tallest = 0;
// loop through and find the tallest div in a group.
group.each(function() {
thisHeight = jQuery(this).height();
if(thisHeight > tallest) {
tallest = thisHeight;
}
@sublimecoder
sublimecoder / mysqlbackup.sh
Created April 22, 2014 18:20
Quick Mysql Backup cronjob
#!/bin/sh
DAY=`/bin/date +%Y%m%d`
mysqldump -h localhost -u root -p<password> --all-databases > /home/administrator/mysqlbackups/mysql.yourdomain.$DAY.sql
@sublimecoder
sublimecoder / filterDivs.js
Last active August 29, 2015 14:00
Searches through the content of a set of divs, and hides the ones that do not match the search.
function disableEnterKey(e)
{
var key;
if(window.event)
key = window.event.keyCode; //IE
else
key = e.which; //firefox
return (key != 13);
}
//Filter for the table. You feed it the object and the ID to get it to respond.
@sublimecoder
sublimecoder / filterTable.js
Last active August 29, 2015 14:00
filters the rows of a table. Make the table searchable.
// written in plain javascript and can be called using the inline html js events,
// or by using selectors of your favorite javascript library.
function disableEnterKey(e)
{
var key;
if(window.event)
key = window.event.keyCode; //IE
else
key = e.which; //firefox
@sublimecoder
sublimecoder / .htaccess
Last active January 31, 2024 17:55
Boilerplate .htaccess file
RewriteEngine on
RewriteBase /
Options -Indexes
# disallow access to special directories and feed back a 404 error
RedirectMatch 404 /\\.svn(/|$)
RedirectMatch 404 /\\.git(/|$)
# set headers that will override server defaults.
#Header set X-UA-Compatible "IE=9"
@sublimecoder
sublimecoder / Weather-proxy
Created May 5, 2014 16:10
A simple file for pulling weather data from an API
<cfscript>
zipcode = isDefined("form.q")?form.q:url.q;
zipcode = trim(zipcode);
path="#expandpath('.')#\weatherData\zip-#zipcode#.txt";
smlImgPath="#expandpath('.')#\weatherData\images\small\";
lrgImgPath="#expandpath('.')#\weatherData\images\large\";
// check the ages and existance of the current cached weather file.
if (fileExists(path)){
info = GetFileInfo(path);
if (dateDiff("n", info.lastmodified, now()) >= 60){
<!---Start Function to look through arguments and replace special variables with Road Map variables. --->
<cffunction name="fillInTemplate" access="public" returntype="string" output="false">
<cfargument name="map" type="struct" required="true" />
<cfargument name="template" type="string" required="true" />
<cfset var str = arguments.template />
<cfset var k = "" />
<cfloop list="#StructKeyList(arguments.map)#" index="k">
@sublimecoder
sublimecoder / flashChecker.js
Created May 5, 2014 16:52
Simple script for checking if the browser has flash enabled. Most often used for swapping a slide show element.
var hasFlash = false;
try {
var fo = new ActiveXObject('ShockwaveFlash.ShockwaveFlash');
if(fo) hasFlash = true;
}catch(e){
if(navigator.mimeTypes ["application/x-shockwave-flash"] != undefined) hasFlash = true;
}
@sublimecoder
sublimecoder / bot-blocking-expression
Last active September 19, 2023 14:37
IIS Regex Bot Blocking Rule
^$|EasouSpider|Add Catalog|PaperLiBot|Spiceworks|ZumBot|RU_Bot|Wget|Java/1.7.0_25|Slurp|FunWebProducts|80legs|Aboundex|AcoiRobot|Acoon Robot|AhrefsBot|aihit|AlkalineBOT|AnzwersCrawl|Arachnoidea|ArchitextSpider|archive|Autonomy Spider|Baiduspider|BecomeBot|benderthewebrobot|BlackWidow|Bork-edition|Bot mailto:craftbot@yahoo.com|botje|catchbot|changedetection|Charlotte|ChinaClaw|commoncrawl|ConveraCrawler|Covario|crawler|curl|Custo|data mining development project|DigExt|DISCo|discobot|discoveryengine|DOC|DoCoMo|DotBot|Download Demon|Download Ninja|eCatch|EirGrabber|EmailSiphon|EmailWolf|eurobot|Exabot|Express WebPictures|ExtractorPro|EyeNetIE|Ezooms|Fetch|Fetch API|filterdb|findfiles|findlinks|FlashGet|flightdeckreports|FollowSite Bot|Gaisbot|genieBot|GetRight|GetWeb!|gigablast|Gigabot|Go-Ahead-Got-It|Go!Zilla|GrabNet|Grafula|GT::WWW|hailoo|heritrix|HMView|houxou|HTTP::Lite|HTTrack|ia_archiver|IBM EVV|id-search|IDBot|Image Stripper|Image Sucker|Indy Library|InterGET|Internet Ninja|internetmemory|ISC Systems iRc
@sublimecoder
sublimecoder / url_testing_challenge.rb
Last active August 29, 2015 14:02
Testing Challenge
require 'rubygems'
require 'json'
require 'httpclient'
start = "http://letsrevolutionizetesting.com/challenge?format=json"
def go_to_url url
client = HTTPClient.new
httpresult = client.get_content(url)
JSON.parse(httpresult)
end