JSFiddle

  • Pig Words

    No-Library (pure JS), HTML, CSS, JavaScript

    // Move the first letter of each word to the end of it, then add 'ay' to the end of the ...
  • Danibyay-feedback

    Some quick feedback

    /**
     * Try to avoid magic numbers (hardcoded values),
     * use some variables or consts instead.
     */
    
    
    function openOrSenior(data){
      var MIN_AGE = 54;
      var ...
  • Bind function

    No-Library (pure JS), HTML, CSS, JavaScript

    if (typeof Function.prototype.bind !== 'function') {
      Function.prototype.bind = function (bind) {
        var self = this;
        return function () {
          var args = Array.prototype ...
  • Milliseconds to time #45 is the latest revision

    Converts milliseconds to hour:minutes:seconds

    (function () {
        $('#convertBtn').click(function () {
           var ms = $('#ms').val();
           var time = msToTime(ms);
            
            $('#result').html('Result: ' + time);
        });
        
        function msToTime (ms) {
            var ...
  • Decoupling Glyphs #5 is the latest revision

    Shows how to decouple glyphs from code + Example of how to use objects as dictionaries in javascript

    Ext.define('ExampleApp.view.MyView', {
    	extend: 'Ext.panel.Panel',
    	alias: 'widget.myView',
    	width: 200,
    	height: 100,
    
    	initComponent: function () {
    		Ext.setGlyphFontFamily ...
  • Example usage of Callback Manager

    Example of how and when to use the callback manager, using ExtJs 4 in a contorller

    /** 
     * Some sample controller
     * that always calls a function when loading a store,
     * and calls another depending if a window is ...
  • Dynamic Callback Manager

    Class to manage multiple & dynamic callbacks for a single event.

    /**
     * Callback Manager
     */
    function CallbackManager () {
    	var me = this,
    		items = {},    // Store callback functions
    		itemCount = 0; 	// Count the callbacks
    
    	/**
    	 * Add a new callback ...
  • Custom button text in message box #25 is the latest revision

    Custom button text in messagebox component of ExtJs 4

    /**
     * Eg. MessageBox with three default buttons.
     */
    Ext.Msg.show({
        title:'Caution',
        msg: 'Display your message here!',
        buttons: Ext.Msg.YESNOCANCEL ...
  • Js execution time #55 is the latest revision

    Demonstrates how to measure execution times in javascript code

    (function (undefined) {
        var firstArray = [],        // Helper arrays
            secondArray = [],
            arraySize = 1000000,
            endTime,
            startTime = new Date().getTime();  // Time in milliseconds
        
        /** Create dummy array ...