Skip to content

Instantly share code, notes, and snippets.

View jakebellacera's full-sized avatar

Jake Bellacera jakebellacera

View GitHub Profile
@jakebellacera
jakebellacera / jquery.placeholder.js
Created July 15, 2011 18:00
jQuery Placeholder Plugin - Fixes the placeholder attribute on non-supported browsers.
/*
* Placeholder plugin for jQuery
* @author Daniel Stocks (http://webcloud.se)
*/
(function($) {
function Placeholder(input) {
this.input = input;
if (input.attr('type') == 'password') {
this.handlePassword();
}
@jakebellacera
jakebellacera / content-formatting.css
Created August 17, 2011 00:16
CMS Content Formatting
/**
* Content Formatting
* ==================
* Sensible formatting for formatted content.
* gist: http://gist.github.com/1150500
*/
/* Setting a default font */
.content { font: 13px/1.5em sans-serif; }
@jakebellacera
jakebellacera / slideshow.js
Created August 30, 2011 17:58
Slideshows for g(c)
/* Replace the below element with the Slideshow */
var $slideshow = $('#banner').html('');
/* Pull in the JSON feed, place into divs */
$(window).load(function() {
$.ajax({
url : '/api/json/features/HOME_SLIDESHOW',
dataType : 'json',
success : function(data) {
@jakebellacera
jakebellacera / .osx
Created October 2, 2011 04:24
MY .osx
###
# Save this file, make it executable and then run it.
###
# Enable full keyboard access for all controls (e.g. enable Tab in modal dialogs)
defaults write NSGlobalDomain AppleKeyboardUIMode -int 3
# Enable subpixel font rendering on non-Apple LCDs
defaults write NSGlobalDomain AppleFontSmoothing -int 2
@jakebellacera
jakebellacera / gist:1527062
Created December 28, 2011 08:10
validation.js
// http://docs.jquery.com/Plugins/Validation/Methods/email
email: function(value, element) {
// contributed by Scott Gonzalez: http://projects.scottsplayground.com/email_address_validation/
return this.optional(element) || /^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-
@jakebellacera
jakebellacera / parameterize.js
Created January 2, 2012 10:48
Parameterizes a string
function parameterize(value) {
// A simple function that parameterizes a string.
// Example: "This is a title" == "this-is-a-title"
if (typeof value === 'string' || value) {
var output = value.replace(/[^a-zA-Z0-9\s]/g,"");
output = output.toLowerCase();
return output.replace(/\s/g,'-');
} else {
return false;
@jakebellacera
jakebellacera / http-auth-basic.md
Created January 9, 2012 21:18
How to secure a folder with Basic HTTP Authentication

Basic HTTP Authentication is when a user is required to log in to access a directory. This isn't meant to be secure by any means, but it's useful for locking out a majority of users from accessing a folder (e.g. staging a website).

To start, you must add this into your .htaccess:

AuthUserFile "/var/www/full/path/to/your/folder/.htpasswd"
AuthName "Message to go on user's login screen"
AuthType Basic
Allow from all
Require valid-user

Options +Indexes

@jakebellacera
jakebellacera / rvm_ruby
Created January 17, 2012 23:00
Build in Sublime Text 2 with your RVM ruby. mv to ~/bin && chmod +x (with custom gemset features)
#!/usr/bin/env ruby
file = File.expand_path(ARGV[0] || (STDERR.puts('you must specify a ruby file'); exit(-1)))
# Run in RVM
exec("[[ -s \"$HOME/.rvm/scripts/rvm\" ]] && source \"$HOME/.rvm/scripts/rvm\" && rvm use YOUR_RUBY@YOUR_GEMSET && ruby #{file}")
# ends here
@jakebellacera
jakebellacera / content-formatting.scss
Created February 20, 2012 21:39
Basic content formatting -- IN SASS!
#container .content {
&, p, ul, ol, li, blockquote { font: 13px/1.5em $bodyFontFamily; }
ul, ol {
padding: 0.5em 0 0.5em 2em;
margin-left: 1em;
& + p:first-of-type { padding-top: 0.5em; }
li {
............................................________
....................................,.-'"...................``~.,
.............................,.-"..................................."-.,
.........................,/...............................................":,
.....................,?......................................................,
.................../...........................................................,}
................./......................................................,:`^`..}
.............../...................................................,:"........./
..............?.....__.........................................:`.........../
............./__.(....."~-,_..............................,:`........../