Posts

Structure for Javascript Development

Image
It is not a core developer stuff to read, for designers !! Whenever i start client side javascript programming, used to struggle where to start from start i. So, my designer 'mind found' this snippet, useful to start. Happy coding! var ProjectName = function() { var fnNameA = function() { console.log("fnNameA called")}; var fnNameB = function() { console.log("fnNameB called")}; return { init: function() { // init table, chart fnNameA(); fnNameB(); } }; }(); function FnNameC (){console.log("fnNameC called")}; jQuery(document).ready(function() { ProjectName.init(); // function that need to initialise on start FnNameC(); });

Disable button in Twitter's Bootstrap

$ ( 'button' ). addClass ( 'disabled' ); // Disables visually $ ( 'button' ). prop ( 'disabled' , true ); // Disables visually + functionally $ ( 'input[type=button]' ). addClass ( 'disabled' ); // Disables visually $ ( 'input[type=button]' ). prop ( 'disabled' , true ); // Disables visually + functionally $ ( 'a' ). addClass ( 'disabled' ); // Disables visually $ ( 'a' ). prop ( 'disabled' , true ); // Does nothing   $ ( 'a' ). attr ( 'disabled' , 'disabled' ); // Disables visually

REST / AJAX calls from within a Jaggery script

Image
<% var mySecureToken = FnMakeRequestCall("https://10.299.99.99:8245/token","POST","Basic RlN4S2RrZEpNN3VaYWhHN0NFcEtlaTZEa3RzYTpXbmUxd29seHp2UTNSQ2RZbXhUUTJ2WkJTd0Fh","application/x-www-form-urlencoded; charset=UTF-8",""application/json; charset=utf-8","grant_type=password&username=pcsadmin&password=pcsadmin");  print(mySecureToken); function FnMakeRequestCall(URL, METHOD, BASICAUTH, CONTENTTYPE, ACCEPTTYPE, INPUTDATA){ if(BASICAUTH){ //var VarBasicAuthCode = util.FnCreateBasicAuthentication(VARSKYSPARKUSERNAME,VARSKYSPARKPASSWORD); var VarBasicAuthCode = session.get('authToken'); } xhr = new XMLHttpRequest(); xhr.open(METHOD, URL); if(BASICAUTH){ xhr.setRequestHeader("Authorization" , VarBasicAuthCode); } xhr.setRequestHeader("Content-Type", CONTENTTYPE); xhr.setRequestHeader("Accept", ACCEPTTYPE); xhr.send(INPUTDATA); var VarRes...

Should You Use the ‘var $this = $(this);’ Syntax in jQuery?

A common jQuery coding practice  var $this = $(this);  There are a few benefits:   $(this) is only evaluated once (minor efficiency)  You can use a more descriptive name for $(this). I’m using var $MyCurrentBook = $(this);  By preceding the variable name with the $ sign, you’re reminding yourself that it’s a jQuery variable, not just a plain old JavaScript variable.

A few things to consider before booking a flight

Image
With fuel costs rising and airlines finding more fees to impose on travelers every day, airfare isn’t getting any cheaper. Since you can’t drive to all your dream destinations, flying is the only way to go sometimes and, undeniably, the fastest. Luckily, there are plenty of ways to find the most affordable fares and also avoid paying as many extra charges as possible when you plan ahead.   Getting the best fare Airlines put out their fare sales on Tuesday morning , making this day the best day to book a flight for less.   Fly during the least popular times . Tuesday, Wednesday and Saturday are the slowest days to fly, which means cheaper deals than the rest of the week. You can also find reduced rates on early morning flights, since many people don’t like to get up before the sun to get to the airport. Earlier boarding times can also considerably cut down your chances of getting bumped on an overbooked flight or delayed becaus...

select HTML tag in cross browser

Here is the beginning of my post. .risk-issue-search select { border: 0 !important; /*Removes border*/ width: 83%; /*font-family: 'SegoeUILight'; font-family: 'SegoeUISemibold'; */ font-size: 13px; color: #565a5c; /*background-color:#e6e6e6;*/ background: #e6e6e6 url("../images/select-downarrow.png") no-repeat center left 96.5% ; padding-right:18px !important; -webkit-appearance: none; /* Removes default chrome and safari style*/ -webkit-appearance: menulist-button; -moz-appearance: none ; /* Removes Default Firefox style*/ text-indent: 0.01px; /* Removes default arrow from firefox*/ -o-appearance:none; text-overflow: ""; text-transform: capitalize; padding: 3px 0 3px 8px; font-weight:600; font-weight: normal; /*font-variant:normal; font-size-adjust:none;*/ background-color: #E6E6E6; }

Shapingup Angularjs - Level -1

Image
Angular JS