Skip to content

Instantly share code, notes, and snippets.

View sublimecoder's full-sized avatar

Jared Smith sublimecoder

View GitHub Profile
@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 / 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 / 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 / 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 / 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;
}