This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //substring(from, to) | |
| var text="excellent" | |
| text.substring(0,4) //returns "exce" | |
| text.substring(2,4) //returns "ce" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //substring(from, [to]) | |
| var myString = 'javascript rox'; | |
| myString = myString.substring(0,10); | |
| console.log(myString) | |
| //output: javascript |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //toUpperCase() | |
| var myString = 'javascript rox'; | |
| myString = myString.toUpperCase(); | |
| console.log(myString) | |
| //output: JAVASCRIPT ROX |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var myarray = []; | |
| var myJSON = ""; | |
| $.each(data.data,function(i,val) { | |
| var item = { | |
| "name": val.name, | |
| "facebookId": val.id, | |
| "picture": val.picture.data.url | |
| }; | |
| myarray.push(item); | |
| }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ;q = { | |
| w : 'www', | |
| myFunction: function() | |
| { | |
| var a = arguments[0] || "q"; | |
| // alert('running MYNAMESPACE.myFunction...'+a+q.w); | |
| } | |
| } | |
| q.myFunction(); //function call |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function debug(text) { | |
| if (window.console && window.console.log) { | |
| window.console.log(text); | |
| } | |
| if (window.opera) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $.extend({ | |
| debug:function(text, dir){ | |
| var dir = dir || false; | |
| if (window.console && window.console.log) { | |
| (dir === true && window.console.dir) ? window.console.dir(text) : window.console.log(text); | |
| } | |
| } | |
| }) | |
| // $.debug('console.log test'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $(document).ready(function(){ | |
| $('div').bind('scroll',chk_scroll); | |
| }); | |
| function chk_scroll(e) | |
| { | |
| var elem = $(e.currentTarget); | |
| if (elem[0].scrollHeight - elem.scrollTop() == elem.outerHeight()) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function hex2rgb( $colour ) { | |
| if ( $colour[0] == '#' ) { | |
| $colour = substr( $colour, 1 ); | |
| } | |
| if ( strlen( $colour ) == 6 ) { | |
| list( $r, $g, $b ) = array( $colour[0] . $colour[1], $colour[2] . $colour[3], $colour[4] . $colour[5] ); | |
| } elseif ( strlen( $colour ) == 3 ) { | |
| list( $r, $g, $b ) = array( $colour[0] . $colour[0], $colour[1] . $colour[1], $colour[2] . $colour[2] ); | |
| } else { | |
| return false; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var OnBeforeUnload = (function(){ | |
| var | |
| FDUM = new Function, | |
| AFFIRM = function(){ return true; }; | |
| var _reg = function(msg,opts){ | |
| opts = opts || {}; | |
| var |