Skip to main content

Posts

A javascript library for formatting and manipulating numbers.

Numeral.js , while less complex, was inspired by and heavily borrowed from  Moment.js  so if you have use momentjs before you should be familiar with this library. Numbers can be formatted to look like currency, percentages and more. How to use: numeral(1000).format('0,0') returns 1,000 numeral(1230974).format('0.0a') returns 1.2m numeral(1000.234).format('$0,0.00') returns $1,000.23 numeral(1230974).format('($ 0.00 a)') returns $ 1.23 m numeral(1).format('0%') returns 100% numeral(0.974878234).format('0.000%') returns 97.488% For more sample and options go to  http://numeraljs.com/ .
Recent posts

Button click always fires when you press enter key

I've spent hours trying to figure this out, but the solution is just adding the type="button" attribute to the button element. Issue. <button id="generateButton" class="btn btn-info btn-sm">Generate</button> Solution <button id="generateButton" type="button" class="btn btn-info btn-sm">Generate</button> I got the solution from this post on SOF. http://stackoverflow.com/questions/12325066/button-click-event-fires-when-pressing-enter-key-in-different-input-no-forms

Introducing the YouTube Kids app

Countries outside of the US have kids too,  Please Google I need this in Philippines App Store like last February 2015. :)

Turn checkboxes and radio buttons in toggle switches

http://www.bootstrap-switch.org/

jQuery BBQ: Back Button & Query Library

jQuery BBQ leverages the HTML5 hashchange event to allow simple, yet powerful bookmarkable #hash history. In addition, jQuery BBQ provides a full .deparam() method, along with both hash state management, and fragment / query string parse and merge utility methods. http://benalman.com/projects/jquery-bbq-plugin/

Format date and time using Moment.js

The javascript function below will format a given datetime object like facebook ish using momentjs . function formatDateTime(dte, format) {     var diff = moment().diff(moment(dte), 'days');     if (diff == 0) {         return moment(dte).fromNow();     }     else if (diff == 1) {         return moment(dte).calendar();     }     else {         if (format) {             return moment(dte).format(format);         }         else {             return moment(dte).format("MMM DD, YYYY hA");         }     } } The return value will depend on the datetime pass to the function: If today "a few seconds ago" or "13 minutes" ago or "an hour ago" If yesterday "Yesterday at 5:15 PM" If the second parameter is pass it will use it ...

HowTo: Convert a given number into its ordinal value in VB.NET

Found this code from  stackoverflow  and made some small change to it,  this will convert any given number to its ordinal value. Example: Convert(1) will return 1st Convert(11) will return 11th Convert(12) will return 12th Convert(23) will return 23rd Public Function Convert(ByVal number As Integer) As String         Dim ones As Integer = number Mod 10         Dim tens As Integer = Math.Floor(number / 10) / 10         If (number > 10 And number < 14) Then             Return number.ToString() & "th"         Else             Select Case ones                 Case 1                     Return number.ToString() & "st"                 Case 2             ...