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
[alias] | |
# add task | |
a = "!f() { \ | |
if [[ -f .dummy ]]; then \ | |
git rm -f .dummy; \ | |
else \ | |
touch .dummy; \ | |
git add .dummy; \ | |
fi; \ |
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
/** | |
* @author Vidul Nikolaev Petrov | |
* @summary helper methods for PKI / AES usage, based on the JS Forge crypto library. | |
*/ | |
function s8Crypto(bits) { | |
var hexToBytes = forge.util.hexToBytes, | |
bytesToHex = forge.util.bytesToHex; | |
this.pki = {}; |
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
/** | |
* Longest Common Substring in JavaScript | |
* | |
* This is the brute-force solution. | |
* | |
* @param {String} s1 | |
* @param {String} s2 | |
* @return {String} r1 | |
*/ |
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 bubbleSort(array) { | |
var swapped; | |
for (var i = 0; i < array.length - 1; i++) { | |
if (array[i] > array[i + 1]) { | |
var tmp = array[i + 1]; | |
array[i + 1] = array[i]; | |
array[i] = tmp; | |
swapped = true; | |
} |
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
/** | |
* Soundex in JavaScript | |
* | |
* @example | |
* // returns 'H416' | |
* soundex('Heilbronn'); | |
* | |
* @example | |
* // returns 'L222' | |
* soundex('Lissajous'); |
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 insertionSort(list) { | |
for (var g = 0; g < list.length; g++) { | |
for (var i = list.length - 1; i > g; i--) { | |
if (list[i] < list[i - 1]) { | |
var tmp = list[i]; | |
list[i] = list[i - 1]; | |
list[i - 1] = tmp; | |
} | |
} | |
} |
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 quickSort(list) { | |
if (!list.length) return []; | |
var left = [], | |
right = [], | |
center = list[0]; | |
for (var i = 1; i < list.length; i++) { | |
if (list[i] < center) { | |
left.push(list[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
/** | |
* Thst is not the optimal formula, don't use it. | |
* This is just another solution for the algorithm | |
* Tower of Hanoi. | |
*/ | |
if (Array.prototype.last === undefined) { | |
Array.prototype.last = function () { | |
return this.length ? this[this.length - 1] : 0; | |
}; |
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
/** | |
* Check for arbitrage bet. | |
* | |
* @class Arbitrage | |
*/ | |
var Arbitrage = Arbitrage || {}; | |
var args = []; |
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
use strict; | |
use warnings; | |
use File::Basename; | |
list_direcrory(shift, 1); | |
sub list_direcrory { | |
my ($root, $c) = @_; |