Skip to content

Instantly share code, notes, and snippets.

View rickycheers's full-sized avatar

Ricardo rickycheers

  • BoldBrush Inc.
  • San Antonio
  • 00:51 (UTC -05:00)
View GitHub Profile
@rickycheers
rickycheers / ucwords.js
Created January 15, 2013 19:45
ucwords in JavaScript - Equivalent to PHP's ucwords() Returns a string with the first letter in upper case of each word.
String.prototype.ucwords = function() {
str = this.toLowerCase();
return str.replace(/(^([a-zA-Z\p{M}]))|([ -][a-zA-Z\p{M}])/g,
function(s){
return s.toUpperCase();
});
};
@rickycheers
rickycheers / unstoppable_app.js
Last active December 10, 2015 10:43
Backbone App - Unstoppable Templates Controller
(function($){
$(function(){
//$('.box-content').hide();
var AppRouter = Backbone.Router.extend({
routes: {
//"section/:s": "goToSection",
@rickycheers
rickycheers / minimum_amount_2d_forms.js
Created November 27, 2012 23:55
Minimum Amount 2D Forms
// copy and paste this code into your page source inside <script></script> tags
(function($){
$(document).ready(attachEvent);
function attachEvent(){
minimum_amount = 1; //update this
$form = $('form#commerce_3'); //update this
$overlay = $('#overlay');
$processing = $('#processing');
$custom_radio_button = $('#frmItem_130_347'); //update this
$custom_donation_input = $('#donation_value_103_347') //update this
@rickycheers
rickycheers / CurrencyFormatter.js
Created August 14, 2012 22:58
A couple of functions to apply currency format to an amount number in javascript
function applyFormat(value){
value = typeof value == 'number' ? value.toString() : value;
value = value.replace(/\$|\,/g, '');
if( isNaN(value) ){
return '$X,XXX';
}
var integer = value.split('.')[0];
@rickycheers
rickycheers / index.html
Created January 19, 2012 19:06
A very lightweight "Show/Hide" carousel in jQuery
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script src="showhide.js"></script>
<link rel="stylesheet" href="style.css" />
<title>Show Hide Snippet</title>
</head>
<body>
<div id="showhide_container">
<div class="showhide_element">Element #1</div>