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 sum(arr) { | |
return arr.reduce((sum, n) => sum + n, 0); | |
} | |
function answer(initArea) { | |
var list = []; | |
var area = initArea; | |
var i = 1; |
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 equals(arr1, arr2) { | |
return JSON.stringify(arr1) === JSON.stringify(arr2); | |
} | |
function flatten(arr) { | |
return arr.reduce((result, toFlatten) => { | |
return result.concat(Array.isArray(toFlatten) ? flatten(toFlatten) : toFlatten); | |
}, []); | |
} |
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
window.getByXpath = function() {}; | |
document.getByXpath = function() {}; | |
getByXpath = function() {}; | |
alert(123); | |
alert(typeof getByXpath); |
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 e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var c="function"==typeof require&&require;if(!u&&c)return c(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var a=n[o]={exports:{}};t[o][0].call(a.exports,function(n){var r=t[o][1][n];return s(r?r:n)},a,a.exports,e,t,n,r)}return n[o].exports}for(var i="function"==typeof require&&require,o=0;o<r.length;o++)s(r[o]);return s}({1:[function(t,n,r){(function(n){"use strict";function define(t,n,e){t[n]||Object[r](t,n,{writable:!0,configurable:!0,value:e})}if(t(295),t(296),t(2),n._babelPolyfill)throw new Error("only one instance of babel-polyfill is allowed");n._babelPolyfill=!0;var r="defineProperty";define(String.prototype,"padLeft","".padStart),define(String.prototype,"padRight","".padEnd),"pop,reverse,shift,keys,values,entries,indexOf,every,some,forEach,map,filter,find,findIndex,includes,join,slice,concat,push,splice,unshift,sort,lastIndexOf,reduce,reduceRight,copyWithin,fill".split(",").forEach(functi |
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
Set WshShell = WScript.CreateObject("WScript.Shell") | |
WshShell.Run """%PROGRAMFILES(x86)%\Cisco\Cisco AnyConnect Secure Mobility Client\vpnui.exe""" | |
WScript.Sleep 1500 | |
WshShell.AppActivate "Cisco AnyConnect Secure Mobility Client" | |
WshShell.SendKeys "{TAB}" | |
WshShell.SendKeys "{TAB}" |
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
Array.prototype.chunk = function(len) { | |
var chunks = []; | |
for (var i = 0, l = this.length; i < l; i += len) { | |
chunks.push(this.slice(i, i + len)); | |
} | |
return chunks; | |
}; |
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
'strict mode'; | |
/** | |
* > You choose programming language, any external libraries | |
* > and strategi for implementation. | |
* > You should build a solution from scratch. | |
* | |
* I chose Javascript that work on a server (NodeJS) | |
*/ |
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 array = [1, 2, 3, 4, 5, 6]; | |
Array.prototype.shuffle = function() { | |
var i = this.length, | |
tmp, | |
randIndex; | |
while (--i) { | |
randIndex = Math.floor(i * Math.random()); | |
tmp = this[i]; | |
this[i] = this[randIndex]; |
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 Tickets = function(maxLen){ | |
if (maxLen % 2) { | |
throw Error('Max length must be even: 2, 4, 6, ...'); | |
} | |
this.maxLen = parseInt((new Array(maxLen / 2 + 1)).join(9)); | |
}; | |
Tickets.prototype.count = function(num, undefined){ | |
var digits = {}, | |
i, | |
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 array_reverse($arr) { | |
$length = count($arr); | |
for ($i=0; $i < $length/2; $i++) { | |
$tmp = $arr[$i]; | |
$arr[$i] = $arr[$length - 1 - $i]; | |
$arr[$length - 1 - $i] = $tmp; | |
} | |
} | |
var_dump(array_reverse([1,2,3,4,5])) |
NewerOlder