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
func Merge2Channels(fn func(int) int, in1 <-chan int, in2 <-chan int, out chan<- int, m int) { | |
var wg sync.WaitGroup | |
wg.Add(1) | |
res := make([]int, m*2) | |
n := 0 | |
go func() { | |
defer wg.Done() | |
for i := 0; i < m; i++ { | |
v1 := <-in1 | |
v2 := <-in2 |
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
$a = [ | |
[1, 2, 3, 4], | |
[14, 15, 16, 5], | |
[13, 20, 17, 6], | |
[12, 19, 18, 7], | |
[11, 10, 9, 8] | |
]; | |
$r1 = rand(0, 7); | |
$r2 = rand(0, 7); |
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
var n, al = ['A', 'B', 'C', 'D'], r = ['', '', ''], linesCount = 100; | |
for (var i = 0; i < linesCount; i++) { | |
n = i; | |
r = ['', '', '',]; | |
for (var j = r.length - 1; j >= 0; j--) { | |
r[j] = al[n % al.length]; | |
n = Math.floor(n / al.length); | |
} | |
console.log(r); |
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
<html> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> | |
<title>Grid to Tree Drag and Drop Example</title> | |
<link rel="stylesheet" type="text/css" href="../../resources/css/ext-all.css" /> | |
<link rel="stylesheet" type="text/css" href="../shared/example.css" /> | |
<script type="text/javascript" src="../../bootstrap.js"></script> | |
<script type="text/javascript" src="../shared/examples.js"></script> |
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
54044 | |
14108 | |
79294 | |
29649 | |
25260 | |
60660 | |
2995 | |
53777 | |
49689 | |
9083 |
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
<pre> | |
<?php | |
abstract class Controller { | |
protected $_data = array(); | |
protected $_chain = null; | |
public function __construct(array $data = array()) { | |
$this->_data = $data; |
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 | |
// KNAPSACK BALANCER! | |
class Balancer | |
{ | |
public static function balance($items, $key) | |
{ | |
$result = array(); | |
$maxWeight = floor(self::sum($items, $key) / 2); |