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 decimalToBinary(decNumber) { | |
| const remStack = new Stack(); | |
| let number = decNumber; | |
| let rem; | |
| let binaryString = ''; | |
| while (number > 0) { | |
| rem = Math.floor(number % 2); | |
| remStack.push(rem); | |
| number = Math.floor(number / 2); |
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
| class Stack { | |
| constructor() { | |
| this.items = []; | |
| } | |
| // Methods | |
| push(element) { | |
| this.items.push(element); | |
| } | |
| pop() { | |
| return this.items.pop(); |
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
| let f64 = new Float64Array(8); | |
| // Output | |
| // Float64Array(8) [0, 0, 0, 0, 0, 0, 0, 0] | |
| f64[4] = 30; | |
| // Output | |
| // Float64Array(8) [0, 0, 0, 0, 30, 0, 0, 0] | |
| f64[9] = 30; | |
| // Output |
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
| // Creating a multi-dimensional array | |
| const gradeMatrix3x3 = []; | |
| for (let i = 0; i < 3; i++) { | |
| gradeMatrix3x3[i] = []; | |
| for (let j = 0; j < 3; j++) { | |
| gradeMatrix3x3[i][j] = []; | |
| for (let z = 0; z < 3; z++) { | |
| gradeMatrix3x3[i][j][z] = i + j + z; | |
| } |
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
| // One-dimensional arrays | |
| groupOneGrades = [67, 87, 56, 98, 87, 67, 87, 78]; | |
| groupTwoGrades = [65, 76, 82, 85, 76, 78, 79, 80]; | |
| // Creating a two-dimensional array | |
| let grades = []; | |
| grades[0] = [67, 87, 56, 98, 87, 67, 87, 78]; | |
| grades[1] = [65, 76, 82, 85, 76, 78, 79, 80]; |
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
| <meta property="og:url" content="http://www.nytimes.com/2015/02/19/arts/international/when-great-minds-dont-think-alike.html" /> | |
| <meta property="og:type" content="article" /> | |
| <meta property="og:title" content="When Great Minds Don’t Think Alike" /> | |
| <meta property="og:description" content="How much does culture influence creative thinking?" /> | |
| <meta property="og:image" content="http://static01.nyt.com/images/2015/02/19/arts/international/19iht-btnumbers19A/19iht-btnumbers19A-facebookJumbo-v2.jpg" /> |
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
| // Opera 8.0+ | |
| var isOpera = (!!window.opr && !!opr.addons) || !!window.opera || navigator.userAgent.indexOf(' OPR/') >= 0; | |
| // Firefox 1.0+ | |
| var isFirefox = typeof InstallTrigger !== 'undefined'; | |
| // Safari 3.0+ "[object HTMLElementConstructor]" | |
| var isSafari = /constructor/i.test(window.HTMLElement) || (function (p) { return p.toString() === "[object SafariRemoteNotification]"; })(!window['safari'] || safari.pushNotification); | |
| // Internet Explorer 6-11 |
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
| ****** Run from inside './mongo/bin' ******* | |
| ./mongod --dbpath ~/mongo-data | |
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
| // Make a copy of the CPT archive and rename it 'home.php', then add this to 'functions.php' | |
| function wpsites_home_page_cpt_filter($query) { | |
| if ( !is_admin() && $query->is_main_query() && is_home() ) { | |
| $query->set('post_type', array( 'CPT NAME HERE' ) ); | |
| } | |
| } | |
| add_action('pre_get_posts','wpsites_home_page_cpt_filter'); |
NewerOlder