JS Capitalize a String

Just a simple String prototype to capitalize the first letter of the string.

 

Convert Form to JS Object

Every have a form you get the data from so you can manipulate it in JS? Good news! Dave over at Stack Overflow has the function for you!

Usage is as simple as:

var formObject= $(‘form’).serializeObject();
Requires jQuery

Javascript Local and Cookie Storage

Just a couple functions to make working with Local Storage and Cookies a little easier.

 

Javascript Sorting, Summing, and Rounding

I was running into an instance where I needed to be able to sort some arrays in either ASC or DESC order. I found some nice functions to help with that.

Example Usage:

 

Calculate Age / Date Masking

Javascript is kind of wonky about their dates. Here is a simple function to calculate age based on a given date string.

Note: This is not perfect and does not work with every possible date string, but it works pretty well with all standard US date formats.

Here is some decent code to setup some simple date masking.

 

Force Same Height on All Slick Slides

I love the slick slider,┬ábut sometimes the default functionality isn’t quite what I need. For a variety of other reasons the height of the slides can vary from slide to slide There is no built in “force height” option. Although it should be possible using “display: flex”, I try to avoid using flex on dynamic or complex elements that are hard to fail gracefully on.

I found some good code on the forums to force the slick slides to share the same height. I hope it helps you in the future too!