This file contains 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
/** | |
* Bind com let i = 0 | |
* Bind com let i = 1 | |
* Bind com let i = 2 | |
* Bind com let i = 3 | |
* Bind com let i = 4 | |
*/ | |
for(let i = 0; i < 5; i++) { | |
setTimeout(function(){ | |
console.log('Bind com let i = '.concat(i)); |
This file contains 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 | |
define("STOP_WORDS", ["the","of","in","and","a","to","on","by","when","or","with","that","this","also","from","an","it","as","these","."]); | |
function iteratesWords($lineA, $lineB) { | |
$wordsA = preg_split("/[\s\.\,\?\;\(\)\-\%\{\}]/", $lineA); | |
$wordsB = preg_split("/[\s\.\,\?\;\(\)\-\%\{\}]/", $lineB); | |
$words = []; | |
foreach($wordsA as $wordA) { | |
foreach($wordsB as $wordB) { |
This file contains 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 border(matrix, row, col, len) { | |
var items=[]; | |
var endCol = col - 1; | |
var endRow = row; | |
//top | |
for(;col < len; col++) { | |
items.push(matrix[row][col]); |
This file contains 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 CloneTest() { | |
const factory = (function () { | |
let factory = { | |
createShallow: function() { | |
return Object.create({ | |
p1: "", | |
p2: "", | |
deepProperty: factory.createDeep(), |
This file contains 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 | |
class ParentClass { | |
private $descendant; | |
public function setDescendant($descendant) { | |
$this->descendant = $descendant; | |
return $this; | |
} | |
public function showDescendantValue() { |
This file contains 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 chain(c, v, f) { | |
if (arguments.length < 3) { | |
f = v; v = c; c = null; | |
} | |
var result = f.call(null, c, v); | |
return { | |
chain: chain.bind(null, result), | |
result: result | |
} | |
} |
This file contains 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 | |
$init = microtime(true); | |
$filePath = $argv[1]; | |
$fileHandler = fopen($filePath, 'r'); | |
$lineNumber = 0; | |
while (($lineString = fgets($fileHandler)) !== false) { | |
$parameters = [$lineString, $lineNumber]; | |
$pdo = new PDO("mysql:dbname=hello_streams", "root"); | |
$statement = $pdo->prepare("INSERT INTO files_line(line_string, line_number) VALUES (?,?)"); |
This file contains 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 | |
use parallel\{Runtime, Channel}; | |
main($argv); | |
function main(array $argv) | |
{ | |
if (count($argv) !== 3) { | |
echo "Type: hello-parallel.php <number-of-tasks> <maximum-time-of-sleep (in seconds)>" . PHP_EOL; |
This file contains 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
version: '2.2' | |
services: | |
es01: | |
image: docker.elastic.co/elasticsearch/elasticsearch:7.6.2 | |
container_name: es01 | |
environment: | |
- node.name=es01 | |
- cluster.name=es-docker-cluster | |
- discovery.seed_hosts=es02 |
This file contains 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 f1(next) { | |
setTimeout(function() { | |
console.log("1"); | |
next.dequeue(); | |
}, 500); | |
} | |
function f2(next) { | |
setTimeout(function() { | |
console.log("2"); |
OlderNewer