query stringlengths 9 14.6k | document stringlengths 8 5.39M | metadata dict | negatives listlengths 0 30 | negative_scores listlengths 0 30 | document_score stringlengths 5 10 | document_rank stringclasses 2
values |
|---|---|---|---|---|---|---|
Converts the given byte array to a number. Cannot parse a number larger than u64, specifically, 2531 (javascripts max number). | function toNumber(bytes, le) {
if (le === void 0) { le = false; }
if (bytes.length > 8) {
throw new Error('Cannot parse a number greater than u64');
}
var b = toHex(bytes).substr(2);
if (le) {
var match = b.match(/../g);
if (match !== null) {
b = match.re... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function toNumber$1(bytes, le) {\r\n if (le === void 0) { le = false; }\r\n if (bytes.length > 8) {\r\n throw new Error('Cannot parse a number greater than u64');\r\n }\r\n var b = toHex$1(bytes).substr(2);\r\n if (le) {\r\n var match = b.match(/../g);\r\n if (match !== null) {\... | [
"0.80058837",
"0.6603705",
"0.63806605",
"0.6278937",
"0.62398875",
"0.62310225",
"0.61565584",
"0.612225",
"0.6120762",
"0.6120762",
"0.60446703",
"0.6010372",
"0.5995689",
"0.59855056",
"0.5893621",
"0.58160657",
"0.58160657",
"0.57996345",
"0.5787218",
"0.5784967",
"0.5784... | 0.80006206 | 1 |
encodeUtf8 is a string encoding utility for both node and browsers. | function encodeUtf8$1(input) {
var encoder =
// tslint:disable-next-line
typeof TextEncoder === 'undefined'
? // @ts-ignore
new (require('util')).TextEncoder('utf-8') // Node.
: new TextEncoder(); // Browser.
// @ts-ignore
return encoder.encode(input);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function encodeUtf8(input) {\r\n var encoder = \r\n // tslint:disable-next-line\r\n typeof TextEncoder === 'undefined'\r\n ? // @ts-ignore\r\n new (require('util')).TextEncoder('utf-8') // Node.\r\n : new TextEncoder(); // Browser.\r\n // @ts-ignore\r\n return encoder.encode... | [
"0.81378007",
"0.75082266",
"0.7439555",
"0.732438",
"0.7309277",
"0.72420007",
"0.7241518",
"0.7206779",
"0.717517",
"0.7161505",
"0.7157172",
"0.71560544",
"0.71239805",
"0.71200734",
"0.7111206",
"0.710725",
"0.7098971",
"0.70969903",
"0.70896333",
"0.70711404",
"0.7069366... | 0.7907172 | 1 |
Converts the given byte array to a number. Cannot parse a number larger than u64, specifically, 2531 (javascripts max number). | function toNumber$1(bytes, le) {
if (le === void 0) { le = false; }
if (bytes.length > 8) {
throw new Error('Cannot parse a number greater than u64');
}
var b = toHex$1(bytes).substr(2);
if (le) {
var match = b.match(/../g);
if (match !== null) {
b = matc... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function toNumber(bytes, le) {\r\n if (le === void 0) { le = false; }\r\n if (bytes.length > 8) {\r\n throw new Error('Cannot parse a number greater than u64');\r\n }\r\n var b = toHex(bytes).substr(2);\r\n if (le) {\r\n var match = b.match(/../g);\r\n if (match !== null) {\r\n ... | [
"0.80006206",
"0.6603705",
"0.63806605",
"0.6278937",
"0.62398875",
"0.62310225",
"0.61565584",
"0.612225",
"0.6120762",
"0.6120762",
"0.60446703",
"0.6010372",
"0.5995689",
"0.59855056",
"0.5893621",
"0.58160657",
"0.58160657",
"0.57996345",
"0.5787218",
"0.5784967",
"0.5784... | 0.80058837 | 0 |
setGateway sets the default oasis gateway so that all services use it unless explicitly overridden upon construction of the service. | function setGateway(gw) {
_defaultGateway = gw;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function useGatewayAuthentication (req) {\n // can be set on request if via application supplied callback\n if (req.useGateway === true) { return true }\n\n // otherwise via query parameter\n var origUrl = req.originalUrl\n var useGateway = false\n var idx = origUrl.indexOf(gatewayParameter)\n if (idx >= 0)... | [
"0.47567052",
"0.46261448",
"0.45803088",
"0.44964406",
"0.44907585",
"0.44444767",
"0.4440699",
"0.44225377",
"0.43809494",
"0.43579075",
"0.4339729",
"0.43120039",
"0.4292599",
"0.42517853",
"0.42452177",
"0.42415226",
"0.42279956",
"0.42279956",
"0.42097282",
"0.42097282",
... | 0.8142581 | 0 |
The Service constructor to dynamically generate service objects from a given idl. | function Service(idl, address, options) {
// Convert to Uint8Array.
var _address = typeof address === 'string' ? bytes.parseHex(address) : address;
// Fill in any options not provided by the arguments.
options = Service.setupOptions(options);
// Attach the rpcs onto the rpc ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"static createService(obj) {\n return class {\n constructor(config) {\n this.name = obj.name;\n this.run = obj.runService;\n this.config = config || {};\n this.description = obj.description;\n }\n };\n }",
"function... | [
"0.62740856",
"0.6018725",
"0.5726329",
"0.5699538",
"0.55514807",
"0.5522967",
"0.55127835",
"0.55025357",
"0.5491657",
"0.5481307",
"0.54749465",
"0.5449322",
"0.5405352",
"0.5389741",
"0.5389741",
"0.5389378",
"0.53728366",
"0.53260267",
"0.5324387",
"0.53140116",
"0.52436... | 0.68424886 | 0 |
Transforms the given unstructured array of arguments into a DeployOptions type, throwing an error if the arguments are malformed in any way. | function extractOptions(args) {
return __awaiter(this, void 0, void 0, function () {
var options, deployOptions;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
if (args.length === 0) {
throw new Depl... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function toDeployOptions(args, options) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var idl, _a, rpcOptions;\r\n return __generator(this, function (_b) {\r\n switch (_b.label) {\r\n case 0:\r\n _a = options.idl;\r\n ... | [
"0.6510863",
"0.5107129",
"0.5096258",
"0.49805915",
"0.48851255",
"0.47927177",
"0.46580157",
"0.46497422",
"0.46046934",
"0.4582059",
"0.4578389",
"0.45688692",
"0.45021805",
"0.44981986",
"0.44875768",
"0.44869772",
"0.44757023",
"0.4433804",
"0.44150496",
"0.43842635",
"0... | 0.6568076 | 0 |
Fills in any left out deploy options and converts to the required types if necessary. | function toDeployOptions(args, options) {
return __awaiter(this, void 0, void 0, function () {
var idl, _a, rpcOptions;
return __generator(this, function (_b) {
switch (_b.label) {
case 0:
_a = options.idl;
if (_a) return [3 ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"handleArtifactTypes () {\n // If All-Authoring was specified, set all authoring artifact types.\n if (this.getCommandLineOption(\"AllAuthoring\")) {\n this.setCommandLineOption(\"types\", true);\n this.setCommandLineOption(\"presentations\", true);\n this.setCommandLi... | [
"0.5517799",
"0.5211624",
"0.5092748",
"0.49402985",
"0.49302897",
"0.48935324",
"0.48807386",
"0.48466426",
"0.483116",
"0.482892",
"0.4745626",
"0.47376868",
"0.47376868",
"0.47131968",
"0.47089016",
"0.47089016",
"0.47089016",
"0.46791664",
"0.46524706",
"0.4644398",
"0.46... | 0.54994786 | 1 |
Override moveCompleted() because we might need to have another jump so we don't want it to reset everything or check results | moveCompleted() {
// Reset the from so we can
this.from = null;
if (this.gameOver) return;
this.changeTurn();
this.hideMessage();
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"proceedMove() {\n // Proceed move\n this.PENDING.MOVE.forEach(( item ) => {\n this._move(item)\n })\n }",
"transitionCompleted() {\n // implement if needed\n }",
"function letBotMoveProceed(callback) {\n if ((current_turn === tictactoe.first_player) && (player1.type === ... | [
"0.6722354",
"0.6090018",
"0.6069357",
"0.60457474",
"0.6044758",
"0.6037546",
"0.5996357",
"0.59921163",
"0.59896445",
"0.59854656",
"0.5983368",
"0.59746987",
"0.59243256",
"0.5918896",
"0.5905956",
"0.5893947",
"0.5890863",
"0.5871267",
"0.5865655",
"0.58637375",
"0.586329... | 0.7278565 | 0 |
Override highlightMoves() because it needs to highlight capture squares and handle castling highlights too. | highlightMoves(moves) {
// Clear all the highlights
this.clearHighlights();
// Exit if there are no moves available for this square
if (moves.length === 0) return;
// Go through every move
moves.forEach(move => {
// By default we want to highlight the "to" of the move, which would handle... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"highlight_move(args) {\n\n }",
"function highlightSendMoves(data) {\n toHighlight = data.pieces;\n player_id = data.player_id;\n\n if (player_id == saveCurrentState.playerTurn) {\n for (var i = 0; i < toHighlight.length; i++) {\n setHighlight(toHighlight[i], saveCurrentState);\n ... | [
"0.68207127",
"0.6481118",
"0.64145195",
"0.6219345",
"0.6144766",
"0.6109139",
"0.61022186",
"0.60274804",
"0.60171944",
"0.59678525",
"0.59580225",
"0.5880299",
"0.57851505",
"0.5782833",
"0.57774955",
"0.5747743",
"0.56876224",
"0.56431985",
"0.5640688",
"0.56262034",
"0.5... | 0.7903412 | 0 |
Override move() because we have to handle castling ourselves (because we need to be able to castle through what would be check) and for the capturing moves as well. It's a nightmare | move(from, to) {
// Here is a bunch fo castling logic if there's a castling flag...
if (this.currentMove.castlingFlag) {
this.castlingMove(from, to);
}
// If it's a capture, handle our special case
// This won't work for en passant. There are a lot of problems here man.
else if (this.curre... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"move() {\n throw \"Move method not implemented\";\n }",
"move () {\n //console.warn(\"WARNING\" + this + \" : not implemented move method\");\n }",
"move() { }",
"move() { }",
"move() {\n }",
"proceedMove() {\n // Proceed move\n this.PENDING.MOVE.forEach(( item ) => {\n this._move(i... | [
"0.7242072",
"0.7150687",
"0.6992044",
"0.6992044",
"0.676435",
"0.6690604",
"0.6664059",
"0.6636502",
"0.6600966",
"0.6562908",
"0.65200007",
"0.649952",
"0.647788",
"0.64533526",
"0.6422183",
"0.64148206",
"0.6404296",
"0.6398426",
"0.6366787",
"0.63599515",
"0.6333573",
... | 0.84050405 | 0 |
Carry out a castling move manually | castlingMove(from, to) {
// Remember the from piece (it's a king)
let fromPiece = this.game.get(from);
// Remove the king
this.game.remove(from);
// Place the king in the destination square
this.game.put(fromPiece, to);
// Now we need to position the rook correctly
let turn = this.game.t... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"move(from, to) {\n // Here is a bunch fo castling logic if there's a castling flag...\n if (this.currentMove.castlingFlag) {\n this.castlingMove(from, to);\n }\n // If it's a capture, handle our special case\n // This won't work for en passant. There are a lot of problems here man.\n else if... | [
"0.71068573",
"0.650337",
"0.6498234",
"0.6498234",
"0.64943516",
"0.64386034",
"0.63317883",
"0.6292851",
"0.62602234",
"0.6250955",
"0.6223241",
"0.6112603",
"0.6074536",
"0.6030601",
"0.6002377",
"0.6000479",
"0.5995544",
"0.5984604",
"0.59784985",
"0.5960846",
"0.5958564"... | 0.7046949 | 1 |
Carry out a capturing move (manually because of the jumping element as well as the need to then offer further captures if available) | capturingMove(from, to) {
this.handleDisableCastling(from, to);
// console.log("HANDLING CAPTURE MOVE")
let fromPiece = this.game.get(from);
let capturedPiece = this.game.get(this.currentMove.captureSquare);
this.game.remove(this.currentMove.from);
let putResult = this.game.put(fromPiece, this.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"isCapture(move) {\n return (move.flags.indexOf(\"c\") >= 0 || move.flags.indexOf(\"e\") >= 0);\n }",
"move(from, to) {\n // Here is a bunch fo castling logic if there's a castling flag...\n if (this.currentMove.castlingFlag) {\n this.castlingMove(from, to);\n }\n // If it's a capture, handle... | [
"0.6533966",
"0.6088415",
"0.5789022",
"0.57520187",
"0.57520187",
"0.57058835",
"0.5701422",
"0.5695783",
"0.5583291",
"0.55394393",
"0.55150205",
"0.5492941",
"0.5484419",
"0.5456369",
"0.5453053",
"0.5449902",
"0.5435519",
"0.5430909",
"0.54226935",
"0.54000396",
"0.536941... | 0.654187 | 0 |
handleDisableCastling() checks whether you moved your king or one of your rooks and disabled castling flags appropriately | handleDisableCastling(from, to) {
// Get the piece moved
let piece = this.game.get(from);
// Get the turn
let turn = this.game.turn();
// Remember what the back rank is
let backRank = turn === this.game.WHITE ? 1 : 8;
// If the current side can potentially castle
if (this.castling[turn]... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"castlingMove(from, to) {\n // Remember the from piece (it's a king)\n let fromPiece = this.game.get(from);\n // Remove the king\n this.game.remove(from);\n // Place the king in the destination square\n this.game.put(fromPiece, to);\n // Now we need to position the rook correctly\n let turn ... | [
"0.6324831",
"0.61844337",
"0.5915762",
"0.5732864",
"0.5680081",
"0.5598043",
"0.55231667",
"0.55042136",
"0.5485218",
"0.5455878",
"0.5438026",
"0.5397929",
"0.5396953",
"0.53962326",
"0.53867185",
"0.538057",
"0.5373264",
"0.53361017",
"0.53271353",
"0.53222746",
"0.529926... | 0.82795745 | 0 |
Override getMoves because we need illegal moves around check (since there's no check in this game at all as you can capture the king). We also want to filter captures and castling moves. | getMoves(square) {
// We want illegal moves too so we can move into check
let options = {
verbose: true,
legal: false
}
// If there's a square then go with it
if (square) options.square = square;
// Get the moves
let moves = this.game.moves(options);
// If there's no square s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"getNonCaptures(moves, square) {\n return moves.filter(a => !this.isCapture(a) && !this.isCastling(a));\n }",
"get_moves(gs) {\n var locations = [];\n var capture_dirs = [Direction.LEFT, Direction.RIGHT];\n var curr_loc = super.get_curr_loc();\n var forward = curr_loc.get_new_loc(this.forward_move... | [
"0.69349074",
"0.6820416",
"0.6814829",
"0.67773145",
"0.675101",
"0.6654657",
"0.65968853",
"0.6594132",
"0.6453899",
"0.6403092",
"0.6396493",
"0.63811827",
"0.63807726",
"0.6372801",
"0.6338228",
"0.62991065",
"0.6285136",
"0.62835",
"0.625718",
"0.6250753",
"0.62198573",
... | 0.76678795 | 0 |
Filter the array for noncapturing and noncastling moves | getNonCaptures(moves, square) {
return moves.filter(a => !this.isCapture(a) && !this.isCastling(a));
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"filterMoves(arr, index) {\n let tempArr =[]\n arr.forEach(element => {\n if (this.kingNotInCheck(index, element)) {\n tempArr.push(element)\n }\n });\n return tempArr\n }",
"static KeepCaptures(moves)\n\t{\n\t\treturn moves.filter(m => { return m.vanish.length == 2; });\n\t}",
"fu... | [
"0.6931354",
"0.6491938",
"0.635694",
"0.6348919",
"0.63289505",
"0.63167405",
"0.625216",
"0.62341577",
"0.62341577",
"0.62341577",
"0.62341577",
"0.62341577",
"0.6137263",
"0.6104903",
"0.60945517",
"0.6079052",
"0.6076814",
"0.5977294",
"0.5920834",
"0.59083176",
"0.585882... | 0.70642567 | 0 |
Manually figure out if this square includes castling moves | getCastling(square) {
// Get the turn and the piece
let turn = this.game.turn();
let piece = this.game.get(square);
let backRank = turn === this.game.WHITE ? 1 : 8;
// We'll store possible castling moves
let moves = [];
// Make sure we can castle and we're moving the right colored king from... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"isOver() {\n return !( this.hasMove('white') || this.hasMove('black') );\n }",
"function analyzeMoves() {\n debug(3,\"analyze\");\n var anyLegal=false;\n for (var y=0; y<8; y++) {\n for (var x=0; x<8; x++) {\n var legalMoves=0; // start counting posible... | [
"0.7156719",
"0.70397633",
"0.69983757",
"0.6980399",
"0.6959384",
"0.69575655",
"0.6949583",
"0.6925125",
"0.68760157",
"0.68734473",
"0.6860344",
"0.6790377",
"0.67854506",
"0.67576414",
"0.666184",
"0.6644082",
"0.6601687",
"0.6569131",
"0.65537864",
"0.6550468",
"0.653569... | 0.71718055 | 0 |
Checks if from and to are adjacent on the board | adjacent(from, to) {
// Convert squares to numbers
let rankFrom = parseInt(from[1]);
let fileFrom = FILES.indexOf(from[0]);
let rankTo = parseInt(to[1]);
let fileTo = FILES.indexOf(to[0]);
// Go through all possible neighbours and check for adjacency
for (let i = rankFrom - 1; i <= rankFrom... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function isValidMove(from, to, board) {\n var reachablePoints = game_state_reachable_1.getReachable(board, from);\n return isInArray(reachablePoints, to);\n}",
"function checkIfIconCanBeMovedHere(fromPosX, fromPosY, toPosX, toPosY) {\n\n if (toPosX < 0 || toPosX >= BOARD_COLS || toPosY < 0 || toPosY >= ... | [
"0.74775624",
"0.69965744",
"0.6965496",
"0.6923797",
"0.68402857",
"0.6816734",
"0.678403",
"0.6775405",
"0.6734268",
"0.66603786",
"0.6525864",
"0.6512295",
"0.6436229",
"0.6435793",
"0.64276505",
"0.6344676",
"0.63400626",
"0.63199043",
"0.62906706",
"0.6289892",
"0.626885... | 0.7735695 | 0 |
Checks capture flags (c for capture, e for en passant) | isCapture(move) {
return (move.flags.indexOf("c") >= 0 || move.flags.indexOf("e") >= 0);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function isCaptured() {\n return carmen.captured\n}",
"function analyzeEvent(e) {\n var prev = capsLockOn;\n if (e) {\n if ( (e.type === 'keydown' || e.type === 'keyup') && capsLockPressed(e) ) {\n toggleCapsLockState();\n } else if (e.type === 'keypress') {\n keyPress(e);\n }... | [
"0.6145862",
"0.5536171",
"0.5026823",
"0.49665886",
"0.4945727",
"0.49361205",
"0.4733681",
"0.4713736",
"0.46696454",
"0.46578276",
"0.46286672",
"0.46226993",
"0.4615656",
"0.46083272",
"0.45573443",
"0.45569387",
"0.45182422",
"0.45033765",
"0.44942054",
"0.4493168",
"0.4... | 0.70014334 | 0 |
Checks castling flags (k for kingside, q for queenside) | isCastling(move) {
return (move.flags.indexOf('k') >= 0 || move.flags.indexOf('q') >= 0);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"handleDisableCastling(from, to) {\n // Get the piece moved\n let piece = this.game.get(from);\n // Get the turn\n let turn = this.game.turn();\n // Remember what the back rank is\n let backRank = turn === this.game.WHITE ? 1 : 8;\n\n // If the current side can potentially castle\n if (this.... | [
"0.62087095",
"0.61966497",
"0.6180814",
"0.586856",
"0.5781269",
"0.56879437",
"0.56257397",
"0.56053334",
"0.55260104",
"0.5520851",
"0.54905254",
"0.5412387",
"0.5384068",
"0.53559774",
"0.53512627",
"0.53511393",
"0.531687",
"0.5308196",
"0.53053784",
"0.51974595",
"0.517... | 0.69678676 | 0 |
+ if the cards do not match, remove the cards from the list and hide the card's symbol (put this functionality in another function that you call from this one) | function removeCards() {
// console.log("The cards do not match");
displaySymbol(openCards[0]);
displaySymbol(openCards[1]);
// Reset open card array so it includes a new pair of cards
openCards = [];
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function hideCard() {\n for (let card of currCards) {\n card.className = 'card';\n }\n\n currCards.pop();\n currCards.pop();\n openedCards.pop();\n openedCards.pop();\n}",
"function hideCards () {\n // first add event listeners back to all unmatched cards\n $('.flippable').on('click', function () {\n ... | [
"0.7489519",
"0.7486568",
"0.7413804",
"0.7376115",
"0.7313743",
"0.72878283",
"0.7232992",
"0.7123044",
"0.7096188",
"0.70662886",
"0.70568204",
"0.7056447",
"0.7023798",
"0.70180833",
"0.6995193",
"0.6983869",
"0.6888886",
"0.68856186",
"0.6883526",
"0.6878867",
"0.6858632"... | 0.84173876 | 0 |
Hook that alerts clicks outside of the passed ref and menuButtonRef | function outsideNavAlerter(ref, menuButtonRef, props) {
React.useEffect(function () {
// Alert if clicked on outside of ul list and menu button
function handleClickOutside(event) {
if (ref.current && !ref.current.contains(event.target) && menuButtonRef.current && !menuButtonRef.current.contains(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function handleClickOutside(event) {\n if (ref.current && !ref.current.contains(event.target)) {\n //alert(\"You clicked outside of me!\");\n setMenubar(menubar)\n }\n }",
"handleClickOutside(event) {\n if (this.wrapperRef && !this.wrapperRef.contains(event.target)) {\n ... | [
"0.6615908",
"0.657545",
"0.6355671",
"0.61963964",
"0.6155617",
"0.6101069",
"0.59725624",
"0.59675163",
"0.5958877",
"0.5926656",
"0.5909271",
"0.5908043",
"0.58987516",
"0.5865443",
"0.5855721",
"0.58401304",
"0.57837415",
"0.57460076",
"0.57439804",
"0.5736608",
"0.573427... | 0.71779907 | 0 |
and finds out if they have the same frequency of digits SAMPLE INPUT (182,281) OUTPUT true | function sameFrequency(num1, num2){
let strNum1 = num1.toString();
let strNum2 = num2.toString();
let frequencyNum1 = {};
if (strNum1.length !== strNum2.length) {
return false;
}
for (let i = 0; i < strNum1.length; i++) {
let number = strNum1[i];
frequencyNum1[number]... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function containsSameFrequency(test){\n let map = new Map();\n for (let i = 0; i < test.length; i++) {\n if(map.has(test[i])){\n map.set(test[i], map.get(test[i]) + 1);\n } else {\n map.set(test[i], 1);\n }\n }\n let ans = map.get(test[0]);\n for(let freq o... | [
"0.7151551",
"0.7091903",
"0.70609576",
"0.70063597",
"0.700018",
"0.699048",
"0.697821",
"0.68967485",
"0.6851261",
"0.68379235",
"0.6826351",
"0.6817055",
"0.6812012",
"0.6779863",
"0.6733561",
"0.66950214",
"0.66906345",
"0.6645402",
"0.66298693",
"0.66250044",
"0.6527965"... | 0.71904075 | 0 |
"D" restate problem: write a function that takes in three integers, determines their average, and returns the letter associated with that number. Use the provided conversion table. Assume valid input. inputs: Three integers outputs: a string, single character examples: see above, assum valid input. data structures: int... | function getGrade(num1, num2, num3) {
let mean = (num1 + num2 + num3) / 3;
if (mean >= 90) {
return 'A';
} else if (mean >= 80) {
return 'B';
} else if (mean >= 70) {
return 'C';
} else if (mean >= 60) {
return 'D';
} else {
return 'F';
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function getGrade (num1, num2, num3) {\n let average = (num1 + num2 + num3) / 3;\n if (average >= 90 && average <= 100) {\n return 'A';\n } else if (average >= 80 && average < 90) {\n return 'B';\n } else if (average >= 70 && average < 80) {\n return 'C';\n } else if (average >= 60 && average < 70) {... | [
"0.71726876",
"0.71395457",
"0.7094449",
"0.70941556",
"0.6887624",
"0.6798147",
"0.6712713",
"0.6699458",
"0.6680032",
"0.6675654",
"0.6616627",
"0.6473097",
"0.6456342",
"0.6413874",
"0.6389045",
"0.63751054",
"0.6335558",
"0.6319758",
"0.62610036",
"0.6251995",
"0.6241158"... | 0.7160497 | 1 |
This function will show the program options dropdown | function programOptions() {
let degreeOptions = document.getElementById("degreeOptions");
//let selectedIndex = degreeOptions.selectedIndex;
let selected = degreeOptions.options[degreeOptions.selectedIndex].value;
let programOptionsDiv = document.getElementById("programOptions");
if (selected =... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function showOptions() {\n inquirer.prompt([{\n type: \"list\",\n name: \"menu\",\n message: \"Menu Options\",\n choices: [\n \"View Product Sales by Department\",\n \"Create New Department\",\n \"Exit\"\n ]\n ... | [
"0.6808201",
"0.6445983",
"0.6438492",
"0.64060074",
"0.6361414",
"0.63570696",
"0.63546246",
"0.63164556",
"0.62927246",
"0.6288737",
"0.62816554",
"0.6268722",
"0.62565887",
"0.62558675",
"0.6211474",
"0.6195165",
"0.61943537",
"0.6186753",
"0.61768866",
"0.6175759",
"0.616... | 0.6525492 | 1 |
reload all the stock information including financial data | function reloadStock() {
dataTablePromise = null;
refreshStock();
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function refreshStock() {\n vm.dtInstance.reloadData(function() {\n }, true);\n }",
"function readstock(data) {\n foods = data.val();\n foodObj.updatefoodstock(foods);\n\n}",
"function fillStockDataList() {\n stockDataList = [];\n var stockData;\n for (var i ... | [
"0.8020105",
"0.6631088",
"0.6484677",
"0.6446186",
"0.6414861",
"0.64012676",
"0.63721544",
"0.6352765",
"0.63100517",
"0.630014",
"0.6260878",
"0.6248879",
"0.62444437",
"0.62444437",
"0.62444437",
"0.62444437",
"0.6243983",
"0.62363356",
"0.62363356",
"0.62363356",
"0.6231... | 0.7868579 | 1 |
only refresh the stock prices | function refreshStock() {
vm.dtInstance.reloadData(function() {
}, true);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function updatePrices() {\n}",
"refresh() {\n if (this.date && this.price)\n this.update(this.date, this.price);\n }",
"function reloadStock() {\n dataTablePromise = null;\n refreshStock();\n }",
"function refresh () {\n $.each(stock, function(key, value) {\n if ... | [
"0.7569186",
"0.74858487",
"0.7082566",
"0.69784003",
"0.69186795",
"0.6812325",
"0.6809016",
"0.67355764",
"0.6689927",
"0.66833943",
"0.6663599",
"0.6622758",
"0.6610534",
"0.65681416",
"0.648442",
"0.64713365",
"0.6465368",
"0.6379625",
"0.6288957",
"0.6287435",
"0.6269614... | 0.7958367 | 0 |
Returns the number of food that is generated per farmer | function calculateFoodPerFarmer(userState) {
const hasAnimistsGuild = userState.construction.isCompleted(Buildings.ANIMISTS_GUILD);
const isHalfling = userState.city.isRace(Races.HALFLING);
const hasHalflings = userState.city.hasAdditionalRace(Races.HALFLING);
const foodPerFarmer = (hasAnimistsGuild ||... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function calculateNumRequiredFood(userState) {\n // It's pretty much always one food per unit, unless we have some modifier\n // In theory, each normal unit uses one food too... but not sure how we're handling units yet\n // TODO: add in the amount used by normal units (ie, combat units)\n return Popul... | [
"0.6815442",
"0.67316467",
"0.6701552",
"0.66053486",
"0.6530636",
"0.6506883",
"0.64344394",
"0.6396337",
"0.6371643",
"0.62979805",
"0.6270508",
"0.62603444",
"0.6225868",
"0.6217667",
"0.61543095",
"0.6148906",
"0.61137277",
"0.609756",
"0.6027105",
"0.60125965",
"0.601185... | 0.67754036 | 1 |
Returns the amount of food generated by the various sourcea base food level (the the land, etc) required farmers + optional farmers other buildings and the like There's 2 categories of produced food weighted food generation that, if over the base food level, if halved unweighted food generation that is not reduced by b... | function calculateFoodGenerated(userState) {
var baseFoodLevel = calculateBaseFoodLevel(userState);
const foodPerFarmer = calculateFoodPerFarmer(userState);
const totalFarmers = calculateNumRequiredFarmers(userState) + userState.population.numOptionalFarmers;
// The amount of farmed and weighted produ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function calculateFoodGenerated(userState) {\n var baseFoodLevel = Population.calculateBaseFoodLevel(userState);\n\n const foodPerFarmer = Population.calculateFoodPerFarmer(userState);\n const totalFarmers = Population.calculateNumRequiredFarmers(userState) + userState.population.numOptionalFarmers;\n\n ... | [
"0.7077065",
"0.6868998",
"0.6526009",
"0.64231104",
"0.6334464",
"0.59795654",
"0.5908822",
"0.590644",
"0.5897363",
"0.587547",
"0.5866903",
"0.584563",
"0.5843389",
"0.58431804",
"0.5840691",
"0.58208424",
"0.5801326",
"0.57731867",
"0.5756606",
"0.57544166",
"0.5729829",
... | 0.7110401 | 0 |
Returns the base amount of food generated by the user's city TODO: This | function calculateBaseFoodLevel(userState) {
const countTerrains = function(terrains) {
return userState.city.terrains
.filter(terrain => terrains.includes(terrain))
.length;
}
var baseFoodLevel =
(0.5 * countTerrains([Terrains.FOREST, Terrains.HILLS, Terrains.SHORE])... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"getTotalCalories(mealFoods) {\n let sumCalories = 0;\n for (let i = 0; i < this.state.activities.length; i++) {\n sumCalories += this.state.activities[i].calories;\n }\n return sumCalories;\n }",
"function calculatePopulation() {\n const filteredCities = cities.filter((key, index) => {\n re... | [
"0.6423863",
"0.63622844",
"0.6361754",
"0.6276906",
"0.62617683",
"0.61942244",
"0.6115381",
"0.6107601",
"0.5986409",
"0.5978571",
"0.5964017",
"0.5962096",
"0.5935866",
"0.5896549",
"0.5878653",
"0.58566636",
"0.58565784",
"0.58560026",
"0.58445776",
"0.58144635",
"0.58127... | 0.7215703 | 0 |
Read messages from the server | function readMessages(){
$.getJSON('/read-messages/' + lastReadMessageTime,function(messages){
// Update the lastReadMessageTime from the read messages
if(messages.length){
lastReadMessageTime = messages[messages.length - 1].time;
}
messages.forEach(function(message){
$('bod... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function readMessages() {\n\tvar response = xmlHttpGetMessages.responseText;\n\n\t// checks for server error\n\tif (response.indexOf(\"ERRNO\") >= 0 || response.indexOf(\"error:\") >= 0 || response.length == 0)\n\t\tthrow (response.length == 0 ? \"Void server response.\" : response);\n\tresponse = xmlHttpGetMessag... | [
"0.7307999",
"0.66320515",
"0.6615396",
"0.6597351",
"0.65961725",
"0.65781176",
"0.65676445",
"0.63852954",
"0.6346357",
"0.63410985",
"0.62946033",
"0.61850375",
"0.6117612",
"0.6113197",
"0.6107958",
"0.6085015",
"0.6063497",
"0.60568035",
"0.60428965",
"0.6033382",
"0.603... | 0.6835007 | 1 |
figure out the actual "visible" bounds for an object if clipping mask or compound path items are found | function getVisibleBounds(object) {
var bounds, clippedItem;
if (object.typename == "GroupItem") {
// if the object is clipped
if (object.clipped) {
// check all sub objects to find the clipping path
for (var i = 0; i < object.pageItems.length; i++) {
if (... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"objectVisible(o:ViewportObject) {\n\t\tif(o.x == null || o.y == null)\n\t\t\treturn true;\n\n\t\tif(this.pointVisible(o.x, o.y))\n\t\t\treturn true;\n\n\t\tif((o.x - this.origin.x > this._width * 2) || (o.x - this.origin.x < -this._width))\n\t\t\treturn false;\n\n\t\tif((o.y - this.origin.y > this._height * 2) || ... | [
"0.69516724",
"0.6853981",
"0.6652463",
"0.6652463",
"0.663854",
"0.65513396",
"0.64481354",
"0.6396253",
"0.6387529",
"0.6379836",
"0.630104",
"0.6299986",
"0.6276932",
"0.6228237",
"0.6223092",
"0.6188954",
"0.6171809",
"0.6166658",
"0.61482745",
"0.6141726",
"0.6127365",
... | 0.773016 | 1 |
Floating Enemies Get Hurt by player or friends bullet | function FEnemyHurt() {
if (bulletGroup.collide(FloatingGroup1)) {
bulletGroup.destroyEach();
score = score + Math.round(random(5, 10));
FloatingGroup1.destroyEach();
} else if (bulletGroup.collide(FloatingGroup2)) {
bulletGroup.destroyEach();
score = score + Mat... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"handleBullets() {\n const gameInstance = this;\n this.physicsEngine.hits.forEach(function (hit_name) {\n const hit = gameInstance.physicsEngine.obj[hit_name];\n const attacker = gameInstance.objects[hit.from];\n const attackee = gameInstance.objects[hit.to];\n\n ... | [
"0.69182223",
"0.6862426",
"0.68566346",
"0.685186",
"0.67941123",
"0.6592795",
"0.6568385",
"0.6548402",
"0.65260667",
"0.64706284",
"0.6450453",
"0.6438808",
"0.6416508",
"0.6403651",
"0.64015305",
"0.6355145",
"0.6352237",
"0.63341314",
"0.62861645",
"0.62762487",
"0.62639... | 0.71190566 | 0 |
Floating Enemies Hurt Others | function FEHurtOthers() {
if (FloatingGroup1.collide(player)) {
health = health - Math.round(random(10, 15));
FloatingGroup1.destroyEach();
} else if (FloatingGroup2.collide(player)) {
health = health - Math.round(random(10, 15));
FloatingGroup2.destroyEach();
} el... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function FEnemyHurt() {\r\n if (bulletGroup.collide(FloatingGroup1)) {\r\n bulletGroup.destroyEach();\r\n score = score + Math.round(random(5, 10));\r\n FloatingGroup1.destroyEach();\r\n\r\n } else if (bulletGroup.collide(FloatingGroup2)) {\r\n bulletGroup.destroyEach();\r\n ... | [
"0.7052463",
"0.66734123",
"0.65943116",
"0.6536483",
"0.6512547",
"0.6489474",
"0.6484225",
"0.64518213",
"0.6440541",
"0.64239764",
"0.6383616",
"0.63553166",
"0.6332469",
"0.6310603",
"0.6309805",
"0.630585",
"0.629595",
"0.6280564",
"0.6279734",
"0.62772024",
"0.6255283",... | 0.6953343 | 1 |
END INPUT VALIDATION / BEGIN STEP HANDLER / children components render different forms as user moves through the registration process. getStepContent is invoked in the return of this component and passed the activeStep slice of state which is being changed by the handle submit of the back and next buttons. All the prop... | function getStepContent(step) {
switch (step) {
case 0:
return (
<WriterContactInfoForm
contactFormState={contactFormState}
handleContactChanges={handleContactChanges}
formHelperText={formHelperText}
handleValidation={handleValidation}
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"getStepContent(step) {\n const {firstName, PlastName, MlastName, birth, gender, nationality, em_country, id, id_number, direction,city, postal, country, pid_front, pid_back, check_residence} = this.state;\n const values = {firstName, PlastName, MlastName, birth, gender, nationality, em_country, id, id_number, di... | [
"0.74720824",
"0.69824797",
"0.69266504",
"0.69086653",
"0.6587572",
"0.65366787",
"0.638315",
"0.63817525",
"0.6366377",
"0.63628775",
"0.6257133",
"0.61449593",
"0.60857195",
"0.6032657",
"0.5978818",
"0.59351295",
"0.58160657",
"0.58149177",
"0.57937545",
"0.5754029",
"0.5... | 0.7203668 | 1 |
This function handles what happens when the user picks a Private map | function pickGEBPrivateMap(){
var map = document.getElementById('gebPrivateMaps') ;
var mapIndex = map.selectedIndex;
mapID = map.options[mapIndex].value;
var mapName = map.options[mapIndex].text ;
pubLimited = "private";
loadMapRootJSONP(mapID);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function pickGEBPublicMap(){\n var map = document.getElementById('gebPublicMaps') ;\n var mapIndex = map.selectedIndex;\n mapID = map.options[mapIndex].value;\n var mapName = map.options[mapIndex].text ;\n pubLimited = \"public\";\n loadMapRootJSONP(mapID); \n}",
"function Maps( need_authentication , ty... | [
"0.6965672",
"0.636594",
"0.61171114",
"0.606181",
"0.6039862",
"0.6023833",
"0.60044336",
"0.5994352",
"0.5971502",
"0.5966408",
"0.59486073",
"0.5944216",
"0.592748",
"0.592748",
"0.5916109",
"0.5914352",
"0.59084153",
"0.589513",
"0.589497",
"0.5887626",
"0.5875589",
"0.... | 0.7821597 | 0 |
This function handles what happens when the user picks a Public map | function pickGEBPublicMap(){
var map = document.getElementById('gebPublicMaps') ;
var mapIndex = map.selectedIndex;
mapID = map.options[mapIndex].value;
var mapName = map.options[mapIndex].text ;
pubLimited = "public";
loadMapRootJSONP(mapID);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function pickGEBPrivateMap(){\n var map = document.getElementById('gebPrivateMaps') ;\n var mapIndex = map.selectedIndex;\n mapID = map.options[mapIndex].value;\n var mapName = map.options[mapIndex].text ;\n pubLimited = \"private\";\n loadMapRootJSONP(mapID); \t \n}",
"function displayMap()\n ... | [
"0.75622696",
"0.6709806",
"0.6709806",
"0.6680129",
"0.6649394",
"0.66368103",
"0.6610117",
"0.6560911",
"0.6494273",
"0.6457438",
"0.64499855",
"0.64391077",
"0.6437039",
"0.6408814",
"0.6402482",
"0.6393893",
"0.63674504",
"0.6339745",
"0.63386",
"0.6331042",
"0.63287675",... | 0.7777627 | 0 |
dynamic children means it was generated by an iteration in a template, and will require a more complex diffing algo. | function markAsDynamicChildren(children) {
FromIteration.set(children, 1);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function markAsDynamicChildren$1(children) {\n FromIteration$1.set(children, 1);\n }",
"renderChildrenOnly() {\n this.children.forEach(child => child.render(this.$element));\n }",
"decorateChildren() {\n this.forEachChild(aChild => {\n var element = this.getDomHelper().getElement(aChild.getId()... | [
"0.675915",
"0.6366254",
"0.62954193",
"0.6160598",
"0.61452687",
"0.6026091",
"0.6016365",
"0.60123026",
"0.59730476",
"0.59544486",
"0.59544486",
"0.59544486",
"0.5946492",
"0.5946099",
"0.5946099",
"0.5946099",
"0.5939666",
"0.59318435",
"0.59190595",
"0.59189075",
"0.5909... | 0.701836 | 1 |
Reset the styling token applied to the host element. | function resetStyleAttributes(vm) {
const {
context,
elm
} = vm; // Remove the style attribute currently applied to the host element.
const oldHostAttribute = context.hostAttribute;
if (!isUndefined(oldHostAttribute)) {
removeAttribute.call(elm, oldHostAttribute);
} // Reset the ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function resetStyleAttributes$1(vm) {\n const {\n context,\n elm\n } = vm; // Remove the style attribute currently applied to the host element.\n\n const oldHostAttribute = context.hostAttribute;\n\n if (!isUndefined$3(oldHostAttribute)) {\n removeAttribute$1.call(elm, oldHostAttribute);... | [
"0.71526057",
"0.65373194",
"0.6505469",
"0.625395",
"0.6195063",
"0.61359566",
"0.59316593",
"0.59005255",
"0.58822036",
"0.5872097",
"0.5838546",
"0.5838546",
"0.58297414",
"0.5769401",
"0.5765566",
"0.5659194",
"0.56037307",
"0.56037307",
"0.5600189",
"0.558922",
"0.556910... | 0.7110243 | 1 |
The recursion doesn't need to be a complete traversal of the vnode graph, instead it can be partial, when a custom element vnode is found, we don't need to continue into its children because by attempting to disconnect the custom element itself will trigger the removal of anything slotted or anything defined on its sha... | function recursivelyDisconnectChildren(vnodes) {
for (let i = 0, len = vnodes.length; i < len; i += 1) {
const vnode = vnodes[i];
if (!isNull(vnode) && isArray$1(vnode.children) && !isUndefined(vnode.elm)) {
// vnode is a VElement with children
if (isUndefined(vnode.ctor)) {
/... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function recursivelyDisconnectChildren$1(vnodes) {\n for (let i = 0, len = vnodes.length; i < len; i += 1) {\n const vnode = vnodes[i];\n\n if (!isNull$1(vnode) && isArray$1$1(vnode.children) && !isUndefined$3(vnode.elm)) {\n // vnode is a VElement with children\n if (isUndefined$3(vnode... | [
"0.7149035",
"0.70808804",
"0.579793",
"0.5756222",
"0.54819816",
"0.54819816",
"0.54819816",
"0.5458713",
"0.544023",
"0.544023",
"0.54269284",
"0.54269284",
"0.5382236",
"0.5382236",
"0.5382236",
"0.5382236",
"0.5382236",
"0.5376993",
"0.5369216",
"0.5355826",
"0.53421843",... | 0.7158035 | 0 |
without having to go into snabbdom. Especially useful when the reset is a consequence of an error, in which case the children VNodes might not be representing the current state of the DOM | function resetShadowRoot(vm) {
vm.children = EmptyArray;
ShadowRootInnerHTMLSetter.call(vm.cmpRoot, ''); // disconnecting any known custom element inside the shadow of the this vm
runShadowChildNodesDisconnectedCallback(vm);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"onreset() {\n this.dom = [];\n this.root = new Document(this.dom);\n this.done = false;\n this.tagStack = [this.root];\n this.lastNode = null;\n this.parser = null;\n }",
"function resetShadowRoot$1(vm) {\n vm.children = EmptyArray$1;\n ShadowRootInnerHTMLSetter... | [
"0.69916254",
"0.6751781",
"0.6652466",
"0.6641773",
"0.6499677",
"0.6405615",
"0.63714224",
"0.63673145",
"0.6323913",
"0.6317209",
"0.6274044",
"0.62495166",
"0.6238099",
"0.6238099",
"0.6238099",
"0.6231281",
"0.6216246",
"0.6190708",
"0.618857",
"0.60992223",
"0.60847616"... | 0.68775356 | 1 |
Reset the styling token applied to the host element. | function resetStyleAttributes$1(vm) {
const {
context,
elm
} = vm; // Remove the style attribute currently applied to the host element.
const oldHostAttribute = context.hostAttribute;
if (!isUndefined$3(oldHostAttribute)) {
removeAttribute$1.call(elm, oldHostAttribute);
} // Rese... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function resetStyleAttributes(vm) {\n const {\n context,\n elm\n } = vm; // Remove the style attribute currently applied to the host element.\n\n const oldHostAttribute = context.hostAttribute;\n\n if (!isUndefined(oldHostAttribute)) {\n removeAttribute.call(elm, oldHostAttribute);\n ... | [
"0.7109883",
"0.6536709",
"0.65053093",
"0.6253301",
"0.6194271",
"0.6135858",
"0.59313935",
"0.58994836",
"0.5882235",
"0.5871266",
"0.58379644",
"0.58379644",
"0.5829486",
"0.5768729",
"0.5764948",
"0.5658618",
"0.56031847",
"0.56031847",
"0.5599531",
"0.55883455",
"0.55687... | 0.71525836 | 0 |
Returns the first element that is a descendant of node that matches selectors. querySelector(selectors: K): HTMLElementTagNameMap[K] | null; querySelector(selectors: K): SVGElementTagNameMap[K] | null; | querySelector(selectors) {
const vm = getAssociatedVM$1(this);
{
assert$1.isFalse(isBeingConstructed$1(vm), `this.querySelector() cannot be called during the construction of the custom element for ${getComponentTag$1(vm)} because no children has been added to this element yet.`);
}
con... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function query(selectors) {\n\treturn document.querySelector(selectors);\n}",
"querySelector(selectors) {\n const vm = getAssociatedVM(this);\n\n {\n assert.isFalse(isBeingConstructed(vm), `this.querySelector() cannot be called during the construction of the custom element for ${getComponentTag(... | [
"0.6734748",
"0.6649164",
"0.61247677",
"0.60747695",
"0.5974062",
"0.59241474",
"0.5918057",
"0.591156",
"0.58313864",
"0.58313864",
"0.58313864",
"0.5827994",
"0.5827192",
"0.5823408",
"0.57737523",
"0.57661456",
"0.57641095",
"0.5755062",
"0.5742309",
"0.5735775",
"0.57341... | 0.6793637 | 0 |
Returns all element descendants of node that match selectors. querySelectorAll(selectors: K): NodeListOf, querySelectorAll(selectors: K): NodeListOf, | querySelectorAll(selectors) {
const vm = getAssociatedVM$1(this);
{
assert$1.isFalse(isBeingConstructed$1(vm), `this.querySelectorAll() cannot be called during the construction of the custom element for ${getComponentTag$1(vm)} because no children has been added to this element yet.`);
}
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"_querySelectorAll(selector) {\n var _a, _b;\n if (!((_a = this === null || this === void 0 ? void 0 : this.rootNode) === null || _a === void 0 ? void 0 : _a.length)) {\n return this;\n }\n let nodes = [];\n for (let cnt = 0; cnt < this.rootNode.length; cnt++) {\n ... | [
"0.75685596",
"0.75685596",
"0.74604934",
"0.7449295",
"0.7405409",
"0.7405409",
"0.708243",
"0.6973407",
"0.6961123",
"0.689616",
"0.6823426",
"0.67758167",
"0.6739723",
"0.67390424",
"0.67390424",
"0.6655",
"0.65899086",
"0.65810746",
"0.656314",
"0.6559097",
"0.6545253",
... | 0.75742894 | 0 |
Unwrap property descriptors will set value on original descriptor We only need to unwrap if value is specified | function unwrapDescriptor$1(descriptor) {
if (hasOwnProperty$2$1.call(descriptor, 'value')) {
descriptor.value = unwrap$1(descriptor.value);
}
return descriptor;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function unwrapDescriptor(descriptor) {\n if (hasOwnProperty.call(descriptor, 'value')) {\n descriptor.value = unwrap(descriptor.value);\n }\n return descriptor;\n }",
"function unwrapDescriptor(descriptor) {\n if (hasOwnProperty$2.call(descriptor, 'value')) {\n descriptor.value ... | [
"0.7822331",
"0.76823014",
"0.60933137",
"0.5793386",
"0.5793386",
"0.5793386",
"0.5793386",
"0.5793386",
"0.57844436",
"0.56984496",
"0.56403834",
"0.55921453",
"0.5553092",
"0.5551509",
"0.55188113",
"0.5486835",
"0.54819834",
"0.54819834",
"0.5463044",
"0.5463044",
"0.5440... | 0.77605015 | 1 |
The recursion doesn't need to be a complete traversal of the vnode graph, instead it can be partial, when a custom element vnode is found, we don't need to continue into its children because by attempting to disconnect the custom element itself will trigger the removal of anything slotted or anything defined on its sha... | function recursivelyDisconnectChildren$1(vnodes) {
for (let i = 0, len = vnodes.length; i < len; i += 1) {
const vnode = vnodes[i];
if (!isNull$1(vnode) && isArray$1$1(vnode.children) && !isUndefined$3(vnode.elm)) {
// vnode is a VElement with children
if (isUndefined$3(vnode.ctor)) {
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function recursivelyDisconnectChildren(vnodes) {\n for (let i = 0, len = vnodes.length; i < len; i += 1) {\n const vnode = vnodes[i];\n\n if (!isNull(vnode) && isArray$1(vnode.children) && !isUndefined(vnode.elm)) {\n // vnode is a VElement with children\n if (isUndefined(vnode.ctor)) {\... | [
"0.7158035",
"0.70808804",
"0.579793",
"0.5756222",
"0.54819816",
"0.54819816",
"0.54819816",
"0.5458713",
"0.544023",
"0.544023",
"0.54269284",
"0.54269284",
"0.5382236",
"0.5382236",
"0.5382236",
"0.5382236",
"0.5382236",
"0.5376993",
"0.5369216",
"0.5355826",
"0.53421843",... | 0.7149035 | 1 |
Finds the descriptor of the named property on the prototype chain | function findDescriptor(target, propName, protoSet) {
protoSet = protoSet || [];
if (!target || protoSet.indexOf(target) > -1) {
return null; // null, undefined, or circular prototype definition
}
const descriptor = Object.getOwnPropertyDescriptor(target, propName);
if (descriptor) {
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function getDescriptor(target, property) {\n var descriptorTarget = target;\n var descriptor;\n while (descriptorTarget) {\n descriptor = Object.getOwnPropertyDescriptor(descriptorTarget, property);\n if (descriptor) {\n break;\n }\n /... | [
"0.6880907",
"0.65337235",
"0.6532917",
"0.65035254",
"0.645507",
"0.6434127",
"0.62214696",
"0.6080017",
"0.6030066",
"0.59316236",
"0.59229016",
"0.5892009",
"0.5845988",
"0.58380854",
"0.58226323",
"0.5814675",
"0.58049107",
"0.58049107",
"0.58049107",
"0.57560277",
"0.575... | 0.7199101 | 0 |
Registers the wire service. | function registerWireService(registerService) {
registerService(wireService);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"register() {\n\t\tthis.bindGateService();\n\t}",
"function RegisterService() { }",
"register() {\n\t\tnavigator.serviceWorker\n\t\t\t.register(this.serviceWorkerPath, { scope: this.serviceWorkerScope })\n\t\t\t// .then(reg => console.log('Registration succeeded. Scope is ' + reg.scope)) //registration => regis... | [
"0.6495371",
"0.6442562",
"0.58724725",
"0.5826297",
"0.5713532",
"0.5621606",
"0.56040204",
"0.55925363",
"0.55858123",
"0.554354",
"0.54942065",
"0.5487177",
"0.5485557",
"0.54187703",
"0.5354416",
"0.5300422",
"0.52898157",
"0.5283839",
"0.52264196",
"0.5184466",
"0.518364... | 0.8133653 | 0 |
function to convert from fahrenheit to centigrade | function fahrenheitToCentigrade(fahrenheit){
//this function return centigrade in a string data type
var centiGrade=Math.round((fahrenheit-32) * (5/9) );
return centiGrade.toString();
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function convertToCentigrade(tempInFarenheit) {\n temp = (tempInFarenheit-32)*5/9\n return Math.round(temp)\n}",
"function convertFtoC(fahrenheit) {\n return (fahrenheit - 32) * 5/9\n}",
"function convertToCelcius(fahrenheit) {\n return Math.round((fahrenheit - 32) * 5 / 9);\n}",
"function fToC (fahren... | [
"0.82714885",
"0.7738612",
"0.77004737",
"0.76422083",
"0.74792296",
"0.7442648",
"0.73813266",
"0.7362",
"0.7234621",
"0.72079813",
"0.7174281",
"0.71697503",
"0.71084785",
"0.7095172",
"0.7084321",
"0.7076692",
"0.70485634",
"0.70393884",
"0.70393884",
"0.70198447",
"0.6996... | 0.8486386 | 0 |
function to convert from pounds to stone | function poundsToStone(pounds){
//this function return pounds in a string data type
var stone =Math.round((pounds)/14);
return stone.toString();
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function convertToStone(weightInPounds) {\n weight = weightInPounds/14\n return Math.round(weight)\n}",
"function getOuncesFromPounds(pounds) {\nreturn pounds * 16;\n\n}",
"function convertPounds(e) {\n let lbs = e.target.value;\n $output.style.visibility = \"visible\";\n if (lbs === \"\") {\n return (... | [
"0.69048584",
"0.6600579",
"0.6524162",
"0.6261326",
"0.57711244",
"0.54490256",
"0.54042345",
"0.53595525",
"0.5252666",
"0.5252064",
"0.5246803",
"0.5244442",
"0.5240085",
"0.5236563",
"0.522161",
"0.5054552",
"0.5050389",
"0.5037285",
"0.5024733",
"0.5020561",
"0.5002743",... | 0.79276365 | 0 |
delete install file on completion | function deleteInstallFile() {
let installFilePath = path.join(__dirname, "..", "install");
fs.unlinkSync(installFilePath);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"cleanup() {\n installed = false;\n }",
"function removeDownloads(){\n fs.unlinkSync(\"./download/Default Sample File.zip\");\n fsExtra.emptyDirSync(\"./extracted\");\n}",
"function onexit() {\n rimraf.sync(folder);\n }",
"uninstall(done) {\n try {\n let stat = fs.statSync(this.desti... | [
"0.7304418",
"0.67914504",
"0.67195654",
"0.64695483",
"0.6417871",
"0.63303274",
"0.6320907",
"0.6222935",
"0.61988825",
"0.618304",
"0.6169423",
"0.6160972",
"0.61375046",
"0.61076015",
"0.60994536",
"0.60994536",
"0.6099095",
"0.6079875",
"0.6079875",
"0.6079875",
"0.60798... | 0.82194775 | 0 |
Adds the comment to local storage via redux actions | onAddComment(evt){
evt.preventDefault();
if (this.state.comment.trim() === ''){
return;
}
const newComment = {
content: this.state.comment,
posted: new Date(),
}
// empty the comment text
this.setState({comment: ''});
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async handleAddComment(ev) {\n ev.preventDefault();\n const { content } = ev.target;\n const comment_content = content.value;\n\n const thoughtId = this.state.thoughtId;\n\n // Make POST request to server to add a post\n await ActionsService.postComment(thoughtId, comment_content);\n // Clear ... | [
"0.66276",
"0.6463154",
"0.6445397",
"0.6244321",
"0.61872256",
"0.6046852",
"0.60257006",
"0.6011027",
"0.59857666",
"0.59454495",
"0.5911158",
"0.5891533",
"0.5868355",
"0.5865766",
"0.5865359",
"0.583882",
"0.58095056",
"0.5786528",
"0.57708454",
"0.57496285",
"0.57447386"... | 0.72486997 | 0 |
Sorts a given list of comments by the dates they were posted | getSortedCommentsList(commentsList){
commentsList.sort((a, b) => {
a = new Date(a.posted);
b = new Date(b.posted);
return a > b ? -1 : a < b ? 1 : 0
})
return commentsList;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function dateSortComments(comments) {\n\treturn comments.slice().sort((a, b) => b.timestamp - a.timestamp);\n}",
"function sortListsByDate() {\r\n\t\treturn getItems().sort(function(a,b){\r\n \t\t\treturn new Date(`${a.date} ${a.time}`) - new Date(`${b.date} ${b.time}`);\r\n\t\t});\r\n\t}",
"function CommentsL... | [
"0.8119673",
"0.71394014",
"0.68956757",
"0.6829228",
"0.67810905",
"0.67746055",
"0.6753386",
"0.6744617",
"0.6722506",
"0.6661734",
"0.6660404",
"0.65935826",
"0.6545299",
"0.65296495",
"0.6521841",
"0.65156406",
"0.6476843",
"0.6450403",
"0.64237463",
"0.6415851",
"0.64064... | 0.85356295 | 0 |
Determines either the number of minutes, number of hours, or number of weeks from the current time that a comment was posted | getTimeFromNow(date){
const currTime = new Date();
const postedTime = new Date(date);
// currently in seconds
let timeDiff = Math.floor((currTime - postedTime) / 1000);
// if less than a minute difference, show in seconds
if (timeDiff < 60){
return timeDiff + ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function getNumHours(post) {\n var timestamp = $(post).find(\".entry\").find(\".live-timestamp\").html();\n var number = timestamp.replace(/\\D/g, '');\n\n if (timestamp.includes(\"minute\")) {\n return parseInt(number/60.0);\n } else if (timestamp.includes(\"day\")) {\n return 24;\n } else if (timestam... | [
"0.64965826",
"0.6147331",
"0.61119527",
"0.60423183",
"0.5972125",
"0.5943092",
"0.58491755",
"0.5758005",
"0.5722477",
"0.5711524",
"0.56391037",
"0.5627594",
"0.56172705",
"0.5597156",
"0.55939716",
"0.55494934",
"0.55339104",
"0.5530741",
"0.5484201",
"0.5470626",
"0.5463... | 0.616623 | 1 |
Returns the closest matching command to what was provided. | function findClosestCommandMatch(command) {
const fuzzyResults = fuse.search(command.toLowerCase());
if (fuzzyResults.length !== 0) {
logger.cmd(`1st: ${c.COMMANDS[fuzzyResults[0]]}, 2nd: ${c.COMMANDS[fuzzyResults[1]]}`);
return c.COMMANDS[fuzzyResults[0]];
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"findCommand(name) {\n for (const command of this.commands) {\n const { names, match } = command.command\n if (names.includes(name)) {\n return { command, sliceFirstArg: name && name !== '*' }\n }\n if (match && match(name)) {\n return { command, sliceFirstArg: false }\n }\... | [
"0.6781199",
"0.61015123",
"0.6007195",
"0.584336",
"0.57088983",
"0.56061864",
"0.55955404",
"0.55081403",
"0.5439414",
"0.54381955",
"0.54319334",
"0.54319334",
"0.54319334",
"0.5390044",
"0.53755265",
"0.5374016",
"0.5356057",
"0.5346738",
"0.5327878",
"0.53263634",
"0.532... | 0.8008968 | 0 |
Returns data in json | json() {
return this.data;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"get json() {\n return JSON.stringify(this.data);\n }",
"function getJSON() {\n\t\treturn _json;\n\t}",
"jsonData() {\n return JSON.parse(this.rawData());\n }",
"json(data) {\n\t\tthis.setHeader('content-type', 'application/json')\n\t\treturn this.send(JSON.stringify(data))\n\t}",
"toJso... | [
"0.74631846",
"0.71678466",
"0.71551466",
"0.69860923",
"0.69756854",
"0.69669884",
"0.69458926",
"0.6894782",
"0.6894782",
"0.6892965",
"0.6813456",
"0.6774564",
"0.675735",
"0.6724755",
"0.67023605",
"0.66676885",
"0.6627879",
"0.66254133",
"0.6599973",
"0.65637416",
"0.655... | 0.7492416 | 0 |
Return data formatted in csv | csv() {
var buffer = "";
//Print header
var headerNumber = 0;
for (var keys in this.data[0].dataValues) {
buffer += keys;
headerNumber++;
if (headerNumber < Object.keys(this.data[0].dataValues).length) {
buffer += ",";
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"getCSVString() {\n let data = this.getDataSummary();\n this.sortStore();\n let rtn = \"Year,Session,Code,Name,Units\\n\";\n this.store.years.forEach(year => {\n year.sessions.forEach(session => {\n session.courses.forEach(course => {\n let da... | [
"0.801632",
"0.7559071",
"0.75000936",
"0.74875474",
"0.7311358",
"0.72668564",
"0.72317505",
"0.71934235",
"0.71657133",
"0.7140199",
"0.7140199",
"0.71280223",
"0.70764697",
"0.7023217",
"0.69546425",
"0.695372",
"0.6952118",
"0.6876907",
"0.68267375",
"0.67195505",
"0.6712... | 0.808927 | 0 |
Returns data formatted for google charts polymer element | chart() {
var formattedData = [];
if (this.data[0]) {
formattedData.push(Object.keys(this.data[0].dataValues));
for (var line in this.data) {
formattedData.push(Object.values(this.data[line].dataValues));
}
}
return formattedDat... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function reloadGoogleChart(performanceItems){\n var data = \"['Year', 'Fantasy & Sci Fi', 'Romance', 'Mystery/Crime', 'General','Western', 'Literature', {type: 'string', role: 'tooltip'} ], \" +\n \"['Two thousand and ten', 10, 24, 20, 32, 18, 5, 'tttttt'],\" +\n \"['Two thousand and... | [
"0.62924385",
"0.6193601",
"0.61634785",
"0.6135431",
"0.6112863",
"0.6112741",
"0.60839134",
"0.60762966",
"0.6021045",
"0.6019691",
"0.60106933",
"0.6008379",
"0.6002105",
"0.59959334",
"0.59871286",
"0.5949935",
"0.5904516",
"0.5899299",
"0.5874662",
"0.5872745",
"0.585843... | 0.7186212 | 0 |
Averages recived data into averages over the bins (currently limited to data having 1 min increments) Also likey wont deal well with breaks in data | averageMin(minutes) {
if (minutes <= 60) {
if (60 % minutes != 0) {
throw "Average bin must be factor of 60"
} else if (!this.data) {
throw "No data, query first"
} else if (!this.data[0].createdAt) {
throw "Need to reque... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function _calcAvgAmps() {\n\n // compute amplitude by averaging over n values in the range [rangeL, rangeR]\n function avgAmp(dataIndex, rangeL, rangeR, n) {\n var sum = 0.0;\n for (var i=rangeL; i<=rangeR; i++)\n sum += Math.abs(data[dataIndex + i]);\n return sum/n;\n }\n\n var ... | [
"0.64746636",
"0.6325747",
"0.6217165",
"0.60741603",
"0.6020488",
"0.590966",
"0.5885954",
"0.58811855",
"0.5770178",
"0.5766274",
"0.5731914",
"0.5701852",
"0.5682789",
"0.568083",
"0.5677343",
"0.56530106",
"0.56447256",
"0.5637448",
"0.5606018",
"0.5605289",
"0.5597902",
... | 0.7389773 | 0 |
Add empty cells in a row.. This is called when a particular key doesn't exist for a given aggregation | function addEmptyCells(agg, row, count) {
while( count > 0 ) {
var new_row = new AggConfigResult(agg, 'undefined', '', '');
row.push(new_row);
count = count - 1;
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function appendEmptyRow() {\n appendRow({from:\"\", to:\"\", ic:false, mw:false});\n}",
"function passEmptyBuckets(write, bucket, key) {\n\t var agg = write.aggStack.shift();\n\n\t switch (agg.schema.group) {\n\t case 'metrics':\n\t // pass control back to collectBucket()\n\t ... | [
"0.6958203",
"0.62643784",
"0.6122402",
"0.6083668",
"0.59477174",
"0.5849451",
"0.58391845",
"0.5835428",
"0.5821307",
"0.5821307",
"0.5821307",
"0.5821307",
"0.58039546",
"0.58039546",
"0.58039546",
"0.5796527",
"0.5772463",
"0.57528883",
"0.57528883",
"0.57528883",
"0.5752... | 0.7783419 | 0 |
Step 5: Generate random time for form submittion | function get_random_time(range,min){
time = Math.floor(Math.random() * range) + min; // generate number from min to min+range
console.log(time+" minutes")
return time*60000; // return milliseconds for form submission
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"getRandomTime() {\n return Math.floor(Math.random(1000) * 5000) + 1;\n }",
"function timeSubmit(){\n timerID=setTimeout('fixSubmit()',10000);\n }",
"function generateRandomSwim()\n\t\t{\n\t\t\tlet randomTimerDuration = RandomSwimInterval_Min + Math.floor((1 + RandomSwimInterval_Max - RandomSwimIn... | [
"0.633713",
"0.6238716",
"0.6060958",
"0.60248333",
"0.59730345",
"0.5961123",
"0.58570856",
"0.5843561",
"0.5836713",
"0.5812902",
"0.58079517",
"0.57991296",
"0.5784937",
"0.57448786",
"0.5705015",
"0.5705015",
"0.5699483",
"0.5682441",
"0.5681253",
"0.567919",
"0.56772524"... | 0.66897887 | 0 |
Declare the AngularJS upgrade module for this adapter without bootstrapping the whole hybrid application. This method is automatically called by `bootstrap()` and `registerForNg1Tests()`. | declareNg1Module(modules = []) {
const delayApplyExps = [];
let original$applyFn;
let rootScopePrototype;
const upgradeAdapter = this;
const ng1Module = angularModule(this.idPrefix, modules);
const platformRef = platformBrowserDynamic();
const ngZone = new NgZone(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"declareNg1Module(modules = []) {\n const delayApplyExps = [];\n let original$applyFn;\n let rootScopePrototype;\n const upgradeAdapter = this;\n const ng1Module = module_(this.idPrefix, modules);\n const platformRef = platformBrowserDynamic();\n const ngZone = new N... | [
"0.6918818",
"0.60257477",
"0.5451329",
"0.52759004",
"0.5244432",
"0.5244432",
"0.51165813",
"0.5097257",
"0.50938994",
"0.506662",
"0.50036937",
"0.4979274",
"0.49591264",
"0.4956252",
"0.4956252",
"0.4956252",
"0.4956252",
"0.4956252",
"0.4956252",
"0.49210215",
"0.4905261... | 0.6946274 | 0 |
Dispose of running hybrid AngularJS / Angular application. | dispose() {
this.ng1Injector.get($ROOT_SCOPE).$destroy();
this.ng2ModuleRef.destroy();
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function destroyApp($injector) {\n const $rootElement = $injector.get($ROOT_ELEMENT);\n const $rootScope = $injector.get($ROOT_SCOPE);\n $rootScope.$destroy();\n cleanData($rootElement[0]);\n}",
"destroy() {\n this.disposables.dispose();\n this.controlView.destroy();\n this.extensionView.des... | [
"0.63609743",
"0.63402736",
"0.63178855",
"0.62713486",
"0.62713486",
"0.62713486",
"0.62713486",
"0.6166364",
"0.6038406",
"0.5988423",
"0.594912",
"0.59276205",
"0.58729035",
"0.58729035",
"0.58729035",
"0.58729035",
"0.58729035",
"0.58729035",
"0.5856034",
"0.58110434",
"0... | 0.7050104 | 1 |
Master logs timer flag. / Return default RSSI based on band | function getDefaultRSSI(band)
{
var rssi = (band == 2 ) ? g_wbdDefRSSI2G : g_wbdDefRSSI5G;
return rssi
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function RSSI(measurementType, RSSIValue, proximityBinThreshold) {\n\n if (typeof measurementType !== \"undefined\")\n this.measurementType = measurementType;\n\n if (typeof RSSIValue !== \"undefined\")\n this.RSSIValue = RSSIValue;\n\n if (typeof proximityBinThreshold !== \"undefined\") {\n... | [
"0.58756787",
"0.539157",
"0.53785497",
"0.53731155",
"0.5350169",
"0.5322911",
"0.52975667",
"0.52174175",
"0.52139515",
"0.51752865",
"0.50536656",
"0.5035693",
"0.49878892",
"0.4985646",
"0.4973717",
"0.49546427",
"0.49480915",
"0.49096483",
"0.49080354",
"0.49000794",
"0.... | 0.6811764 | 0 |
Returns formated rssi value. | function getFormatedRSSI(band, rssi, sta_status) {
var rssi_data = "> " + getDefaultRSSI(band) + "dBm (Strong)";
if (rssi != 0) {
rssi_data = rssi + "dBm";
if (sta_status.length > 0) {
rssi_data += " (" + sta_status + ")";
}
}
return rssi_data;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function mapBeaconRSSI(rssi) {\n if (rssi >= 0)\n return 1; // Unknown RSSI maps to 1.\n if (rssi < -100)\n return 100; // Max RSSI\n return 100 + rssi;\n}",
"function mapBeaconRSSI(rssi)\n {\n if (rssi >= 0) return 1; // Unknown RSSI maps to 1.\n if (rssi < -100) return 100; // Max... | [
"0.6460465",
"0.6449286",
"0.6236246",
"0.57898825",
"0.5644456",
"0.5427858",
"0.527409",
"0.5208117",
"0.5188963",
"0.5130707",
"0.5126234",
"0.508279",
"0.50594354",
"0.4958164",
"0.495795",
"0.488326",
"0.4873723",
"0.4863809",
"0.48454523",
"0.47616106",
"0.4745706",
"... | 0.72778744 | 0 |
Generates ids from bssid | function getIdFromBssid(bssid)
{
var temp = bssid.replace(/:/g,'');
return temp;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function genera_id(){\n var text = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789\";\n var ids=\"\";\n for(var i = 0; i < 15; i++)\n {\n ids += text.charAt(Math.floor(Math.random() * text.length));\n }\n return ids;\n}",
"function makeId6() {\n var id = [];\n var possib... | [
"0.58904046",
"0.57335365",
"0.55554384",
"0.55233586",
"0.54815507",
"0.54708195",
"0.5440701",
"0.54259914",
"0.5392948",
"0.5384664",
"0.5384101",
"0.53554887",
"0.53500426",
"0.5322741",
"0.53219736",
"0.5319555",
"0.53157866",
"0.5299274",
"0.5298498",
"0.52823806",
"0.5... | 0.635208 | 0 |
Function for requesting master info. | function getMasterInfo()
{
var request = {"Cmd" : "info"};
clearAllWbdTimers(TIMER_MASTERINFO);
getMasterInfoFromServer(request);
g_wbdMasterInfoTimeout.push(setTimeout(function(){ getMasterInfo(); }, g_wbdTimeOutVal));
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function getMasterInfoFromServer(request)\n{\n\tvar array = [];\n\n\t$.ajax({\n\t\ttype:'GET',\n\t\turl:g_urlGetWbdMasterinfo,\n\t\tdata:request,\n\t\tasync:false,\n\t\tsuccess:function(result) {\n\t\t\tif (g_isHTTPDWebserver == 1)\n\t\t\t\tarray = result;\n\t\t\telse\n\t\t\t\tarray = JSON.parse(result);\n\t\t\tg_... | [
"0.6587184",
"0.6039159",
"0.6010956",
"0.59379715",
"0.5921651",
"0.5818731",
"0.5797609",
"0.5783983",
"0.57571304",
"0.5750641",
"0.57303756",
"0.57285076",
"0.57226783",
"0.5682398",
"0.56758153",
"0.5670626",
"0.56460744",
"0.56340295",
"0.5595964",
"0.5550554",
"0.55124... | 0.8307612 | 0 |
Function to request master logs from server. | function getMasterLogsFromServer(request)
{
var array = [];
$.ajax({
type:'GET',
url:g_urlGetWbdMasterlogs,
data:request,
async:false,
success:function(result) {
if (g_isHTTPDWebserver == 1) {
array = result;
} else {
array = JSON.parse(result);
}
displayLogMessages(array.Data.MasterLo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function getMasterLogs()\n{\n\tvar request = {\"Cmd\" : \"logs\"};\n\n\tclearAllWbdTimers(TIMER_MASTERLOGS);\n\tgetMasterLogsFromServer(request);\n\tg_wbdMasterLogsTimeout.push(setTimeout(function(){ getMasterLogs(); }, g_wbdTimeOutVal));\n}",
"function getMasterInfo()\n{\n\tvar request = {\"Cmd\" : \"info\"};\n... | [
"0.82222575",
"0.6482153",
"0.6289385",
"0.6235534",
"0.5990336",
"0.596982",
"0.5958845",
"0.59505945",
"0.58828163",
"0.5784605",
"0.57400274",
"0.56784666",
"0.56683445",
"0.5607663",
"0.5597133",
"0.55771977",
"0.55457157",
"0.5517199",
"0.54277545",
"0.54201514",
"0.5395... | 0.74738646 | 1 |
Function for requesting master logs. | function getMasterLogs()
{
var request = {"Cmd" : "logs"};
clearAllWbdTimers(TIMER_MASTERLOGS);
getMasterLogsFromServer(request);
g_wbdMasterLogsTimeout.push(setTimeout(function(){ getMasterLogs(); }, g_wbdTimeOutVal));
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function getMasterLogsFromServer(request)\n{\n\tvar array = [];\n\n\t$.ajax({\n\t\ttype:'GET',\n\t\turl:g_urlGetWbdMasterlogs,\n\t\tdata:request,\n\t\tasync:false,\n\t\tsuccess:function(result) {\n\t\t\tif (g_isHTTPDWebserver == 1) {\n\t\t\t\tarray = result;\n\t\t\t} else {\n\t\t\t\tarray = JSON.parse(result);\n\t... | [
"0.7241573",
"0.64075226",
"0.6241181",
"0.61656594",
"0.61187404",
"0.6001264",
"0.5933182",
"0.587577",
"0.5865309",
"0.57678175",
"0.5763986",
"0.5678418",
"0.56706655",
"0.5670083",
"0.5580205",
"0.5559882",
"0.5549697",
"0.55267835",
"0.55147207",
"0.55146825",
"0.549758... | 0.83663577 | 0 |
Function to display logs messages. | function displayLogMessages(message)
{
var msg = message.replace(/\\n/g, "<br/>");
var $elem = "<p>" + msg + "</p>";
$("#stamsgs").empty();
$("#stamsgs").append($elem);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function showlog(status) { }",
"function showLog(msg, arg) {\n console.log(msg, arg)\n}",
"function console_log(msg) {\n console.log(msg);\n var c = document.getElementById('console_log');\n c.innerHTML = msg + \"<br>\" + c.innerHTML;\n }",
"function console_log(msg... | [
"0.68416744",
"0.6578094",
"0.6535694",
"0.65146095",
"0.6498026",
"0.6495055",
"0.64799666",
"0.64643586",
"0.6440812",
"0.64331084",
"0.642945",
"0.6414277",
"0.6413393",
"0.63790655",
"0.63786185",
"0.6350245",
"0.6345136",
"0.63449895",
"0.63341165",
"0.6330668",
"0.63265... | 0.6779817 | 1 |
Function to clear the master logs. | function clearMasterLogs()
{
var request = {"cmd" : "clearlogs"};
$.ajax({
type:'GET',
url:g_urlGetWbdMasterlogs,
data:request,
async:true,
error:function(result) {
console.log("Failed to clear the logs");
}
});
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"clear() {\n // let elements = $.all('.mt-log-item')\n // let parentNode = $.one('.mt-log')\n // for(let i = elements.length - 1; i >= 0; i--) {\n // parentNode.removeChild(elements[i]);\n // }\n\n $.remove($.one('.mt-log'))\n }",
"function getMasterLogs()\n{\n\tva... | [
"0.6773489",
"0.6631193",
"0.6624031",
"0.6624031",
"0.6547059",
"0.65409833",
"0.6499929",
"0.6427857",
"0.63563246",
"0.6355439",
"0.6355439",
"0.63134795",
"0.6248658",
"0.624332",
"0.61499",
"0.6135642",
"0.6114427",
"0.60454154",
"0.59594786",
"0.58138597",
"0.5774107",
... | 0.8189131 | 0 |
Function for creating inner layout | function createPageInnerLayout(aparr)
{
var id = getIdFromBssid(aparr.BSSID);
var heading = aparr.SlaveType + ' : ' + aparr.BSSID;
var divId = id +"div";
return tableelem(divId, heading, id);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function buildLayout (props, innerProps) {\n var layout = {};\n\n layout.height = props.height;\n layout.x = props.scale;\n\n return layout;\n }",
"function generateLayout() {\n $('.layout-display').each(function () {\n for (var i = 0; i < $(this).attr('data-max'); i++) {\n ... | [
"0.70824295",
"0.66820335",
"0.6596008",
"0.65277976",
"0.64525735",
"0.6442318",
"0.6368682",
"0.6365365",
"0.6339992",
"0.63247716",
"0.62509537",
"0.6248081",
"0.6247984",
"0.6247984",
"0.62475723",
"0.62475723",
"0.62475723",
"0.6229105",
"0.61380845",
"0.6121322",
"0.610... | 0.68947774 | 1 |
Function for creating outer layout | function createPageOuterLayout(g_wbdarray)
{
/* 2G blanket layout */
if (g_wbdarray.Data.TwoG !== undefined && g_wbdarray.Data.TwoG.length != 0) {
for(var idx = 0; idx < g_wbdarray.Data.TwoG.length; idx++) {
$("#2gdiv").append(createPageInnerLayout(g_wbdarray.Data.TwoG[idx]));
createDataRows(TWO_G, g_wbdarra... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function buildLayout (props, innerProps) {\n var layout = {};\n\n layout.height = props.height;\n layout.x = props.scale;\n\n return layout;\n }",
"function createInitialLayout() {\n return {\n name: 'grid',\n boundingBox: presetBoundingBox,\n }\n}",
"function aanmake... | [
"0.6822825",
"0.662373",
"0.6506168",
"0.63487023",
"0.6306745",
"0.628772",
"0.61984396",
"0.6186945",
"0.615313",
"0.6107392",
"0.6039224",
"0.6018067",
"0.6010789",
"0.5995127",
"0.5983622",
"0.59781015",
"0.59605587",
"0.5897858",
"0.5897858",
"0.5897858",
"0.58810437",
... | 0.66678184 | 1 |
Parse the json diff and update the ui | function parseJsonDiffAndUpdate(arr, len, tag)
{
for(var i = 0; i < len; i++) {
if(arr[i].type === 'created') {
$(document).trigger("created", [{"tag":tag, "obj":arr[i]}]);
} else if(arr[i].type === 'deleted') {
$(document).trigger("deleted", [{"tag":tag, "obj":arr[i]}]);
} else {
parseInnerObjects(arr[... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function makeDIFF(response, cb) {\n if (response.oldValue != undefined && response.newValue != undefined) {\n var dd = new DiffDOM({\n valueDiffing: false // does not take into account user input\n });\n \n var diff = {};\n console.log(\"Response: \", response);\n\n ... | [
"0.63104355",
"0.59852403",
"0.59821755",
"0.58720493",
"0.58644134",
"0.5780098",
"0.5746988",
"0.5685968",
"0.5530891",
"0.5528389",
"0.54736555",
"0.5442738",
"0.54290056",
"0.54248375",
"0.5411982",
"0.53955126",
"0.52964014",
"0.52686805",
"0.5268514",
"0.5255149",
"0.52... | 0.62855273 | 1 |
Function that prints the actors | function printActors(actors) {
prettyJson.prettyPrint([actors])
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"print(){\n console.log(`boooooooop`);\n for (let i in this._faces){\n console.log(this._faces[i]);\n }\n }",
"function drawActors(actors){\n return elt('div',{},...actors.map((actor)=>{\n let rect = elt('div',{class:`actor ${actor.type}`});\n rect.styl... | [
"0.64477265",
"0.6422306",
"0.63537836",
"0.6270717",
"0.6258602",
"0.6244875",
"0.62413806",
"0.6236288",
"0.61802137",
"0.6123634",
"0.6083369",
"0.607002",
"0.60516804",
"0.6051255",
"0.6040124",
"0.59750575",
"0.589084",
"0.5882465",
"0.5829532",
"0.5825308",
"0.582413",
... | 0.77540135 | 0 |
Function that sets the DebtToken address in DebtKernel | function setDebtToken() {
return new Promise(async(resolve, reject) => {
let contractAddress, zeroAddress = '0x0000000000000000000000000000000000000000'
try {
console.log('KarmaMainAccount: ', karmaMainAccount)
contractAddress = await debtKernelInstance.debtToken.call({from: ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function sendToken2Device (unlockToken) {\n\n}",
"function _setToken(source) {\n //console.log(\"updating token\");\n //console.log(layer.typename + ' - ' + source.get(\"timestamp\") + ' - ' + params.GKT);\n source.updateParams({\n GKT: _getToken(),\n });\n source.set(\"timestamp\", new Date(... | [
"0.5531649",
"0.55194527",
"0.55188614",
"0.5333334",
"0.529976",
"0.52888006",
"0.52824944",
"0.5220257",
"0.5172111",
"0.50824845",
"0.5081961",
"0.5071164",
"0.50575644",
"0.50485784",
"0.50471604",
"0.5038316",
"0.502384",
"0.50143445",
"0.5002874",
"0.49771404",
"0.49765... | 0.7314607 | 0 |
Function that sets EscrowRegistry address in DebtKernel | function setEscrowRegistry() {
return new Promise(async (resolve, reject) => {
let contractAddress, zeroAddress = '0x0000000000000000000000000000000000000000'
try {
contractAddress = await debtKernelInstance.escrowRegistry.call({from: karmaMainAccount})
console.log('escrowReg... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function setDebtToken() {\n return new Promise(async(resolve, reject) => {\n let contractAddress, zeroAddress = '0x0000000000000000000000000000000000000000'\n try {\n console.log('KarmaMainAccount: ', karmaMainAccount)\n contractAddress = await debtKernelInstance.debtToken.ca... | [
"0.5473664",
"0.5429883",
"0.5099206",
"0.49668717",
"0.48871383",
"0.48646557",
"0.48264664",
"0.48050022",
"0.47518432",
"0.46818382",
"0.4674087",
"0.46694988",
"0.46693408",
"0.46671847",
"0.46597674",
"0.46070534",
"0.45717046",
"0.45713884",
"0.45686895",
"0.45632786",
... | 0.71159935 | 0 |
Function that adds authorized mint agent for DebtToken | function addDebtTokenAuthorizedMintAgent(address) {
return new Promise(async (resolve, reject) => {
let agents
try {
agents = await debtTokenInstance.getAuthorizedMintAgents.call({from: karmaMainAccount})
console.log('agents 1', agents)
if (!(lodash.indexOf(agents... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async function mintToken() {\n if (typeof window.ethereum !== 'undefined') {\n await requestAccount();\n const provider = new ethers.providers.Web3Provider(window.ethereum);\n const signer = provider.getSigner();\n const contract = new ethers.Contract(tokenAddress... | [
"0.6604516",
"0.6192753",
"0.6163458",
"0.6081923",
"0.58109164",
"0.57630944",
"0.57479167",
"0.56394714",
"0.5630989",
"0.56058294",
"0.5554981",
"0.54901725",
"0.54425526",
"0.54368794",
"0.52923036",
"0.5279881",
"0.52475065",
"0.5080734",
"0.5047505",
"0.5040843",
"0.503... | 0.7389113 | 0 |
Function that adds authorized insert agent in DebtRegistry | function addDebtRegistryAuthorizedInsertAgent(address) {
return new Promise(async (resolve, reject) => {
let agents
try {
agents = await debtRegistryInstance.getAuthorizedInsertAgents.call({from: karmaMainAccount})
console.log('agents 1', agents)
if (!(lodash.inde... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function addDebtRegistryAuthorizedEditAgent(address) {\n return new Promise(async (resolve, reject) => {\n let agents\n try {\n agents = await debtRegistryInstance.getAuthorizedEditAgents.call({from: karmaMainAccount})\n console.log('agents 1', agents)\n if (!(loda... | [
"0.6677234",
"0.6104963",
"0.56885475",
"0.5685958",
"0.5586842",
"0.543929",
"0.5064141",
"0.50546926",
"0.5054235",
"0.5032209",
"0.5031784",
"0.4975171",
"0.49527064",
"0.49160784",
"0.49160784",
"0.49078956",
"0.49073088",
"0.49066463",
"0.48860854",
"0.4874118",
"0.48631... | 0.72463614 | 0 |
Function that sets authorized edit agent in DebtRegistry | function addDebtRegistryAuthorizedEditAgent(address) {
return new Promise(async (resolve, reject) => {
let agents
try {
agents = await debtRegistryInstance.getAuthorizedEditAgents.call({from: karmaMainAccount})
console.log('agents 1', agents)
if (!(lodash.indexOf(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function internal_setAgentAccess(resource, acpData, webId, access) {\n return internal_setActorAccess(resource, acpData, acp.agent, webId, access);\n}",
"async function setAgentAccess$1(resourceWithAcr, webId, access) {\n const agentAccessModes = await getAgentAccess$1(resourceWithAcr, webId);\n // Add Agent ... | [
"0.5891542",
"0.58543926",
"0.53071153",
"0.5284309",
"0.5226144",
"0.5216793",
"0.51828766",
"0.51756716",
"0.5158967",
"0.5158967",
"0.5158967",
"0.5158967",
"0.5158967",
"0.5158967",
"0.5158967",
"0.5158967",
"0.5158967",
"0.5158967",
"0.5158967",
"0.5158967",
"0.5158967",... | 0.6402837 | 0 |
Function that adds transfer agent in TokenTransferProxy | function addTokenTransferProxyTransferAgent(address) {
return new Promise(async (resolve, reject) => {
let agents
try {
agents = await tokenTransferProxyInstance.getAuthorizedTransferAgents.call({from: karmaMainAccount})
console.log('agents 1', agents)
if (!(lodas... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"static async TokenTo(src, dest, token, to, amount) {\n const tx = await src.Deposit(token, to, amount);\n // wait light client\n return Bridge.CrossRelay(src, dest, tx.transactionHash);\n }",
"attachTo(proxy) {\n proxy.on('proxyRes', (proxyRes, req) => {\n if (req.method !== 'POST... | [
"0.58564055",
"0.5559002",
"0.55482846",
"0.55204934",
"0.5413674",
"0.526677",
"0.52603406",
"0.5257472",
"0.52371264",
"0.5197487",
"0.51367426",
"0.5112624",
"0.5085026",
"0.50656664",
"0.5003582",
"0.49712577",
"0.49274233",
"0.48938656",
"0.48874632",
"0.48868507",
"0.48... | 0.70819616 | 0 |
Function that adds collateralize agent in Collateralizer | function addCollateralizerAuthorizedCollateralizeAgent(address) {
return new Promise(async (resolve, reject) => {
let agents
try {
agents = collateralizerInstance.getAuthorizedCollateralizeAgents.call({from: karmaMainAccount})
console.log('agents 1', agents)
if (!... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function AddTransformer() {}",
"function Classifier() {\n}",
"cocina(){}",
"__setAddCollaboratorFn(payload) {\n this.__addCollaboratorFn = payload;\n }",
"_transform(chunck, encoding, callback) {\n const transformChunk = chunck.toString()\n .replace(/[a-z]|[A-Z]|[0-9]/g, this.replaceCa... | [
"0.5224397",
"0.51227814",
"0.47442243",
"0.45668274",
"0.45455518",
"0.45218205",
"0.45196804",
"0.45085862",
"0.44541353",
"0.44338855",
"0.44192263",
"0.43810517",
"0.43605167",
"0.43117595",
"0.42857563",
"0.42779303",
"0.4272859",
"0.42519534",
"0.42398384",
"0.42276925",
... | 0.54709226 | 0 |
Function that gets the deposited tokens from the Escrow in case of seize collateral | function getDepositedTokensForSeizeCollateral() {
return new Promise(async (resolve, reject) => {
try{
let balance
balance = await erc20TokenInstance.balanceOf.call(escrowInstance.address, {from: karmaMainAccount})
// async.eachSeries(depositors, async(depositor, cb) => {... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function getDepositedTokensWhenCollateralSeized() {\n return new Promise(async (resolve, reject) => {\n try {\n resolve(await baseLogic.getDepositedTokensForSeizeCollateral())\n } catch(error) {\n console.log('error in getDepositedTokensWhenCollateralSeized driver: ', error)\... | [
"0.64520466",
"0.643235",
"0.635012",
"0.60491425",
"0.60253745",
"0.60205185",
"0.56565505",
"0.5475025",
"0.54743016",
"0.54610586",
"0.5381374",
"0.5347943",
"0.5312543",
"0.52700305",
"0.52526367",
"0.52163166",
"0.5204325",
"0.5200051",
"0.5196612",
"0.51912034",
"0.5182... | 0.6740892 | 0 |
Function that unlocks the account | function unlockAccount(account, password = 'password', seconds = 10) {
return new Promise(async(resolve, reject) => {
try {
resolve(await web3APIs.unlockAccount(account, password, seconds))
} catch(error) {
console.log('error in unlockAccount baseLogic: ', error)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async unlockAccount(accountId) {\n return true;\n }",
"async function unlockAccount(address = undefined, password = undefined) {\n if (address === undefined || password === undefined) {\n const config = zxeth.getConf();\n\n address = config.accounts[0];\n password = config.passwords[0];\n }\n\n r... | [
"0.7986489",
"0.7148703",
"0.67981994",
"0.678545",
"0.6670635",
"0.65697396",
"0.64428455",
"0.63932323",
"0.6373507",
"0.63687843",
"0.6349832",
"0.62959963",
"0.6203501",
"0.6175646",
"0.6118721",
"0.60915893",
"0.6055531",
"0.6045798",
"0.60405785",
"0.60336107",
"0.60324... | 0.7503485 | 1 |
Function that locks the account | function lockAccount(account) {
return new Promise(async(resolve, reject) => {
try {
resolve(await web3APIs.lockAccount(account))
} catch(error) {
console.log('error in lockAccount baseLogic: ', error)
reject(error.message)
}
})
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async lockAccount(accountId) {\n return true;\n }",
"async unlockAccount(accountId) {\n return true;\n }",
"async lock() {\n\t\tif (this.lock_status_id === 3) {\n\t\t\treturn;\n\t\t}\n\t\tawait this.send_command(0);\n\t\tawait this.await_event('status:LOCKED');\n\t}",
"function accountUpdate(account)... | [
"0.7942251",
"0.6855745",
"0.6690329",
"0.6589576",
"0.64762175",
"0.64474595",
"0.6399141",
"0.6395999",
"0.6373425",
"0.6329899",
"0.6306543",
"0.6303776",
"0.62855065",
"0.62722045",
"0.62714523",
"0.62356144",
"0.6212045",
"0.61328614",
"0.6129934",
"0.61160386",
"0.60673... | 0.7414073 | 1 |
Function that gets the borrower contract from the borrower registry | function getBorrowerContractFromBorrowerRegistry(hash) {
return new Promise(async(resolve, reject) => {
try {
let borrower = await borrowerRegistryInstance.getBorrowerContractFromRegistry.call(hash)
console.log('Borrower in borrower registry: ', borrower)
resolve({
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function getBorrowerFromBorrowerRegistry(params) {\n return new Promise(async (resolve, reject) => {\n try {\n let userDetails = (await baseLogic.getUserDetailsFromDB(params)).data[0].UserDetails\n console.log('userDetails: ', userDetails)\n let hash = baseLogic.getSHA3({... | [
"0.631549",
"0.6067375",
"0.57924485",
"0.5667415",
"0.55817336",
"0.5553024",
"0.5542305",
"0.5534262",
"0.5461951",
"0.5431482",
"0.53400517",
"0.5337818",
"0.5302855",
"0.52467436",
"0.5243132",
"0.5238551",
"0.52261865",
"0.52121246",
"0.51929265",
"0.51844025",
"0.515997... | 0.7594633 | 0 |
Function that gets the contract address from the transaction hash | function getContractAddrFromTxHash(txHash) {
return new Promise(async (resolve, reject) => {
try{
resolve(await web3APIs.getContractAddressFromTransactionHash(txHash))
} catch (error) {
console.log('error in getContractAddrFromTxHash: ', error)
reject({
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function getHexFromAddress (address) {\n typeforce(types.Address, address)\n const payload = bs58check.decode(address)\n // const version = payload.readUInt8(0)\n const hash = payload.slice(1)\n return hash\n}",
"getAddressChecksumString () {\n return secUtil.toChecksumAddress(this.getAddressString())\n ... | [
"0.6796371",
"0.6615715",
"0.66112626",
"0.645366",
"0.644112",
"0.64360696",
"0.64083284",
"0.6351444",
"0.6246928",
"0.6237566",
"0.62058467",
"0.62007195",
"0.61791104",
"0.61790496",
"0.6176954",
"0.6165153",
"0.61516315",
"0.6132199",
"0.6121927",
"0.6120051",
"0.6106719... | 0.8041658 | 0 |
Function that updates contract address in ContractRegisty | function updateAddressInContractRegistry(params) {
return new Promise(async (resolve, reject) => {
try{
await unlockAccount(karmaMainAccount)
await isMined.checkMining(
await contractRegistryInstance.updateAddress(params.contractType, params.contractAddress, {from: ka... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"updateMainCoinContractAddress(state, mainCoinAddress) {\n state.mainCoinContractAddress = mainCoinAddress\n }",
"updateL2CoinContractAddress(state, L2CoinAddress) {\n state.L2CoinContractAddress = L2CoinAddress\n }",
"function setupContract(address) {\n if(!abis) {\n window.alert(\"AB... | [
"0.6939687",
"0.6875214",
"0.6750046",
"0.6613603",
"0.6415291",
"0.6411012",
"0.627794",
"0.6252051",
"0.62285465",
"0.62235737",
"0.61568755",
"0.613329",
"0.6108184",
"0.6074811",
"0.5991655",
"0.5988966",
"0.5984931",
"0.5958346",
"0.5953149",
"0.58901626",
"0.5881596",
... | 0.7099136 | 0 |
fetch search param from search condition component and join pageable | _fetchSearchParam() {
const column = this.meta._columns.find(column => column.defaultSort)
const sort = this.sortCondition || (column && `${column.slot},desc` || 'id,desc')
console.log(sort)
let _param = {
page: this.page - 1,
size: this.size,
sort,
...this.quer... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"get searchParam () {\n\t\treturn this._searchParam;\n\t}",
"function search(){\n let query;\n if(searchLocation===\"location\"){\n searchLocation(\"\")\n }\n query=`https://ontrack-team3.herokuapp.com/students/search?location=${searchLocation}&className=${searchClass}&term=${se... | [
"0.6720869",
"0.65777755",
"0.6531291",
"0.63867384",
"0.6383867",
"0.63827455",
"0.634897",
"0.6211295",
"0.615657",
"0.6148247",
"0.6146503",
"0.61360496",
"0.60741097",
"0.60717756",
"0.6071438",
"0.607047",
"0.6058438",
"0.6044699",
"0.6021195",
"0.6020261",
"0.6019953",
... | 0.6866195 | 0 |
Create menu selection groups (size, crust, sauce, etc) | function createSelectionGroupsHTML(i) {
var el = document.getElementsByClassName('container-selections');
var options = createSelectionOptionsHTML(inputInfo[i]);
var selGroupHTML =
"<div class='selection-category bdr-lt bdr-rad-lt'>" +
"<div class='bg-red txt-white txt-md txt-ctr pad-rg'>" +
selHeader... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function generateSelectionMenu() {\n // Iterate through the river info to determine the dropdow groupings\n var selectionGroups = [];\n for(var i=0; i < riverInfo.length; i++) {\n if(i == 0) {\n selectionGroups.push(riverInfo[i].state);\n } else {\n if(selectionGroups.includes(riverInfo[i].state... | [
"0.7040184",
"0.63637257",
"0.63270366",
"0.6228775",
"0.6199808",
"0.61997205",
"0.6191431",
"0.6116553",
"0.6102055",
"0.60978293",
"0.60696083",
"0.6056486",
"0.6050548",
"0.6030161",
"0.59767395",
"0.5950474",
"0.59334266",
"0.5921269",
"0.59023523",
"0.5881971",
"0.58682... | 0.661191 | 1 |
Updates classes of cubie. This should be called on completion of animation for every cubie that was involved in animation. | function updateCubie() {
var match = this.className.match(/turn\-(..)/);
this.classList.remove('turn');
this.classList.remove(match[0]);
var step = +match[1][1];
var side = match[1][0];
var layer = layers[side];
var div = this.children[0];
var re = /(cubie-corner-position-)(\d+)/;
if(match = div.className.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function updateClasses() {\n\tcontainerCache = createCacheMap();\n\tObject.keys(queries).forEach(function(key) {\n\t\tvar elements = document.querySelectorAll(queries[key].selector);\n\t\tfor (var i = 0; i < elements.length; i++) {\n\t\t\tupdateClass(elements[i], queries[key]);\n\t\t}\n\t});\n}",
"updateUI() {\n... | [
"0.6439726",
"0.603307",
"0.59249026",
"0.5806606",
"0.57646424",
"0.5683362",
"0.56422657",
"0.56112903",
"0.5525508",
"0.55065894",
"0.5504489",
"0.5494016",
"0.5481015",
"0.54158026",
"0.5415446",
"0.5398239",
"0.53681105",
"0.5362564",
"0.535164",
"0.53397924",
"0.532857"... | 0.66922855 | 0 |
Create the west most panel. | function createWestPanel()
{
westPanel = new Ext.Panel({
id : 'westPanel',
region : 'west',
autoLoad:
{
url: pageInfo.basePath+'/sampleExplorer/showMainSearchPage',
method:'POST'
},
width : 230,
minwidth : 200,
split : false,
border : true,
layout : 'border'
});... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function setWestSize(pp) {\n if (!pp.length) return;\n var ppopts = pp.panel('options');\n pp.panel('resize', {\n width: ppopts.width,\n height: cpos.height,\n left: 0,\n top: cpos.top\n });\n cpos.le... | [
"0.5944279",
"0.5842817",
"0.5790555",
"0.56344074",
"0.54481184",
"0.5427016",
"0.53825325",
"0.5376763",
"0.5372816",
"0.5369493",
"0.53629744",
"0.5322415",
"0.52722347",
"0.5268442",
"0.5267075",
"0.5254651",
"0.52383876",
"0.5218346",
"0.5196217",
"0.5180078",
"0.5145957... | 0.7304362 | 0 |
This creates the center panel including toolbar, main category selection, result data grids. | function createCenterPanel()
{
//Draw our toolbar. Some items are hidden till we select an initial category.
var tb2 = new Ext.Toolbar(
{
id : 'maintoolbar',
title : 'maintoolbar',
items : [
new Ext.Toolbar.Button({
id : 'advancedbutton',
text : '高级工作流',//<SIAT_zh_CN original... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function ProgressCenterPanel() {}",
"function createMainToolbar() {\n\n var toolbar = new Ext.Toolbar([\n {\n id: \"filters-show-button\",\n text: \"显示过滤器\",//<SIAT_zh_CN original=\"Show Filters\">显示过滤器</SIAT_zh_CN>\n handler: showFilters,\n cl... | [
"0.617746",
"0.6069866",
"0.6013841",
"0.58038354",
"0.5772649",
"0.5752921",
"0.5752921",
"0.55654216",
"0.5549374",
"0.5507345",
"0.5507345",
"0.548157",
"0.545608",
"0.54544604",
"0.54494345",
"0.54351556",
"0.54091215",
"0.5397601",
"0.53929204",
"0.53771985",
"0.5360445"... | 0.79939413 | 0 |
Initialize submission popup if no submission currently running | function initialize_submission_popup(){
logging_object = {};
let ancestor = document.getElementById('submission_steps'), descendents = ancestor.children;
for(let i=1; i<=descendents.length; i++){
document.getElementById('submission_step_'+i).style.display="none";
document.getElementById('submiss... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function lockSubmissionPopup(submission) {\n\n showSubmissionPopup(submission);\n\n // Create new popup & separate it from old\n var newPopup = $(\"#nodePopup\").clone();\n var newPopupId = 'nodePopupLocked' + popupGlobalCount;\n newPopup.attr({'id' : newPopupId});\n newPopup.css('z-index', 10000... | [
"0.634096",
"0.6258118",
"0.62394154",
"0.5932359",
"0.59164244",
"0.57599896",
"0.57415205",
"0.5740744",
"0.5701296",
"0.56998295",
"0.56978905",
"0.568157",
"0.56600755",
"0.56512094",
"0.5646046",
"0.56314397",
"0.55699944",
"0.5546769",
"0.55409193",
"0.5534426",
"0.5508... | 0.72790307 | 0 |
Reset submission view after canceling or finishing | function reset_submission_view(){
close_submission_popup();
document.getElementById('submission_id_display').innerHTML = "";
document.getElementById('submission_button').innerHTML="Evaluate submission";
document.getElementById('submission_button').style.background="";
document.getElementById('submis... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"onCancel() {\n this.resetForm();\n }",
"function reset() {\n self.taskActionList([]);\n self.selectedTasklist([]);\n self.isTaskSelected(false);\n self.actionName('');\n self.actionComments('');\n self.showConfirm... | [
"0.6904702",
"0.6485658",
"0.6479264",
"0.6378736",
"0.63610214",
"0.63496375",
"0.6306766",
"0.62218356",
"0.61550254",
"0.61301136",
"0.6114152",
"0.6056031",
"0.6051953",
"0.60506177",
"0.6049856",
"0.6038606",
"0.60237646",
"0.6020725",
"0.60160923",
"0.5995077",
"0.59470... | 0.7027551 | 0 |
This class defines a complete generic visitor for a parse tree produced by RomeParser. | function RomeVisitor() {
antlr4.tree.ParseTreeVisitor.call(this);
return this;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"visitNode(node) { }",
"visit(node, context) {\n if (node instanceof AST) {\n node.visit(this, context);\n }\n else {\n node.visit(this);\n }\n }",
"visit(node, context) {\n if (node instanceof AST) {\n node.visit(this, context);\n }\... | [
"0.66554815",
"0.6079898",
"0.6079898",
"0.59773856",
"0.5972497",
"0.5972497",
"0.5972497",
"0.58396095",
"0.5726489",
"0.57154924",
"0.5694333",
"0.55464494",
"0.55259794",
"0.54831123",
"0.5468738",
"0.54452986",
"0.5438627",
"0.5401391",
"0.5397267",
"0.53775704",
"0.5354... | 0.6873944 | 0 |
Returns the index of the value to be solved for pH(1), pKa(2), A(3), HA(4) | function getSolve(){
for(let i = 0; i < solve.length; i++){
if(solve[i]){
return i;
}
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function index(value) {\n var match = this.detect(function(pair) { \n return pair.value === value; \n });\n return match && match.key;\n }",
"function getIndex(name){\n name = String(name);\n switch (name){\n case 'A':\n return 0;\n case 'B':\n return 1;\n... | [
"0.5898448",
"0.58899754",
"0.58308274",
"0.5794643",
"0.57933867",
"0.5716607",
"0.5624305",
"0.5619093",
"0.5584012",
"0.5581908",
"0.5570315",
"0.55454534",
"0.5525561",
"0.5515875",
"0.55144215",
"0.5505613",
"0.54536325",
"0.544527",
"0.54226214",
"0.54223305",
"0.539970... | 0.61683905 | 0 |
Checks only if this is a consumable item | isConsumable(){
return (this._charges !== 0 || this.charges === -1) && Boolean(this.use_action);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function hasItem (item){\n\t\treturn true;\n}",
"async checkSubItems() {\n if (this.processingState.canContinue && !this.processingState.isProcessedToConsensus)\n await this.checkSubItemsOf(this.item);\n }",
"hasItem() {\n return this.size > 0\n }",
"hasItems() {\n retur... | [
"0.596349",
"0.59294224",
"0.58879876",
"0.58113396",
"0.57829356",
"0.57078266",
"0.56625617",
"0.564544",
"0.5585519",
"0.55763024",
"0.55271906",
"0.548196",
"0.548196",
"0.548196",
"0.548196",
"0.5476591",
"0.547467",
"0.54687124",
"0.5435064",
"0.5435064",
"0.54318005",
... | 0.67423326 | 0 |
Returns points of armor based on Asset.defaultArmorPoints | getArmorPoints(){
// Non-damageable shouldn't draw
if( !this.isDamageable() )
return 0;
// Item is broken, provide no protection
if( this.durability <= 0 )
return 0;
// Item is not in someone's inventory, this shouldn't happen triggered, but be a catch here regardless and return 0
if( !(this.parent... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"get pointsToApply() {\n let pointsToApply = this.unmodifiedPointsToApply\n if (this._parent.useLocationModifiers) {\n if ([hitlocation.EXTREMITY, hitlocation.LIMB].includes(this._parent.hitLocationRole)) {\n return Math.min(pointsToApply, Math.floor(this._parent.locationMaxHP))\n }\n }\n ... | [
"0.66916054",
"0.63431597",
"0.614597",
"0.5760197",
"0.57431436",
"0.57421446",
"0.5720043",
"0.5627941",
"0.5627941",
"0.5613159",
"0.5613159",
"0.5613159",
"0.5594816",
"0.5575023",
"0.5506242",
"0.5506242",
"0.5506242",
"0.5506242",
"0.5506242",
"0.5506242",
"0.5506242",
... | 0.7424116 | 0 |
Repairs the object. If points is a NaN value, it restores ALL durability points Returns the amount of points gained | repair( points ){
let pre = this.durability;
if( isNaN(points) )
points = this.getMaxDurability();
if( points < 0 )
return 0;
this.durability += points;
if( this.durability > this.getMaxDurability() )
this.durability = this.getMaxDurability();
if( (pre === 0) != (this.durability !== 0) && this.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"clear() { this._points.length = 0; }",
"numPoints() { return this._points.length; }",
"function clearPoints()\n{\n\tpoints = [];\n}",
"awardPoints(numPoints) {\n this.points += numPoints;\n }",
"get points() { return this._points; }",
"function incrementPoints() {\n currentPointValue++;\... | [
"0.62742066",
"0.60943055",
"0.5862657",
"0.5612485",
"0.55618244",
"0.5558728",
"0.5555397",
"0.55416715",
"0.55203485",
"0.5350933",
"0.5336969",
"0.5273152",
"0.52696174",
"0.5262165",
"0.5231454",
"0.5207038",
"0.51910514",
"0.5185567",
"0.51807046",
"0.516009",
"0.511276... | 0.6667651 | 0 |
Loot that can be autogen | static getGeneratable(){
return glib.getAllValues(this.name).filter(el => el.genLoot);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"handleLootDistribution (reactionInfo, battle) {\r\n let players = Util.getEffectiveCharacters(this.players).players;\r\n let empty = false;\r\n if (!battle.itemsToDistribute) {\r\n // Battle just finished, generate the listo\r\n battle.itemsToDistribute = [].concat(...battle.graveyard.filter(dea... | [
"0.6302479",
"0.625406",
"0.61575675",
"0.5994366",
"0.59926605",
"0.5991267",
"0.5971736",
"0.5913381",
"0.5905513",
"0.58397824",
"0.5814872",
"0.5770312",
"0.57265437",
"0.5619418",
"0.55844474",
"0.5549172",
"0.55308753",
"0.55300933",
"0.5504575",
"0.5476374",
"0.5475896... | 0.69766706 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.