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
<?php | |
/** | |
* Created by PhpStorm. | |
* User: adriano | |
* Date: 09/11/19 | |
* Time: 13:18 | |
*/ | |
class Node { |
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
<?php | |
/** | |
* Created by PhpStorm. | |
* User: adriano | |
* Date: 09/11/19 | |
* Time: 13:18 | |
*/ | |
class Node { |
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
<?php | |
/** | |
* Created by PhpStorm. | |
* User: adriano | |
* Date: 09/11/19 | |
* Time: 13:18 | |
*/ | |
class Node { |
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
<?php | |
/** | |
* Created by PhpStorm. | |
* User: adriano | |
* Date: 08/11/19 | |
* Time: 14:30 | |
*/ | |
class Edge { |
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 isProperSubTree( b1, b2, found = false ) { | |
if ( found ) { | |
return found; | |
} | |
if( b2.value === b1.value && b2.left === b1.left && b2.right === b1.right ) { | |
found = true; | |
} | |
if(typeof b1.right === 'object') { |
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 BST( value ) { | |
this.left = null; | |
this.right = null; | |
this.value = value; | |
} | |
BST.prototype.insertNode = function( value ) { | |
if ( value < this.value ) { | |
if ( !this.left ) { | |
this.left = new BST( value ); |
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 LinkedList() { | |
this.head = null; | |
this.tail = null; | |
} | |
function Node( prev, next, value ) { | |
this.prev = prev; | |
this.next = next; | |
this.value = value; | |
} |
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
<?php | |
/** | |
* This code retrieves course data from an external API and displays it in the user's | |
* My Account area. A merchant has noticed that there's a delay when loading the page. | |
* 1) What changes would you suggest to reduce or remove that delay? | |
* 2) Is there any other code changes that you would make? | |
*/ | |
public function add_my_courses_section() { | |
$api_user_id = get_user_meta( get_current_user_id(), '_external_api_user_id', true ); |
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 request = require('request'); | |
var async = require('async'); | |
var q = async.queue(function(task, callback){ | |
request('http://site.com/?page=' + task.index, function( err, res, body ) { | |
console.log('Finalizado ' + i); | |
callback(); | |
}); | |
}, 1); |
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 request = require('request'); | |
var theRequest = function(i){ | |
request('http://site.com/?page=' + i, function( err, res, body ) { | |
console.log('Finalizado ' + i); | |
}); | |
} | |
for (var i = 0; i <= 1000; i++) { | |
theRequest(i); |