Search is not available for this dataset
query
stringlengths
7
355k
document
stringlengths
9
341k
metadata
dict
negatives
listlengths
0
101
negative_scores
listlengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
This logs a move to movesList. In chess the move log should show The alternation between white and black. 1. whitemove blackmove 2. W B 3. W B+ 4. Kf1 ...
logMove(move) { this.turn == 'W' ? this.movesList.append('<li>' + move + '</li>') : this.movesList.children().last().append(' ' + move); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "highlightMoves(moves) {\n // Clear all the highlights\n this.clearHighlights();\n\n // Exit if there are no moves available for this square\n if (moves.length === 0) return;\n\n // Go through every move\n moves.forEach(move => {\n // By default we want to highlight the \"to\" of the move, wh...
[ "0.6530052", "0.65204674", "0.62646693", "0.6260845", "0.62532663", "0.62388116", "0.6209108", "0.6189011", "0.61782056", "0.614119", "0.6140383", "0.6139032", "0.61380076", "0.610256", "0.6097944", "0.6089283", "0.6063607", "0.6053925", "0.60390604", "0.60278064", "0.5990659...
0.76269454
0
Clears the move log.
clearMoveLog() { $('#movesList').text(''); }
{ "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 }", "clearLog () {\n this.store.upd...
[ "0.71803546", "0.7025798", "0.7025798", "0.6835445", "0.65776014", "0.6575216", "0.6536027", "0.6531532", "0.64855355", "0.6482217", "0.64688027", "0.6408254", "0.6304534", "0.6288951", "0.6260696", "0.6246438", "0.6246438", "0.62296414", "0.61007625", "0.60044336", "0.597501...
0.7896571
0
Gives the user an error message when they try to make an illegal move.
moveError(text) { // alert() is a standard browser feature. alert('Invalid move: ' + text); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function outOfBound(newMove) {\n if (newMove > 410 || newMove < 10) {\n promptError(\"You shall not pass!\");\n return true;\n } else return false;\n}", "move() {\n throw \"Move method not implemented\";\n }", "isValidMove(){\n\n }", "moveIsValid() {}", "function move(move_str) {\...
[ "0.7045479", "0.65824807", "0.6514869", "0.64963615", "0.6288471", "0.60925114", "0.6086403", "0.60680616", "0.60194033", "0.6009671", "0.6005384", "0.59582376", "0.5949412", "0.5937922", "0.58788866", "0.58685505", "0.5832385", "0.5827284", "0.5803572", "0.57895243", "0.5784...
0.7354566
0
Switch who's turn it is to move.
switchTurn() { this.turn = (this.turn == 'W' ? 'B' : 'W'); this.turnStatus.text(this.turn == 'W' ? 'White:' : 'Black:'); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "switchTurn() {\n if (!this.extraTurn) {\n this.playerOne.isTurn = !this.playerOne.isTurn;\n this.playerTwo.isTurn = !this.playerTwo.isTurn;\n }\n else {this.extraTurn = false;}\n }", "switchTurn() {\n\t\tif (this.turn == Const.TEAM.B) {\n\t\t\tthis.turn = Const.TEAM.W;\n\t\...
[ "0.7555698", "0.75374216", "0.75374216", "0.7437275", "0.73785216", "0.7367132", "0.7280032", "0.7148574", "0.70661277", "0.7046202", "0.69834083", "0.6964826", "0.6934006", "0.6928219", "0.6903084", "0.6851947", "0.6850029", "0.68421185", "0.6831124", "0.6825047", "0.6822254...
0.6768939
26
Querying contained values //////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////// Returns `true` if the result is `Ok`.
isOk() { return this.value !== void 0 }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function resultHasData(result){\n\tif('out_of_scope' in result)\n\t\treturn false;\n\tfor(var a = 0; a < types.length; a++){\n\t\tif(types[a] in result && result[types[a]].length > 0)\n\t\t\treturn true;\n\t}\n\n\treturn false;\n}", "any() {\n return Object.keys(this._rawQuery).length > 0;\n }", "any...
[ "0.64473593", "0.6402854", "0.6402854", "0.6339954", "0.5986243", "0.5835948", "0.5829555", "0.57705945", "0.57705945", "0.5731047", "0.56658345", "0.56658083", "0.566311", "0.5644481", "0.5644481", "0.56388515", "0.5604054", "0.5536359", "0.55069363", "0.5498552", "0.5486863...
0.52963203
40
Returns `true` if the result is `Err`.
isErr() { return !this.isOk() }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "isErr() {\n return true;\n }", "isErr() {\n return false;\n }", "function isError(val) {\n return val instanceof Error;\n }", "function isError(val) {\n return val instanceof Error;\n }", ...
[ "0.78159267", "0.78062105", "0.67740846", "0.67513174", "0.66221476", "0.6542444", "0.65275145", "0.64730287", "0.6277393", "0.6191065", "0.6190623", "0.6120643", "0.6120643", "0.6120643", "0.6110137", "0.6107709", "0.6057571", "0.60556483", "0.6031468", "0.597246", "0.597167...
0.7868791
0
Transforming contained values //////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////// Maps a `Result` to `Result` by applying a function to the `Ok` value.
map(fn) { if (this.isOk()) { return Ok(fn(this.value)) } return this }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function mapOrElseForResult(input, recoverer, transformer) {\n if (input.ok) {\n var result = transformer(input.val);\n return result;\n }\n var fallback = recoverer(input.err);\n return fallback;\n}", "andThen(fn) {\n if (this.isOk()) {\n let result = fn(this.value)\n if (...
[ "0.61576843", "0.5864784", "0.5714493", "0.54655516", "0.544562", "0.54271793", "0.54189223", "0.5343658", "0.5334186", "0.53218603", "0.5299204", "0.5298927", "0.52802956", "0.52721983", "0.52599126", "0.52541643", "0.5245489", "0.52430284", "0.5242211", "0.5242211", "0.5235...
0.69167924
0
Maps a `Result` to `Result` by applying a function to the `Err` value.
mapErr(fn) { if (this.isErr()) { return Err(fn(this.error)) } return this }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "mapErr(mapErrFn) {\n return mapErr(mapErrFn, this);\n }", "mapErr(mapErrFn) {\n return mapErr(mapErrFn, this);\n }", "function mapError_(self, f) {\n return P.foldM_(self, e => P.fail(f(e)), P.succeed);\n}", "function mapError_(self, f, __trace) {\n return (0, _managed.managedApply)(T.m...
[ "0.700677", "0.700677", "0.6544414", "0.61301345", "0.61269873", "0.598804", "0.58612096", "0.5860865", "0.57655466", "0.57148033", "0.5606959", "0.55165607", "0.5480911", "0.5478262", "0.5469203", "0.5429935", "0.5392328", "0.52791417", "0.5249759", "0.52075833", "0.5207433"...
0.701652
0
Boolean operations on contained values /////////////////////////////////// /////////////////////////////////////////////////////////////////////////// Returns `other` if the AND operation is `Ok`, otherwise the `Err` value of `this`.
and(rhs) { if (this.isErr()) { return this } return rhs }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function andOp(a, b){\r\n return (a === true) ? b :\r\n (a === false) ? false : error(and);\r\n}", "function and(a, b) {\n return a && b;\n }", "function and(bool1, bool2) {\n return bool1 && bool2;\n}", "function and(a, b) {\n if(a === true && b === true){\n ...
[ "0.6433763", "0.63354504", "0.6105896", "0.60706055", "0.5973542", "0.5943956", "0.5793718", "0.57263595", "0.56952477", "0.56528676", "0.56528676", "0.5642075", "0.5642075", "0.5642075", "0.5642075", "0.5642075", "0.5642075", "0.5642075", "0.5593756", "0.55536115", "0.555361...
0.6748109
0
Calls `fn` if the result is `Ok`, otherwise returns the `Err` value of `this`.
andThen(fn) { if (this.isOk()) { let result = fn(this.value) if (!_isResult(result)) { throw TypeError( `Expected function to return Result type, received ${typeof result}.` ) } return result } return this }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "unwrapOrElse(fn) {\n if (this.isOk()) {\n return this.value\n }\n return fn(this.error)\n }", "static try(fn) {\n try {\n return Ok(fn())\n } catch (error) {\n return Err(error)\n }\n }", "orElse(fn) {\n if (this.isOk()) {\n return this\n }\n let result = fn(thi...
[ "0.67803496", "0.6660261", "0.6534497", "0.6004971", "0.5927075", "0.5763685", "0.56865245", "0.56597763", "0.5634055", "0.55397695", "0.55207944", "0.5510929", "0.5486169", "0.5456309", "0.5446602", "0.5411995", "0.5383538", "0.5370767", "0.5366788", "0.5354094", "0.53533506...
0.61273235
3
Returns `other` if the result is `Err`, otherwise returns the `Ok` value of `this`. If you are passing the result of a function call, it is recommended to use `orElse`.
or(rhs) { if (this.error && rhs.error) return rhs if (this.error) return rhs if (rhs.error) return this return this }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "orElse(fn) {\n if (this.isOk()) {\n return this\n }\n let result = fn(this.error)\n if (!_isResult(result)) {\n throw TypeError(\n `Expected function to return Result type, received ${typeof result}.`\n )\n }\n return result\n }", "function orForResult(a, b) {\n if (a....
[ "0.7383851", "0.67398506", "0.6285134", "0.6118244", "0.60053825", "0.5859331", "0.5859331", "0.56388456", "0.5554643", "0.5508886", "0.5456593", "0.5441862", "0.52651495", "0.5225599", "0.52247864", "0.5223104", "0.5220101", "0.5196486", "0.51923364", "0.5154003", "0.5122959...
0.6711299
2
Calls `fn` if the result is `Err`, otherwise returns the `Ok` value of `this`.
orElse(fn) { if (this.isOk()) { return this } let result = fn(this.error) if (!_isResult(result)) { throw TypeError( `Expected function to return Result type, received ${typeof result}.` ) } return result }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "static try(fn) {\n try {\n return Ok(fn())\n } catch (error) {\n return Err(error)\n }\n }", "unwrapOrElse(fn) {\n if (this.isOk()) {\n return this.value\n }\n return fn(this.error)\n }", "mapErr(fn) {\n if (this.isErr()) {\n return Err(fn(this.error))\n }\n ret...
[ "0.6631256", "0.662462", "0.62483525", "0.6222425", "0.60368836", "0.5862301", "0.56680745", "0.564289", "0.5569639", "0.55221725", "0.5488826", "0.5477669", "0.5440556", "0.53725123", "0.53656375", "0.5358038", "0.53202724", "0.53084475", "0.52994096", "0.5240783", "0.523806...
0.6675553
0
Unwraps a result, returning the content of an `Ok`. If the value is an `Err` then it calls `fn` with its value.
unwrapOrElse(fn) { if (this.isOk()) { return this.value } return fn(this.error) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function maybeUnwrapFn(value) {\n if (value instanceof Function) {\n return value();\n } else {\n return value;\n }\n}", "function maybeUnwrapFn(value) {\n if (value instanceof Function) {\n return value();\n }\n else {\n return value;\n }\n}", "function maybeUnwrapFn(value) ...
[ "0.5697142", "0.56837165", "0.56837165", "0.56837165", "0.56837165", "0.56837165", "0.56837165", "0.56837165", "0.56308997", "0.56132096", "0.5595228", "0.5525732", "0.54870105", "0.54800004", "0.51484096", "0.50418323", "0.50394124", "0.49802434", "0.49623471", "0.49623471", ...
0.7425568
0
Unwraps a result, returning the content of an `Ok`. Throws if the value is an `Err`, with a message provided by the `Err` value.
unwrap() { if (this.isOk()) { return this.value } throw Error('Called `Result#unwrap()` on an `Err` value: ' + this.error) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "unwrapErr() {\n if (this.isErr()) {\n return this.error\n }\n throw Error('called `Result#unwrapErr()` on an `Ok` value: ' + this.value)\n }", "unsafelyUnwrapErr() {\n throw new Error('Tried to `unsafelyUnwrapErr` an `Ok`');\n }", "function unwrapError(result) {\n if (result.hasOwnP...
[ "0.7107937", "0.67044055", "0.6409001", "0.6039596", "0.56858337", "0.5501596", "0.54165566", "0.52811545", "0.5261396", "0.51645803", "0.51348424", "0.5047471", "0.49793625", "0.49673903", "0.49673903", "0.49673903", "0.49673903", "0.49673903", "0.49512953", "0.490347", "0.4...
0.7219281
0
Unwraps a result, returning the content of an `Ok`. Throw if the value is an `Err`, with a message including the passed message, and the content of the `Err`.
expect(errorMessage) { if (this.isOk()) { return this.value } throw Error(`${errorMessage} ${this.error}`) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "unwrapErr() {\n if (this.isErr()) {\n return this.error\n }\n throw Error('called `Result#unwrapErr()` on an `Ok` value: ' + this.value)\n }", "unwrap() {\n if (this.isOk()) {\n return this.value\n }\n throw Error('Called `Result#unwrap()` on an `Err` value: ' + this.error)\n }", ...
[ "0.71902746", "0.71686673", "0.69297284", "0.6592587", "0.60859287", "0.5759128", "0.54572344", "0.5453249", "0.53339624", "0.5280241", "0.52562374", "0.5220056", "0.514652", "0.509735", "0.50751907", "0.50731164", "0.50675076", "0.5062729", "0.5015864", "0.49710825", "0.4950...
0.50144714
19
Unwraps a result, returning the content of an `Err`. Throws if the value is an `Ok`, with a message provided by the `Ok` value.
unwrapErr() { if (this.isErr()) { return this.error } throw Error('called `Result#unwrapErr()` on an `Ok` value: ' + this.value) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "unwrap() {\n if (this.isOk()) {\n return this.value\n }\n throw Error('Called `Result#unwrap()` on an `Err` value: ' + this.error)\n }", "unsafelyUnwrapErr() {\n throw new Error('Tried to `unsafelyUnwrapErr` an `Ok`');\n }", "function unwrapError(result) {\n if (result.hasOwnPropert...
[ "0.7448256", "0.6923953", "0.6895838", "0.609694", "0.5706094", "0.5604394", "0.5565443", "0.5522281", "0.5306291", "0.52875084", "0.5243345", "0.5229185", "0.51794094", "0.5176016", "0.5171555", "0.5140687", "0.50928694", "0.4954437", "0.49323744", "0.4897273", "0.4897273", ...
0.75605446
0
Unwraps a result, returning the content of an `Err`. Throw if the value is an `Ok`, with a message including the passed message, and the content of the `Ok`.
expectErr(okMessage) { if (this.isOk()) { throw Error(`${okMessage} ${this.value}`) } return this.error }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "unwrapErr() {\n if (this.isErr()) {\n return this.error\n }\n throw Error('called `Result#unwrapErr()` on an `Ok` value: ' + this.value)\n }", "unwrap() {\n if (this.isOk()) {\n return this.value\n }\n throw Error('Called `Result#unwrap()` on an `Err` value: ' + this.error)\n }", ...
[ "0.7502407", "0.7284817", "0.70678735", "0.687177", "0.614209", "0.5851867", "0.56632334", "0.56088656", "0.54413956", "0.5328104", "0.5322609", "0.52928776", "0.5279235", "0.52758867", "0.5245716", "0.519477", "0.51893914", "0.51846397", "0.51208866", "0.507192", "0.5061623"...
0.5395837
9
Rust question mark operator.
try() { if (this.isOk()) { return this.value } throw this.error }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function _escapeQuestionmark(text) {\r\n return text.replace('?', '%3F');\r\n }", "function qMarkOrAmp( url ) {\n\t\treturn /\\?/ .test( url ) ? \"&\" : \"?\";\n\t}", "function qMarkOrAmp( url ) {\n\t\treturn /\\?/ .test( url ) ? \"&\" : \"?\";\n\t}", "function qMarkOrAmp( url ) {\n\t\treturn /\\?/...
[ "0.5933933", "0.5471258", "0.5471258", "0.5471258", "0.5471258", "0.5362856", "0.5229603", "0.5229603", "0.51739043", "0.513873", "0.512421", "0.5116365", "0.5114673", "0.5025367", "0.5010508", "0.49547163", "0.49547163", "0.49547163", "0.49547163", "0.49218255", "0.4911072",...
0.0
-1
Misc ///////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////// Transposes a `Result` of an `Option` into an `Option` of a `Result`. `Ok(None)` will be mapped to `None`. `Ok(Some(_))` and `Err(_)` will be mapped to `Some(Ok(_))` and `Some(Err(_))`
transpose() { if (this.isErr()) { return Some(this) } let containedType = this.value.constructor.name if (containedType !== 'Option') { // What does Rust do in this case? throw TypeError( 'Expected contained value to have type `Option`, instead is' + containedType ) } if (this.value.isSome()) { let value = this.value.unwrap() return Some(Ok(value)) } return None() }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function orForResult(a, b) {\n if (a.ok) {\n return a;\n }\n return b;\n}", "fromResult(aResult) {\n return require('folktale/conversions/result-to-maybe')(aResult);\n }", "fromMaybe(aMaybe, failureValue) {\n return require('folktale/data/conversions/maybe-to-result')(aMaybe, failureValu...
[ "0.5686198", "0.54408246", "0.54246336", "0.5187622", "0.48439685", "0.48417574", "0.48117873", "0.479015", "0.47418147", "0.46171105", "0.45922807", "0.45922807", "0.4563749", "0.45512676", "0.44752908", "0.44570053", "0.44526795", "0.44469354", "0.4418492", "0.438463", "0.4...
0.628668
0
Try catch wrapper into `Result`.
static try(fn) { try { return Ok(fn()) } catch (error) { return Err(error) } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "try() {\n if (this.isOk()) {\n return this.value\n }\n throw this.error\n }", "function tryCatch(fn,obj,arg){try{return {type:\"normal\",arg:fn.call(obj,arg)};}catch(err){return {type:\"throw\",arg:err};}}", "function tryCatch(fn,obj,arg){try{return{type:\"normal\",arg:fn.call(obj,arg)};}catch(e...
[ "0.7087586", "0.6401273", "0.63119394", "0.63119394", "0.63119394", "0.63119394", "0.63119394", "0.6299065", "0.6299065", "0.6299065", "0.6299065", "0.6299065", "0.6299065", "0.6299065", "0.61345786", "0.6120853", "0.60105574", "0.60105574", "0.6008132", "0.6000361", "0.59919...
0.6882039
1
Functions Prevent form from submitting
function addTodo(event) { event.preventDefault(); //Todo Div const todoDiv = document.createElement ('div'); todoDiv.classList.add('todo'); //Create Li const newTodo = document.createElement('li') newTodo.innerText = todoInput.value; newTodo.classList.add ('todo-item'); todoDiv.appendChild(newTodo); //check mark button const completedButton = document.createElement('button'); completedButton.innerHTML = '<span class="material-icons">done</span>' completedButton.classList.add('complete-btn'); todoDiv.appendChild(completedButton); //check trash button const trashButton = document.createElement('button'); trashButton.innerHTML = '<span class="material-icons">delete</span>' trashButton.classList.add('trash-btn'); todoDiv.appendChild(trashButton); //Append to list todoList.appendChild(todoDiv); //clear todo input value todoInput.value = ""; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "preventSubmitUnlessValid() {\n }", "function preventSubmission(e) {\n e.preventDefault();\n}", "function preventSubmit() {\n event.preventDefault();\n }", "function handleDisabledSubmit() {\n jQuery('form').submit(function() {\n return false;\n });\n }", "preventSubmitIfUploadin...
[ "0.8085539", "0.7824095", "0.78000385", "0.77264327", "0.7542758", "0.7429934", "0.7363702", "0.72615176", "0.7244403", "0.721412", "0.7105996", "0.70898277", "0.70164895", "0.6999578", "0.6983829", "0.6975994", "0.69734734", "0.69632876", "0.6961198", "0.6952679", "0.6948851...
0.0
-1
a function that returns the string with the first letter capitalized
function capitalizeName (name) { console.log(name[0].toUpperCase() + name.slice(1)) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function capitalFirstLetter(name) {\n return name.charAt(0).toUpperCase() + name.slice(1)\n}", "function cap_first(s) {\n return s[0].toUpperCase() + s.substring(1); \n}", "static capitalizeFirstLetter(string){\n return string.charAt(0).toUpperCase() + string.substring(1)\n }", "function capitalie(...
[ "0.84762406", "0.8383346", "0.83832735", "0.8337346", "0.8295528", "0.82895595", "0.8289288", "0.82815975", "0.8260143", "0.82403374", "0.82340944", "0.8233113", "0.8222727", "0.822196", "0.82200456", "0.82118636", "0.8205552", "0.82038605", "0.82038605", "0.82038605", "0.820...
0.0
-1
a function that returns the last letter of a string
function lastLetter (string) { console.log(string.charAt(string.length-1)) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function lastLetter(inputString) {\n if(inputString === undefined){\n return ;\n } \n else {\n return inputString[inputString.length-1];\n }\n}", "function LastChar (stringname){\n\treturn stringname.slice(-1);\n}", "function getLastLetter(word) {\n const lastIn...
[ "0.88169396", "0.8668248", "0.8595069", "0.85336214", "0.85162467", "0.83689296", "0.81770015", "0.80578816", "0.8026565", "0.7666725", "0.7580685", "0.7536579", "0.7498777", "0.74938864", "0.72903514", "0.7207802", "0.72070545", "0.71678436", "0.71549535", "0.7095804", "0.69...
0.8871458
0
FUNCTION: fnValidateConfigGroups() TODO: write a brief description of this function
function fnValidateConfigGroups(sharedb){ const isAlreadyUsed = { either: [isIncludedIn(sharedb.users), isPropOf(sharedb.groups)] }; const isValidGroup = { check: [ { has: ["name", "members"], error: `GROUPS IN 'groups' MUST HAVE 'name' AND 'members' PROPERTIES` }, { prop: "name", check: isValidUsername, error: `THERE IS A GROUP NAME DEFINED IN 'groups' THAT IS NOT VALID` }, { prop: "name", not: isIncludedIn(fnListGroups()), error: groupname => `GROUP '${groupname}' ALREADY EXISTS IN THE OS` }, { prop: "name", not: isIncludedIn(fnListUsers()), error: groupname => `GROUP '${groupname}' ALREADY EXISTS IN THE OS AS A USER` }, { prop: "name", not: isAlreadyUsed, error: groupname => `GROUP NAME '${groupname}' HAS BEEN USED MORE THAN ONCE` }, { check: { prop: "members", arrLength: { greater: 0 } }, error: group => `'members' PROPERTY OF GROUP '${group["name"]}' MUST BE A NON-EMPTY ARRAY` }, { check: { prop: "members", every: isAlreadyUsed }, error: group => `GROUP '${group["name"]}' CONTAINS USERS OR GROUPS THAT HAVE NOT BEEN DEFINED IN 'config.json'` } ], doo: (group) => { // calculate all the members of group // in case an element of group["members"] is a group, retrieve all the members of that group let members = []; group["members"].forEach((member) => { if (sharedb.users.includes(member)){ members.push(member); } else if (fnHas(sharedb.groups, member)){ members = members.concat(sharedb.groups[member]); } }); members = fnRemoveDuplicates(members); // put group into sharedb sharedb.groups[group["name"]] = members; } }; const isValidGroupsProperty = [ { arrLength: { greater: 0 }, error: `'groups' MUST BE A NON-EMPTY ARRAY` }, { every: isValidGroup } ]; return { inCase: { has: "groups" }, prop: "groups", check: isValidGroupsProperty }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "_validateConfig() {\n if (!Array.isArray(this.options.configGroups)) {\n throw new Error('options.configGroups is not an array');\n } else if (!this.options.configGroups.length) {\n throw new Error('options.configGroups must have at least one config object');\n }\n // checking fields which MU...
[ "0.7097831", "0.62264645", "0.5642778", "0.5627486", "0.5612234", "0.5555954", "0.5504171", "0.54452854", "0.5401068", "0.53799313", "0.5300493", "0.5250178", "0.51949394", "0.5180082", "0.51686937", "0.5166118", "0.5156199", "0.5156026", "0.51431006", "0.513955", "0.513123",...
0.72597337
0
only use for testing
getState() { return { side: this.side, orderMap: this.orderMap.getState() }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private public function m246() {}", "private internal function m248() {}", "transient private protected internal function m182() {}", "protected internal function m252() {}", "transient private internal function m185() {}", "transient protected internal function m189() {}", "transient final protected i...
[ "0.70010793", "0.6916413", "0.6536674", "0.64603883", "0.63877285", "0.6357284", "0.6116881", "0.6114021", "0.6052421", "0.60061157", "0.59596455", "0.5945757", "0.5932334", "0.58691967", "0.5867019", "0.5862008", "0.5840288", "0.5798122", "0.57459927", "0.57401234", "0.56559...
0.0
-1
put order on book
putOrderOnBook(order) { if (!this.orderMap.addOrder(order)) { logger.error('orderbookside.js putOrderOnBook(): ERROR when put order on book'); return false; } return true; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function addToBook(book, order) {\n let orders;\n if (book.has(order.price)) {\n orders = book.get(order.price);\n }\n else {\n orders = [];\n book.set(order.price, orders)\n }\n\n orders.push(order);\n\n return book;\n}", "function placeOrder() {\n updating = true;\n updateQuantity();\n ...
[ "0.70826876", "0.6894183", "0.6616857", "0.6575546", "0.6479946", "0.64786404", "0.62913525", "0.62721145", "0.6248296", "0.6224316", "0.616453", "0.616453", "0.61630017", "0.6125912", "0.61216414", "0.609349", "0.6093289", "0.60915464", "0.6077531", "0.6068811", "0.6064131",...
0.7396126
0
remove order from book
removeOrder(order) { if (!this.orderMap.removeOrder(order)) { logger.error('orderbookside.js removeOrder(): ERROR when remove order from book'); return false; } return true; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function removeBook() {\n const book = this.parentElement;\n for (let i = 0; i < library.length; i++) {\n if (library[i].timestamp.toString() === book.id) {\n removeBookInStorage(library.splice(i,1)[0]);\n break;\n }\n }\n book.remove();\n}", "function removeBook(a...
[ "0.70559335", "0.69367665", "0.6867659", "0.6836928", "0.6803233", "0.67730385", "0.67648476", "0.675655", "0.67356837", "0.6728842", "0.6687274", "0.6673045", "0.6631965", "0.66044784", "0.65675527", "0.6565749", "0.65469337", "0.65326196", "0.6509825", "0.65085816", "0.6494...
0.69607526
1
update quantity of existing order on book
updateQuantity(order) { // check if new quantity is valid const oldOrder = this.getOrderByLimitPriceAndOrderId(order.limitPrice, order._id); if (oldOrder) { if (oldOrder.filledQuantity <= order.quantity) { return this.orderMap.updateOrderQuantity(order); } logger.error(`orderbookside.js updateQuantity(): ERROR: order id ${order._id} has new quantity ${order.quantity} < filled quantity ${oldOrder.filledQuantity}`); return null; } logger.error(`orderbookside.js updateQuantity(): ERROR: not found this order id ${order._id} at price ${order.limitPrice}`); return null; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function updateQuantity() {\n var query = connection.query(\n \"UPDATE products SET ? WHERE ?\",\n [\n {\n stock_quantity: updatedStock\n },\n {\n item_id: answer.userId\n }\n ],\n )...
[ "0.71133137", "0.6947179", "0.68583107", "0.67770845", "0.6757709", "0.6683107", "0.66806805", "0.6679177", "0.6675913", "0.66689795", "0.6585602", "0.6580692", "0.657083", "0.65564775", "0.6527582", "0.652676", "0.6520277", "0.6511613", "0.6509537", "0.6505604", "0.6486831",...
0.68253225
3
order matching core logic. Try to match the given order against counter orders of the book side.
tryToMatch(order) { let matchingEventList = []; const ohlcvData = {}; while (order.remainingQuantity() > ZERO) { const bestPriceLevel = this.bestPrice(); if (bestPriceLevel && order.fulfill(bestPriceLevel)) { const tradingEvent = this.match(order, bestPriceLevel); logger.debug(`orderbookside.js: tryToMatch(): tradingEvent = ${JSON.stringify(tradingEvent)}`); matchingEventList = matchingEventList.concat(tradingEvent.matchingEventList); // update ohlcv data if (!ohlcvData.time) ohlcvData.time = tradingEvent.matchingEventList[0].matchedAt.getTime(); if (!ohlcvData.open) ohlcvData.open = bestPriceLevel; ohlcvData.close = bestPriceLevel; ohlcvData.high = ohlcvData.high ? Math.max(bestPriceLevel, ohlcvData.high) : bestPriceLevel; ohlcvData.low = ohlcvData.low ? Math.min(bestPriceLevel, ohlcvData.low) : bestPriceLevel; ohlcvData.volume = ohlcvData.volume ? (ohlcvData.volume + tradingEvent.volume) : tradingEvent.volume; } else break; } logger.debug(`orderbookside.js: tryToMatch(): matchingEventList = ${JSON.stringify(matchingEventList)}`); logger.debug(`orderbookside.js: tryToMatch(): ohlcvData = ${JSON.stringify(ohlcvData)}`); return { matchList: matchingEventList, ohlcvData: ohlcvData, }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "match(order, priceLevel) {\n const matchingEventList = [];\n let volume = 0;\n\n while (true) {\n const tmpLLOE = this.orderMap.getFirstElementOfPriceLevel(priceLevel);\n if (!tmpLLOE) break; // all orders at this price level are matched\n\n const tradedQuantity = Math.min(order.remainingQu...
[ "0.7227484", "0.5913765", "0.58131003", "0.58131003", "0.55971533", "0.55971533", "0.55971533", "0.55971533", "0.5553583", "0.5553583", "0.5553583", "0.5553583", "0.5553583", "0.5553583", "0.54721516", "0.53796023", "0.53565186", "0.52667505", "0.5248089", "0.5195838", "0.509...
0.63000476
1
Returns best available price level of counter orders from point of the view of the order being processed. For BUY order: minimum asked price For SELL order: maximum bid price
bestPrice() { if (this.side === 'ASK') { return this.orderMap.getMinPriceLevel(); } // this.side === 'BID' return this.orderMap.getMaxPriceLevel(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getBestOrderPrice(orderAmount,orderTotal,side,orderbook){if(side.toUpperCase()==='BUY'){var asks=orderbook.asks;// if orderTotal is provided for buy this means pre-fill was used\nif(orderTotal){var total=0;var _index2=asks.length-1;while(total<orderTotal&&_index2>=0){total+=parseFloat(asks[_index2].total)...
[ "0.7429683", "0.64873075", "0.64871806", "0.64784914", "0.6435607", "0.6383589", "0.6338389", "0.6318777", "0.6309288", "0.6243512", "0.62123466", "0.61659634", "0.61411685", "0.61373377", "0.6134009", "0.60983753", "0.60966265", "0.60842943", "0.6065282", "0.6047326", "0.604...
0.8263137
0
order matching core logic
match(order, priceLevel) { const matchingEventList = []; let volume = 0; while (true) { const tmpLLOE = this.orderMap.getFirstElementOfPriceLevel(priceLevel); if (!tmpLLOE) break; // all orders at this price level are matched const tradedQuantity = Math.min(order.remainingQuantity(), tmpLLOE.order.remainingQuantity()); volume += tradedQuantity; logger.info(`orderbookside.js: match(): matches counter order id=${tmpLLOE.order._id} with trade quantity=${tradedQuantity}`); tmpLLOE.order.filledQuantity += tradedQuantity; order.filledQuantity += tradedQuantity; if (tmpLLOE.order.remainingQuantity() <= ZERO) tmpLLOE.order.filledQuantity = tmpLLOE.order.quantity; if (order.remainingQuantity() <= ZERO) order.filledQuantity = order.quantity; matchingEventList.push(OrderBookEvent.createNewMatchObject(tmpLLOE.order, tradedQuantity, tmpLLOE.order.remainingQuantity() <= ZERO)); if (tmpLLOE.order.remainingQuantity() <= ZERO) this.orderMap.removeOrder(tmpLLOE.order); if (order.remainingQuantity() <= ZERO) break; } return { matchingEventList, volume, }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "_orderSort(l, r) {\n return l.order - r.order;\n }", "function typeComparator( auto1, auto2){\r\n priorityArray = [\"roadster\", \"pickup\", \"suv\", \"wagon\"];\r\n\t//console.log(\"\\nFRESH CALL\");\r\n\tvar priority1 = 4;\r\n\tvar priority2 = 4;\r\n\t\r\n\t//rewrite to use forEach\r\n\t//automobiles.fo...
[ "0.5810915", "0.5660123", "0.56570524", "0.5652517", "0.5514181", "0.5509621", "0.5497896", "0.54584944", "0.5446086", "0.5446086", "0.53653157", "0.53576404", "0.53576404", "0.53419584", "0.5287545", "0.5273674", "0.5251138", "0.52427304", "0.5210222", "0.51897407", "0.51734...
0.574074
1
Objects to be references by map markers
function Place(dataObj) { this.locationName = dataObj.locationName; this.latLng = dataObj.latLng; this.lat = dataObj.lat; this.lng = dataObj.lng; this.marker = null; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "transformVehicleObject(vehicles) {\n const markers = vehicles.map((vehicle, index) => {\n const {objectID, latitude, longitude} = vehicle;\n return {\n\n position: {\n lat: Number(latitude),\n lng: Number(longitude)\n },\n key: objectID,\n ...
[ "0.6466075", "0.63700396", "0.62841284", "0.62774295", "0.6266743", "0.62473065", "0.6246114", "0.6197288", "0.61332595", "0.6117121", "0.6107287", "0.6091231", "0.60737646", "0.6050537", "0.60479784", "0.603652", "0.6024102", "0.6011844", "0.6005514", "0.60051787", "0.595744...
0.0
-1
PRIVATE VARIABLES PRIVATE METHODS
function add_properties() { $(".draggable").each(function (index, item) { $(item).resizable({ disabled: false, minWidth: 150, minHeight: 60, containment: "parent", grid: [10, 10], }); $(item).draggable({ disabled: false, handle: "div", containment: "parent", grid: [10, 10], opacity: 0.5, snap: false, snapMode: "both", snapTolerance: 10, stack: ".draggable" }); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "transient private protected internal function m182() {}", "transient protected internal function m189() {}", "private public function m246() {}", "transient private internal function m185() {}", "private internal function m248() {}", "transient final protected internal function m174() {}", "protected i...
[ "0.7276945", "0.7205945", "0.7183663", "0.70755804", "0.68487394", "0.68124324", "0.673489", "0.6672843", "0.6557668", "0.64726573", "0.6452243", "0.64248306", "0.6414229", "0.6412136", "0.6393313", "0.6380714", "0.6357439", "0.6252185", "0.6239861", "0.622002", "0.61619943",...
0.0
-1
wrapped by builder LMD require.stats() example
function loadMd5() { // md5 -> /js/md5.js | CommonJS Module (plain) return require.async('md5'); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function makeStats({data}) {\n\n return [\n\n {\n title: 'Num modules parsed',\n description: 'How many modules did we explore?',\n data: data.modules.length,\n },\n\n {\n title: 'Num components',\n description: 'How many component definitions did we find?',\n data: data.com...
[ "0.58567286", "0.5789431", "0.57887995", "0.57177323", "0.5645289", "0.56218535", "0.5593245", "0.5541766", "0.5486572", "0.54746825", "0.54713815", "0.5465736", "0.54652095", "0.5449378", "0.54466665", "0.54411554", "0.54358584", "0.5427879", "0.54161346", "0.53762275", "0.5...
0.0
-1
x always goes first
function cellPopulator(target) { var currentElement = target; if (!gameover) { if (currentElement.html() == "") { if (turnCounter % 2 == 1) { currentElement.addClass("x"); currentElement.html("X"); turnCounter ++; } else { currentElement.addClass("o"); currentElement.html("O"); turnCounter ++; } } } if (turnCounter >= 5) { if (checkForWinners()) { $(".message").html("Winner is " + winningPlayer + "!!!!").fadeIn(500); } else if (turnCounter >= 10) { $(".message").html("GAMEOVER! There is no winner! Try Again!").fadeIn(500); } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getFirst(x){\n\nactions[i]\n y.first = x[0]\nreturn x\n}", "function firstX(x, y) {\n\treturn -1*y +-0.01*x*(Math.pow(x,2)+Math.pow(y,2));\n}", "getx()\n\t{\n\t\treturn this.x;\n\t}", "x(x) {\n return x == null ? this.bbox().x : this.move(x, this.bbox().y);\n }", "get x() {\n\t\t\t\treturn x;...
[ "0.6414354", "0.6324063", "0.6262474", "0.6229027", "0.62005585", "0.60837716", "0.6009052", "0.595584", "0.5952172", "0.59237796", "0.5894344", "0.5883163", "0.58488137", "0.5840139", "0.5791872", "0.5787284", "0.5780705", "0.57503617", "0.57433385", "0.5733695", "0.5730074"...
0.0
-1
print all data on database with printData()
function loadMsg() { if (userNumber > 0) { if (localStorage.getItem('lang') == "zh-Hant-TW") document.getElementById("savedMessage").innerHTML = "先前的留言:"; else document.getElementById("savedMessage").innerHTML = "Saved Message:"; detectLang(); for (i = userNumber - 1; i >= 0; i--) { console.log("currentlyLoadingUser:" + userNumber); var ref = firebase.database().ref('messageBoard').child(i); ref.child('privacy').on('value', function (snapshot) { colletctData("privacy", snapshot.val(), i) }); ref.child('username').on('value', function (snapshot) { colletctData("name", snapshot.val(), i) }); ref.child('email').on('value', function (snapshot) { colletctData("email", snapshot.val(), i) }); ref.child('message').on('value', function (snapshot) { colletctData("msg", snapshot.val(), i) }); ref.child('datetime').on('value', function (snapshot) { colletctData("datetime", snapshot.val(), i) });; ref.child('response').on('value', function (snapshot) { colletctData("rsp", snapshot.val(), i) }); printData(); } } else { document.getElementById("savedMessage").innerHTML = ""; if (localStorage.getItem('lang') == "zh-Hant-TW") document.getElementById('error').innerHTML = "<span class='text'>目前還沒有留言。</span>"; else document.getElementById('error').innerHTML = "<span class='text'>The message board is empty.</span>"; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function printDatabase() {\n db.find({}, (err, data) => {\n if (err) console.error(\"There's a problem with the database: \", err);\n else if (data) console.log(data);\n });\n}", "print() {\n console.table(this.data);\n }", "printEntireDB() {\n this.bd.getAllBlocks();\n }", "function vi...
[ "0.7198072", "0.71513224", "0.71507543", "0.7140675", "0.6793295", "0.6775856", "0.6737045", "0.6617701", "0.6617701", "0.6575125", "0.64977765", "0.6490404", "0.6482965", "0.6471371", "0.6458081", "0.6432708", "0.642627", "0.63235956", "0.6318803", "0.6316509", "0.62861145",...
0.0
-1
autosave inputs to prevent crash
function loadValue() { document.getElementById('nameInput').value = localStorage.getItem('nameInput'); document.getElementById('emailInput').value = localStorage.getItem('emailInput'); document.getElementById('msgInput').value = localStorage.getItem('msgInput'); if (localStorage.getItem('privacyInput') == "checked") document.getElementById('privacyInput').checked = true; else if (localStorage.getItem('privacyInput') == "unchecked") document.getElementById('privacyInput').checked = false; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function autosave() {\r\n\tif(!changes){\r\n\t\tsetTimeout(save,30000);\r\n\t\tchanges=true;\r\n\t}\r\n}", "function backupInput() {\n lastInput = ELEMENTS.UPDATE_TEXTAREA.val();\n }", "function justSave() {\n interpolateAndSave(false);\n }", "function setSave(e) {\n e.preventD...
[ "0.6757362", "0.66805977", "0.60758424", "0.6046327", "0.597798", "0.5940511", "0.5933236", "0.5916236", "0.59109247", "0.58674806", "0.5844636", "0.5840036", "0.5783494", "0.5783494", "0.57827896", "0.57375836", "0.572041", "0.57094866", "0.57065874", "0.57029885", "0.569424...
0.0
-1
this function prevents user from modifying the board using HTML code. found here >
function HtmlEncode(s) { var el = document.createElement("div"); el.innerText = el.textContent = s; s = el.innerHTML; return s; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function makeHtmlBoard() {\n let htmlBoard = document.getElementById(\"board\");\n\n // create top row that listens for player click\n // click represents col where game piece will be placed\n let top = document.createElement(\"tr\");\n top.setAttribute(\"id\", \"column-top\");\n top.addEventListener(\"click...
[ "0.590389", "0.5830442", "0.58058065", "0.57918704", "0.5741094", "0.56907344", "0.56834644", "0.56724995", "0.5653322", "0.5631426", "0.5609155", "0.56020147", "0.5599678", "0.5595385", "0.55877715", "0.55859536", "0.55756587", "0.5556386", "0.5550119", "0.5548822", "0.55418...
0.0
-1
startGame function which initiate the game
function startGame () { cards = shuffle(cards); let deck = document.getElementsByClassName('deck').item(0); deck.innerHTML = ''; openedCards = []; currCards = []; matchedCounter = 0; moveCounter = 0; moves = document.getElementsByTagName('span').item(0); moves.innerHTML = moveCounter; rank = document.getElementsByClassName('stars').item(0); goodRank = rank.children[2].firstElementChild; fairRank = rank.children[1].firstElementChild; goodRank.className = 'fa fa-star'; fairRank.className = 'fa fa-star'; let restart = document.getElementsByClassName('restart').item(0); restart.addEventListener('click', function() { startGame(); }); seconds = 0; minutes = 0; //set timer every second timerId = setInterval(tick, 1000); complete = document.getElementById('complete'); let replay = document.getElementById('replay'); replay.addEventListener('click', function() { complete.style.display = 'none'; startGame(); }); //create cards and add it to game board for (let card of cards) { let newCard = document.createElement('li'); newCard.className = 'card'; newCard.addEventListener('click', function() { //disable clicking on more than 2 card at a time //disable clicking on matched cards //disable clicking on opened card twice if (currCards.length < 2 && newCard.className !== 'card match' && newCard.className !== 'card open show') { //open card then check match openCard(newCard); checkCard(newCard); } }); let newSymbol = document.createElement('i'); newSymbol.className = card; newCard.appendChild(newSymbol); deck.appendChild(newCard); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function startGame() { }", "function startGame() {\n init();\n}", "function startGame(){\n initialiseGame();\n}", "function startGame() {\n\tsetup();\n\tmainLoop();\n}", "function startGame(){\n\tvar game = new Game();\n\tgame.init();\n}", "function start()\r\n{\r\ninit();\r\ngame.start();\r\n}", ...
[ "0.9081858", "0.86952", "0.8543327", "0.8537398", "0.8463879", "0.8424594", "0.8334982", "0.82401866", "0.81564826", "0.81462914", "0.8143537", "0.81387746", "0.8066887", "0.8054767", "0.80270827", "0.7991733", "0.79431283", "0.79352653", "0.792294", "0.79203296", "0.791909",...
0.0
-1
tick function which set time
function tick() { let timer = document.getElementsByClassName('timer').item(0); if (seconds == 59) { seconds = 0; minutes++; } else { seconds++; } timer.innerHTML = `${minutes} minutes : ${seconds} seconds`; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function tick() {\n\n\n\n}", "function tick() {\n setTime(howOld(createdOn));\n }", "tick() {\n this._last = this._current;\n this._current = now();\n }", "_tick() {\n if (this.startAttr === false) return;\n this.timeAttr = this.timeAttr + (TimerFunction._now() - this.startAttr...
[ "0.7831425", "0.7493929", "0.73774785", "0.73766863", "0.7351446", "0.73462117", "0.734337", "0.73190975", "0.73063505", "0.7290942", "0.7248904", "0.72082347", "0.7195162", "0.71495026", "0.71480554", "0.70761037", "0.7067118", "0.7031194", "0.7025816", "0.69290936", "0.6906...
0.0
-1
openCard function which open clicked card
function openCard(card) { card.className = 'card open show'; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function openCard() {\n\t\tevent.target.classList.toggle('open');\n\t\tevent.target.classList.toggle('show');\n\t}", "function openCard(card) {\n myOpenedCards.push(card);\n card.classList.add('open');\n card.classList.add('show');\n card.style.pointerEvents = 'none';\n myLastTwoCards.push(card);\n}", "fu...
[ "0.815872", "0.7825177", "0.7766275", "0.7746598", "0.774405", "0.7701857", "0.76914555", "0.76765466", "0.7587097", "0.7552714", "0.75142664", "0.7513197", "0.7511288", "0.7493501", "0.74562085", "0.7436088", "0.7382543", "0.7360866", "0.73266625", "0.73032683", "0.7301343",...
0.79954535
1
checkCard function which check match between 2 cards
function checkCard(card) { addMovement(); currCards.push(card); let symbol = card.firstElementChild.className; openedCards.push(symbol); //check if a matched card is already opened if (openedCards.filter(openCard => openCard == symbol).length > 1) { lockCard(); } //check if 2 cards are opened but not matched else if (openedCards.filter(openCard => openCard == symbol).length == 1 && currCards.length == 2) { for (let card of currCards) { card.className = 'card shake'; } //hide unmatched cards after 0.5 second setTimeout(hideCard, 500); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function checkForMatch()\n{\n if(firstCard.dataset.card===secondCard.dataset.card)\n {\n disableCards();\n return true;\n \n \n \n }\n else\n {\n unFlipCards();\n return false;\n \n }\n}", "function checkCardsMatch(card) {\n if(getCard(card) =...
[ "0.8005312", "0.78964037", "0.7729623", "0.7646987", "0.75806177", "0.74971235", "0.7463001", "0.7450694", "0.74214697", "0.7414279", "0.74126446", "0.7412296", "0.739456", "0.7372317", "0.7366723", "0.7359401", "0.73414457", "0.7323055", "0.730533", "0.7291921", "0.7287237",...
0.6929402
51
addMovement function which maintain movement counter and stars rank
function addMovement() { moves.innerHTML = ++ moveCounter; if (moveCounter > 16 && moveCounter <= 32) { goodRank.className = 'fa fa-star-o'; } else if (moveCounter > 32) { fairRank.className = 'fa fa-star-o'; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function addMove() {\n moves++;\n movesCount.innerHTML = moves;\n // start timer after first move\n if (moves == 1) {\n startTimer();\n }\n\n // Set rating after each move\n rating();\n }", "function addMove(){\n moves++;\n movesCounter.textContent = moves;\n //Set Rating:\n ...
[ "0.7366198", "0.72078043", "0.7075407", "0.66428673", "0.6630128", "0.6566601", "0.65394676", "0.6486391", "0.6475728", "0.6471113", "0.6469431", "0.63717264", "0.6362771", "0.63614196", "0.6360004", "0.63589275", "0.6312999", "0.6312374", "0.62849665", "0.62424475", "0.62229...
0.75707567
0
lockCard function which lock 2 cards with correct guess
function lockCard () { matchedCounter++; for (let card of currCards) { card.className = 'card match'; } currCards.pop(); currCards.pop(); if (matchedCounter == 8) { clearInterval(timerId); result = document.getElementsByClassName('result').item(0); starCounter = document.getElementsByClassName('fa fa-star').length; result.innerHTML = `In ${minutes} minutes : ${seconds} seconds, with ${moveCounter} Moves and ${starCounter} Stars.`; complete.style.display = 'block'; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function lockCard() {\n\tif (listOfOpenCards.length === 2){\n\t\tlistOfOpenCards.map(x => x.className = 'card match');\n\t\tlistOfOpenCards = [];\n\t}\n}", "function lockCards() {\n cardOpen[0].setAttribute('class', 'card match');\n cardOpen[1].setAttribute('class', 'card match');\n cardOpen = [];\n moves();...
[ "0.7072086", "0.706842", "0.6578721", "0.65413135", "0.64645475", "0.6377832", "0.63754606", "0.6322397", "0.6287984", "0.6247408", "0.62374914", "0.6225168", "0.62175095", "0.6170377", "0.6159732", "0.614044", "0.61283493", "0.6116892", "0.61154014", "0.6082175", "0.60769045...
0.635479
7
hideCard function which hide 2 cards with incorrect guess
function hideCard() { for (let card of currCards) { card.className = 'card'; } currCards.pop(); currCards.pop(); openedCards.pop(); openedCards.pop(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function hideUnmatchedCards(){\n //If the two cards doesnot match , both the cards disappears\n setTimeout(function() {\n openedCards.forEach(function(card) {\n card.classList.remove('open', 'show');\n });\n openedCards = [];\n },200);\n }", "...
[ "0.77030295", "0.7614863", "0.753513", "0.74781543", "0.72832286", "0.7276782", "0.72627896", "0.7223933", "0.70564747", "0.7046252", "0.70065194", "0.7004371", "0.69964176", "0.69344735", "0.69187635", "0.69099826", "0.6899438", "0.68739575", "0.68546635", "0.6803779", "0.67...
0.73334664
4
Get or request permission for protected functionality within the app. It uses separate permission requesters to interact with a single permission. By default, the hook will only retrieve the permission status.
function usePermission(methods, options) { const isMounted = useRef(true); const [status, setStatus] = useState(null); const { get = true, request = false, ...permissionOptions } = options || {}; const getPermission = useCallback(async () => { const response = await methods.getMethod(Object.keys(permissionOptions).length > 0 ? permissionOptions : undefined); if (isMounted.current) setStatus(response); return response; }, [methods.getMethod]); const requestPermission = useCallback(async () => { const response = await methods.requestMethod(Object.keys(permissionOptions).length > 0 ? permissionOptions : undefined); if (isMounted.current) setStatus(response); return response; }, [methods.requestMethod]); useEffect(function runMethods() { if (request) requestPermission(); if (!request && get) getPermission(); }, [get, request, requestPermission, getPermission]); // Workaround for unmounting components receiving state updates useEffect(function didMount() { isMounted.current = true; return () => { isMounted.current = false; }; }, []); return [status, requestPermission, getPermission]; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "_checkPermission() {\n checkPermission();\n }", "requestPermission() {\n console.log('Requesting permission...');\n // [START request_permission]\n return this.messaging.requestPermission().then(() => {\n console.log('Notification permission granted.');\n // TODO(de...
[ "0.6509124", "0.6169699", "0.6039432", "0.60178536", "0.5991194", "0.5937892", "0.5920611", "0.5885565", "0.57823557", "0.57670754", "0.5758044", "0.5750233", "0.57444215", "0.5730489", "0.57303363", "0.5724205", "0.5607754", "0.55908465", "0.55864835", "0.5577523", "0.555243...
0.5552549
20
Function to hide or show our shape select screen
function shapeSelect(option, message) { option == "show" ? $(".overlay").show() : $(".overlay").hide(); if (message !== null) $(".announce").text(message); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function ShowDrawingTools(val) {\n myDrawingManager.setOptions({\n drawingMode: null,\n drawingControl: val\n });\n}", "function showSelection() {\n\t\tdocument.getElementById(SELECTION).style.visibility = \"visible\";\n\t\tdocument.getElementById(\"overglass\").style.visibility = \"visible\"...
[ "0.7255449", "0.7228772", "0.7183533", "0.7131971", "0.6944886", "0.6836723", "0.6797385", "0.67032003", "0.6694081", "0.6664358", "0.6585121", "0.6557774", "0.653884", "0.6537097", "0.64396745", "0.6400738", "0.63817996", "0.6376922", "0.6306511", "0.6273819", "0.6263348", ...
0.6912055
5
Assigns the selected marker.
function assignShape(number) { player = number; //Assign the shape's selected value to global player variable. cpu = number * -1; //Assign the opposite number to global cpu variable. }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function createSelectedMarker(marker) {\r\n if (gblSelectedMarker !== \"\") {\r\n gblSelectedMarker.setMap(null);\r\n }\r\n var origMarker = masterMapMarkers[marker.orgId];\r\n gblSelectedMarker = new google.maps.Marker({\r\n position: origMarker.getPosition(),\r\n ...
[ "0.7096645", "0.70828027", "0.6927845", "0.6891267", "0.6816404", "0.68078977", "0.67242086", "0.66792583", "0.66263956", "0.6594877", "0.64884144", "0.64434284", "0.64269435", "0.630572", "0.6257208", "0.6158708", "0.6153995", "0.61375743", "0.61325926", "0.61038196", "0.604...
0.0
-1
Check if box is empty. Returns true or false
function isEmpty(number) { var elem = ".b" + number; var empty = ($(elem).attr("marked") == undefined) ? true : false; return empty; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function isEmpty(box){\n return !box.hasClass('box-filled-1') && !box.hasClass('box-filled-2');\n }", "function IsTexboxEmpty(thisObj, sErrorMsg, bDisplayAsterisk, iTabID) {\n\n var c = (thisObj instanceof jQuery) ? thisObj : $('#' + thisObj);\n if (c.length == 0) return true;\n\n ResetError(c);\n ...
[ "0.7910897", "0.751231", "0.73518306", "0.73508227", "0.7336569", "0.7336569", "0.729098", "0.72877955", "0.728661", "0.728661", "0.7202111", "0.71853703", "0.7134302", "0.7130046", "0.7123943", "0.7096553", "0.7092942", "0.70874715", "0.7062005", "0.7062005", "0.7062005", ...
0.0
-1
Place mark on selected box number and checks the board.
function placeMarker(number, turn){ var elem = ".b" + number; //Our box element starts with the letter b. var shape = (turn == 1) ? cross : circle; //Use the corresponding shape based on whose turn it is. var color = (turn == 1) ? "x" : "o"; //Use the corresponding shape based on whose turn it is. $(elem).addClass(color); //Place our shape image on the box. $(elem).html(shape); //Place our shape image on the box. $(elem).attr("marked", "true"); //Mark the box so it can't be used unless new game. board[number] = parseInt(turn); //Update our board for every turn. }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function startSelection(){\n\t\t\tselectedTile = document.getElementById('idnum_' + 0);\n\t\t\tselectedTileNum = 0;\n\t\t\tdocument.getElementById('idnum_0').className += ' squareTextBoxActive';\n\n\t\t}", "function check(x, y) {\n let $el = d.querySelector(`#block_${xPos}x${yPos}`).classList.add('che...
[ "0.6360856", "0.6162837", "0.6154221", "0.6150565", "0.6107458", "0.61021924", "0.60681593", "0.59700304", "0.59450823", "0.58979", "0.58759636", "0.5859568", "0.5837926", "0.58334327", "0.5833325", "0.58299315", "0.58298784", "0.582552", "0.58165544", "0.58057845", "0.579903...
0.5840804
12
Determine if we have a winner or a draw
function checkBoard(array) { if (score(array,0) == 0) gameOver("draw"); if (score(array,0) == 10) player == 1 ? gameOver("win") : gameOver("lose"); if (score(array,0) == -10) player == -1 ? gameOver("win") : gameOver("lose"); return }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function checkForWin() {\r\n if (game_1.isWinningState(board)) {\r\n var winner = game_1.detectWinner(board);\r\n view_1.displayGameOver(winner);\r\n }\r\n else if (game_1.isDrawState(board)) {\r\n view_1.displayGameOver(null);\r\n }\r\n}", "function gameIsDraw(game) {\n return ...
[ "0.7643144", "0.76198506", "0.7617306", "0.74220574", "0.7341569", "0.7314042", "0.7276133", "0.7241837", "0.7193319", "0.7185964", "0.7180696", "0.71542865", "0.7134883", "0.713421", "0.71106344", "0.7098823", "0.708375", "0.7069516", "0.70530516", "0.70371366", "0.70187324"...
0.0
-1
Show selection screen announcing game outcome.
function gameOver(str) { updateScoreBoard(str); //Update the game count|score if (str == "draw") shapeSelect("show", "It's a draw"); if (str == "win") shapeSelect("show", "Player wins!"); if (str == "lose") shapeSelect("show", "CPU wins!"); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function showResult(user, ai, result) {\n document.querySelector('[data-summary=\"your-choice\"]').textContent = `played ${user.toUpperCase()}`;\n document.querySelector('[data-summary=\"ai-choice\"]').textContent = `played ${ai.toUpperCase()}`;\n document.querySelector('p.numbers span').textContent = ++g...
[ "0.62456113", "0.6243302", "0.6241752", "0.613969", "0.6117539", "0.6086488", "0.6076175", "0.60568863", "0.6023413", "0.6023337", "0.60163945", "0.59900534", "0.59847134", "0.59613657", "0.59390485", "0.5932028", "0.59155774", "0.5898649", "0.5897629", "0.5896102", "0.587618...
0.0
-1
Calls minimax to determine the best move
function cpuMove(array, turn) { var movesLeft = getAvailableMoves(array); //opening move if (turn == 1 && movesLeft.length >= 7) { var arr = [0,2,4,6,8]; var newArr = []; for (i in arr) { if (array[arr[i]] == 0) newArr.push(arr[i]); } var n = Math.floor(Math.random() * newArr.length); //console.log(arr[n], newArr, array) placeMarker(newArr[n], turn); return } if (movesLeft.length >= 8) { if (isEmpty(4)) { placeMarker(4, turn); return } if (!isEmpty(4)) { var arr = [0,2,6,8]; var n = Math.floor(Math.random() * arr.length); placeMarker(arr[n], turn); return } } var game = new tictactoe(array); minimax(game, -Infinity, Infinity); //console.log(game.scoreList, game.moveList, bestMove(game, turn)); placeMarker(bestMove(game, turn), turn); checkBoard(board); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function minimax(board = [], maximizingPlayer){\n\tlet openSpots = board.filter(s => s!=\"o\" && s !=\"x\");\n\n\t//array to hold different move posibilitys\n\tlet moves = [];\n\n\t//check if game is over\n\tif(winCondition(board, player1)){\n\t\treturn {score: 10};\n\t} else if(winCondition(board, player2)){\n\t\...
[ "0.7743016", "0.7731749", "0.76792604", "0.7619293", "0.76131546", "0.7514076", "0.74856186", "0.7446101", "0.7432644", "0.74243504", "0.74149823", "0.74090105", "0.7392449", "0.7370043", "0.7341691", "0.7316266", "0.7315098", "0.73141336", "0.72678715", "0.72007656", "0.7176...
0.0
-1
Get available moves by getting the index of 0s.
function getAvailableMoves(array) { var moves = []; //Create our moves array. for (i in array) { if (array[i] == 0) moves.push(parseInt(i)); //fill our moves array. } return moves; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "getMoveablePositions(){\n const movables = [];\n const missing = this.board.missing;\n const cols = this.board.cols;\n const tilesCount = this.board.tilesCount;\n if(missing - 1 > 0 && missing % cols !== 1){\n movables.push(missing - 1);\n }\n if(missing + 1 <= tilesCount && missing % col...
[ "0.6783376", "0.6660417", "0.6423324", "0.6397186", "0.6327426", "0.6270245", "0.6270228", "0.62318593", "0.61617523", "0.6134128", "0.60796034", "0.60423756", "0.60302293", "0.6010179", "0.59870136", "0.59481394", "0.59429", "0.59270734", "0.58633417", "0.58490896", "0.58211...
0.68751806
0
Returns 10 on win, 10 on lose or 0 if draw.
function score(arr, depth) { var min = 0; var max = 0; var combos = [[0,1,2],[3,4,5],[6,7,8],[0,3,6],[1,4,7],[2,5,8],[0,4,8],[2,4,6]]; for (combo in combos) { for (i in combos[combo]) { if (arr[combos[combo][i]] == 1) max++; if (arr[combos[combo][i]] == -1) min++; } if (max == 3) return 10 - depth; if (min == 3) return depth - 10; max = 0; min = 0; } if (getAvailableMoves(arr).length == 0) return 0; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function winsLosses() {\n if (scoreHolder === winningScore) {\n wins++;\n $(\"#win\").text(wins);\n reset();\n \n }\n\n else if (scoreHolder > winningScore){\n losses++;\n $(\"#loss\").text(losses);\n reset();\n }\n\n \n}", "function userWinOrLose()...
[ "0.687615", "0.684039", "0.67929035", "0.6774703", "0.6768694", "0.67442125", "0.67436504", "0.6737045", "0.6727443", "0.67062026", "0.66904676", "0.66814625", "0.6634749", "0.6626691", "0.659348", "0.6590547", "0.65845007", "0.6575703", "0.65692014", "0.65424615", "0.6540655...
0.0
-1
Determine who's turn it is to play.
function currentTurn(array) { var min=0, max=0, turn; for (i in array) { if (array[i] == -1) min++; if (array[i] == 1) max++; } return turn = (max <= min) ? 1 : -1; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function isMyTurn() {\n return playerId == turn;\n}", "function playerTurn(){\n\tif (playerCounter%2 === 0) {\n\t\treturn \"player1\";\n\t} else return \"player2\";\n}", "function myTurn() {\n return playerInfo.playingAs == getLongColor(board.turn());\n }", "function setTurn() {\r\n\t\t// We gen...
[ "0.6940958", "0.66201144", "0.6543803", "0.65423393", "0.65056473", "0.6444823", "0.64160126", "0.6331262", "0.6274238", "0.62135565", "0.61997575", "0.6195927", "0.6159252", "0.6158689", "0.6157415", "0.6155397", "0.6152004", "0.61506915", "0.61407834", "0.6119163", "0.61156...
0.0
-1
Returns a number that corresponds to the best move
function bestMove(obj, turn) { var scoreIndex; if (turn == 1) scoreIndex = obj.scoreList.indexOf(Math.max.apply(Math, obj.scoreList)); //Get max score index if (turn == -1) scoreIndex = obj.scoreList.indexOf(Math.min.apply(Math, obj.scoreList)); //Get min score index return obj.moveList[scoreIndex]; //return our max|min index from the moves list. }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function calculateBestMove(game){\n positionCount = 0\n let depth = parseInt($('#search-depth').find(':selected').text())\n\n // Calculates time and number of positions scanned\n let d = new Date().getTime()\n let bestMove = minimaxRoot(depth, game, true)\n let d2 = new Date().getTime()\n let moveTime = (d2...
[ "0.80348396", "0.761384", "0.7519972", "0.74629045", "0.7430238", "0.74288714", "0.74243045", "0.74175614", "0.74118125", "0.7403701", "0.7376975", "0.73468566", "0.7219387", "0.7191546", "0.7073965", "0.7052474", "0.6981854", "0.69774604", "0.6941174", "0.6937361", "0.692137...
0.75081444
3
Efeito Gaveta no sidebar.
function moveSidebar(){ $('.link-menu').click(event =>{ event.preventDefault(); $('.wrapper').toggleClass('moveSide'); //$('.sidebar').toggleClass('table-structures'); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function sidebar() {\n\tif (!hasClass(document.getElementById('main'), 'nosidebar')) {\n\t\tvar c = document.getElementById('content').getElementsByTagName('div')[0];\n\t\tif (!hasClass(c, 'contextual')) {\n\t\t\t$(document.getElementById('content')).insert({top: '<div class=\"contextual\"></div>'});\n\t\t\tc = do...
[ "0.70598906", "0.6778414", "0.6395823", "0.6388618", "0.63874924", "0.6371744", "0.6274137", "0.6250766", "0.62428635", "0.6240709", "0.621665", "0.6208122", "0.62018216", "0.6170141", "0.613783", "0.6133479", "0.61236435", "0.61191136", "0.6113119", "0.60955894", "0.60955894...
0.0
-1
Abstract the clicked button, and add an event listener to store the value of the choice variable when clicked
function selectAns(event) { choice = event.target.id; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function clickAnswer(){\n\t\t$( '.choice' ).on( 'click', function() {\n\t\t\tcheck()\n\t\t\tclicked = true;\n\t\t\tnewQuestion();\n\t\t\thideBtns();\n\t\t});\n\t}", "function buttonPressed(event) {\n choice = event.target.id\n \n // Check if the id of the button matches the answer field of the prompt.\n if (...
[ "0.6750906", "0.66253126", "0.66129214", "0.66053283", "0.65938294", "0.65829426", "0.6528411", "0.6528411", "0.63961154", "0.6314923", "0.62674147", "0.62356514", "0.62311536", "0.62232405", "0.6222727", "0.62197673", "0.62116265", "0.61859626", "0.61768484", "0.616004", "0....
0.6804477
0
Make a function to evaluate the user's choice, whether it is right or wrong, and award points accordingly.
function answer() { if (choice === qArr[index].correct) { score += 100; document.getElementById("results").innerHTML = `Great job!` } else { document.getElementById("results").innerText = `Wrong! The correct answer is ${qArr[index].rightAns}.` } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function checkAnswer(answer, answerSelection) {\n //Write your code in here\n // if the \"veryPositive\" values in the possibleAnswers object include the string assigned to \"answer\" at the index specified by \"answerSelection\", then return \"very positive\"\n if (possibleAnswers.veryPositive.includes(answer...
[ "0.68196905", "0.6700692", "0.6669454", "0.66407704", "0.6466458", "0.6426117", "0.641743", "0.640642", "0.6402959", "0.6399612", "0.6397318", "0.6396045", "0.63867754", "0.63785446", "0.6376552", "0.63596916", "0.63585114", "0.63457966", "0.6334558", "0.63258886", "0.6311443...
0.6331308
19
Make a function to iterate through the number of questions when button is clicked.
function startQs() { for (let i = 0; i < qArr.length; i++) { function updateImage() { document.getElementById("pic").src = qArr[0].currentPic; } updateImage(); openResults.style.display = "none"; document.getElementById("triviaQs").innerHTML = qArr[0].question; document.getElementById("buttonA").innerHTML = qArr[0].choiceA; document.getElementById("buttonB").innerHTML = qArr[0].choiceB; document.getElementById("buttonC").innerHTML = qArr[0].choiceC; document.getElementById("buttonD").innerHTML = qArr[0].choiceD; // Update score and question number document.getElementById("score").innerHTML = score; document.getElementById("qNum").innerHTML = qArr[0].currentNum; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function questions(number) {\n if (number < quiz.length) {\n $(\"#question\").html(quiz[number].question);\n var choicesArr = quiz[number].choices;\n $(\"#choices\").removeClass(\"textStyle\");\n $(\"#choices\").text(\"\");\n for (var i = 0; i < choices...
[ "0.7446545", "0.71751", "0.6998675", "0.6983867", "0.6979211", "0.69526935", "0.691723", "0.688663", "0.6857261", "0.6856953", "0.6844222", "0.6824172", "0.6816041", "0.6813537", "0.68022746", "0.6787011", "0.67697525", "0.67697525", "0.67697525", "0.6763278", "0.6760276", ...
0.6380677
91
converts from NTP Timestamp Format
function ntpTimestampToSecs (buf, offset = 0, currentMsecs = Date.now()) { let seconds = 0 let fraction = 0 for (let i = 0; i < 4; ++i) { seconds = (seconds * 256) + buf[offset + i] } for (let i = 4; i < 8; ++i) { fraction = (fraction * 256) + buf[offset + i] } // era correction const currentSecs = (currentMsecs / 1000) + SEVENTY_YEARS const era = Math.floor(currentSecs / TWO_POW_32) if (era) seconds += era * TWO_POW_32 // consider an overflow at era change borders if (seconds - currentSecs > TWO_POW_16) seconds -= TWO_POW_32 return ((seconds - SEVENTY_YEARS + (fraction / TWO_POW_32)) * 1000) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function secsToNtpTimestamp (ts, buf = Buffer.alloc(8), offset = 0) {\n const seconds = Math.floor(ts / 1000) + SEVENTY_YEARS\n const fraction = Math.round((ts % 1000) / 1000 * TWO_POW_32)\n // seconds\n buf[offset + 0] = (seconds & 0xFF000000) >> 24\n buf[offset + 1] = (seconds & 0x00FF0000) >> 16\n buf[off...
[ "0.6580833", "0.654705", "0.6515238", "0.6466869", "0.63665026", "0.63582104", "0.6343129", "0.623335", "0.62100285", "0.6205463", "0.619631", "0.6157866", "0.61533195", "0.61427414", "0.61427414", "0.61427414", "0.61427414", "0.61427414", "0.61427414", "0.61423296", "0.61340...
0.6185315
11
converts to NTP Timestamp Format
function secsToNtpTimestamp (ts, buf = Buffer.alloc(8), offset = 0) { const seconds = Math.floor(ts / 1000) + SEVENTY_YEARS const fraction = Math.round((ts % 1000) / 1000 * TWO_POW_32) // seconds buf[offset + 0] = (seconds & 0xFF000000) >> 24 buf[offset + 1] = (seconds & 0x00FF0000) >> 16 buf[offset + 2] = (seconds & 0x0000FF00) >> 8 buf[offset + 3] = (seconds & 0x000000FF) // fraction buf[offset + 4] = (fraction & 0xFF000000) >> 24 buf[offset + 5] = (fraction & 0x00FF0000) >> 16 buf[offset + 6] = (fraction & 0x0000FF00) >> 8 buf[offset + 7] = (fraction & 0x000000FF) return buf }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function convertTimestamp(requestTimestamp) {\n\tlet ts = new Date(requestTimestamp);\n\tlet year = ts.getYear() + 1900;\n\tlet mon = ts.getMonth() + 1;\n\tlet day = ts.getUTCDate();\n\tlet h = ts.getHours();\n\tlet m = ts.getMinutes();\n\tlet s = ts.getSeconds();\n\tlet ms = ts.getMilliseconds();\n\n\tif (mon < 1...
[ "0.6390507", "0.63718265", "0.6285242", "0.62771845", "0.62642795", "0.6119779", "0.61156857", "0.61029243", "0.6098121", "0.60838735", "0.6069155", "0.6059163", "0.6018169", "0.6001191", "0.6001191", "0.59836656", "0.5982884", "0.59806454", "0.59752154", "0.5971993", "0.5967...
0.64699304
0
Dynamically created spans for error messages
function appendErrorMessage(currentInput, newElement) { const parent = currentInput.parentElement; parent.insertBefore(newElement, currentInput); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function createErrorEl() {\n // Creates an element\n var erMsg = document.createElement(\"span\");\n \n // Adds id and style attributes to the element\n erMsg.setAttribute(\"id\", \"errorMessage\");\n erMsg.setAttribute(\"style\", \"color: red\");\n\n // Sets the el...
[ "0.73936105", "0.6817918", "0.678916", "0.67481965", "0.67481965", "0.6699142", "0.66756916", "0.6633868", "0.6625595", "0.6625205", "0.662482", "0.65878105", "0.6555961", "0.6528584", "0.65224516", "0.6459636", "0.64214617", "0.6393245", "0.63780034", "0.63682663", "0.635367...
0.0
-1
Function that uses Regex to validate an email
function isEmail(email) { const regexEmail = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; return regexEmail.test(email); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "validate(email) {\n const expression = /(?!.*\\.{2})^([a-z\\d!#$%&'*+\\-\\/=?^_`{|}~\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]+(\\.[a-z\\d!#$%&'*+\\-\\/=?^_`{|}~\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]+)*|\"((([ \\t]*\\r\\n)?[ \\t]+)?([\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x7f\\x21\\x23-\\x5b\\x5d-\\x7e\\...
[ "0.823673", "0.823673", "0.8195797", "0.81228846", "0.81224895", "0.8053955", "0.80279475", "0.80276114", "0.8002914", "0.79199046", "0.791777", "0.79148036", "0.79075795", "0.7881704", "0.7877299", "0.78374094", "0.78334475", "0.7821844", "0.7776258", "0.7764573", "0.7744280...
0.0
-1
Function to set error message for validation
function setErrorMessage(input, message) { // Access parent element such as the div container holding values const formControl = input.parentElement; // Access <small> element that will display the error and asign it to const const small = formControl.querySelector("small"); // setting class name as error so CSS enables visbility and red color scheme for error message small.className = "errorSmall"; // assign the message we want to display small.innerText = message; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "validate() {\n\t\tconst msg = this.validator ? this.validator(this.value) : '';\n\t\tthis.error = msg;\n\t}", "validate() {\n this.errorMessage = \"Dit is geen text\";\n super.validate();\n }", "getValidationErrorMessage () {\n return VALIDATION_ERROR_MESSAGE\n }", "validate() {\n ...
[ "0.7391879", "0.7389647", "0.72065", "0.7028662", "0.70048076", "0.6980006", "0.6949511", "0.6949511", "0.687561", "0.68525547", "0.6757741", "0.6738955", "0.6709652", "0.6663536", "0.6626008", "0.6617675", "0.66164", "0.66144806", "0.6613851", "0.6540603", "0.6536522", "0....
0.7022952
4
This is called from app.js and starts the load
preloadAssets() { // Create our manifest of files to load // PreloadJS will try to automatically parse what kind of file we're loading // We can consider making a seperate JSON file that has all of this info in it manifest = [ { src: "leave_these_alone/audio.js", }, { src: "leave_these_alone/utils.js", }, { src: "leave_these_alone/ui/screen.js", }, { src: "leave_these_alone/ui/ui.js", }, { src: "leave_these_alone/ui/endscreen.js", }, { src: "leave_these_alone/ui/gamescreen.js", }, { src: "leave_these_alone/ui/helpscreen.js", }, { src: "leave_these_alone/ui/mainmenu.js", }, { src: "leave_these_alone/gameobjects/actor.js", }, { src: "leave_these_alone/gameobjects/bullet.js", }, { src: "leave_these_alone/gameobjects/enemy.js", }, { src: "leave_these_alone/gameobjects/pickups.js", }, { src: "leave_these_alone/effects/particle.js", }, { src: "leave_these_alone/effects/effects.js", }, ]; // Add user defined assets to the manifest manifest = manifest.concat(mediaManifest); // Set the root filepath for our assets this.queue = new createjs.LoadQueue(true); // Use the following to use 'mp3' if 'ogg' doesn't work on browser createjs.Sound.alternateExtensions = ["mp3"]; // Be sure to install the createjs sound plugin or your sounds won't play this.queue.installPlugin(createjs.Sound); // Set some callbacks this.queue.on("progress", this.loadProgress, this); this.queue.on("fileload", this.fileLoaded, this); this.queue.on("complete", this.loadComplete, this); this.queue.loadManifest(manifest); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "load() {\n this.loadEventLoop(600)\n }", "function run() {\r\n\t// Initialize the loader before anything happens\r\n\tloader.init();\r\n}", "function loadApps() {\n\t\t\t\tEnvironment.logDebug(\"Server Starting-3\");\n\t\t\t\trequire('fs').readdirSync('./routes').forEach(function serverLoadApps(file)...
[ "0.71691304", "0.7103452", "0.699309", "0.69589365", "0.6891809", "0.68852293", "0.6842965", "0.67164254", "0.66983575", "0.6682695", "0.66500485", "0.6642476", "0.66323704", "0.66243035", "0.66110474", "0.66085213", "0.6584059", "0.6582536", "0.6571455", "0.6570501", "0.6566...
0.0
-1
When loading is finished, call this function
loadComplete(event) { // Do something when loading is complete, for instance, switch the game state app.gotoScreen("menus"); // Start the music if(polishSettings.menuMusic) { audio.startMenuMusic(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function finishedLoad() {\n console.log('finishedLoad()');\n if (externalIsLoaded()) {\n init();\n }\n }", "loadComplete() {\n // Nothing\n }", "function loadComplete() {\n\thasLoaded = true;\n}", "function onLoadComplete()\n {\n this.loaded = true;\n }", "complete() {\n...
[ "0.8388459", "0.77210313", "0.7714012", "0.7518375", "0.74801326", "0.7453821", "0.7394118", "0.7377911", "0.737", "0.7340951", "0.7308211", "0.7262858", "0.7234802", "0.7196682", "0.7193808", "0.71646255", "0.70893306", "0.7063158", "0.7062541", "0.7037969", "0.6942466", "...
0.6761871
29
When an individual file is loaded, call this function
fileLoaded(event) { // event.result is the final object that was created after loading //console.log(event.result); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "load() {\n\n }", "load() {\r\n\r\n }", "load() {}", "load() {}", "loaded() {}", "function load(){\r\n\r\n}", "function loadedFile() {\n\t\tif (self.currentFile) {\n\t\t\tvar e = new Event('loaded-file');\n\t\t\te.file = self;\n\t\t\tdocument.dispatchEvent(e);\n\t\t}\n\t\treturn;\n\t}", "function ...
[ "0.7320799", "0.726951", "0.71815044", "0.71815044", "0.7108995", "0.7057629", "0.7039618", "0.692106", "0.6866847", "0.6798092", "0.6788585", "0.67771757", "0.6738252", "0.67151034", "0.66552556", "0.6654222", "0.6652592", "0.6627797", "0.66134953", "0.6584573", "0.65525657"...
0.6344635
36
Updates us on the progress of a load
loadProgress(event) { // event.loaded gives us the percentage of our load assets.loadPercentage = event.loaded / event.total; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function updateProgressBarLoadingCore() {\n var loading = 0, loaded = 0;\n loading += view.getModel().getResourceManager().getLoadingCount();\n loaded += view.getModel().getResourceManager().getLoadedCount();\n // Progress %\n status.setPro...
[ "0.7498055", "0.72924614", "0.72128737", "0.71482706", "0.71217805", "0.7013705", "0.69982076", "0.69839746", "0.693542", "0.6919139", "0.6896915", "0.6852184", "0.6795866", "0.6792117", "0.6788115", "0.6788115", "0.6784883", "0.6781643", "0.67720616", "0.67681473", "0.676058...
0.6698241
26
Return a result from queue (will return 'null' if no result was found with that ID)
getResult(id) { var result = this.queue.getResult(id); //console.log(result); return result; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "get(queue) {\n const d = deferred();\n\n this.db.get('SELECT * FROM ' + this.tableName + \" WHERE category = '\" + queue + \"' LIMIT 1;\", function(err, row) {\n if (err) {\n return d.reject(err);\n }\n\n return d.resolve(row ? JSON.parse(row.raw) : row);\n });\n\n return d.promis...
[ "0.6695841", "0.6484989", "0.6439269", "0.635547", "0.62815833", "0.6270649", "0.6268245", "0.61774725", "0.6078567", "0.6061208", "0.60203165", "0.60031784", "0.5920218", "0.591448", "0.5913786", "0.59001976", "0.588572", "0.58574885", "0.5801516", "0.57968587", "0.57909197"...
0.8058592
0
This method handle search button clicks. It pulls data from the web form into the inputObject and then calls the search function.
function clickedSearchButton() { var query = $("#topic").val() YTS.youtubeSearch(query, YTS.resultsHandler, YTS.errorHandler); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getInput() {\n\t\t\tsearchBtn.addEventListener('click', () => {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tsearchTerm = searchValue.value.toLowerCase();\n\t\t\t\tconsole.log(searchTerm);\n\t\t\t\tresults.innerHTML = ''; // clear page for new results\n\t\t\t\tgetData(searchTerm); // run w/ searchTerm\n\t\t\...
[ "0.73795366", "0.7240975", "0.7215317", "0.70903313", "0.70407075", "0.7040231", "0.6888828", "0.685801", "0.6844076", "0.6824888", "0.6801084", "0.67311645", "0.66951036", "0.6678525", "0.6629721", "0.66157424", "0.659835", "0.6582696", "0.65699166", "0.6560662", "0.6557102"...
0.0
-1
To create the bars
function create_bars() { // Make the array empty arr=[]; // Make the visible bars empty bar.innerHTML=""; // Take the no of bars from range var no_of_bar=arr_size.value; var arr_width_size =(500/no_of_bar); // Set the height // we will sort the bars on the basis of height for(var i=0;i<no_of_bar;i++) arr.push(Math.floor(Math.random()*100)); //Set the height and width of visible bars for(var i=0;i<no_of_bar;i++) { var div = document.createElement("DIV"); var margin_size=0.1; div.classList.add("special"); div.style="margin:0%" + margin_size + "%; width:" + (100/no_of_bar-(2*margin_size)) + "%;"; var height = (arr[i]*5+10).toString(); height = height+'px'; div.style.height=height; bar.appendChild(div); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function createBars(vals) {\n var barLeft;\n if (that.model.get(\"columnShift\")) {\n barLeft = \" style=left:\" + that.model.get(\"columnShift\") + \"px\";\n }\n var html = [\"<div class='bars'\" + barLeft + \">\"];\n for (var i = 0; i < vals.len...
[ "0.7860537", "0.76459", "0.75724745", "0.7386859", "0.73683524", "0.7357782", "0.72880423", "0.72102416", "0.72009534", "0.7144574", "0.71221", "0.71114606", "0.7093589", "0.7084603", "0.7080328", "0.70756644", "0.70139027", "0.7006351", "0.69936043", "0.6979261", "0.6963911"...
0.7675395
1
Search device row by device name
function search(){ $("#mySearch").on("keyup", function() { var value = $(this).val().toLowerCase(); $(".table-device tbody tr").filter(function() { $(this).toggle($(this).text().toLowerCase().indexOf(value) > -1); }); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "getDeviceByName(name) {\n var params = 'content=devices&columns=objid,device&filter_device=' + name;\n return this.performPRTGAPIRequest('table.json', params);\n }", "getSensorByName(name, device) {\n var params = 'content=sensors&columns=objid,device,sensor&id=' + d...
[ "0.71700776", "0.6793726", "0.61888695", "0.6122461", "0.60574424", "0.59388256", "0.588111", "0.5870317", "0.5836511", "0.58078545", "0.5727036", "0.5718894", "0.5594725", "0.550541", "0.54622525", "0.54599947", "0.5459256", "0.54122984", "0.5379932", "0.53728133", "0.536621...
0.5855262
8
handle post request to server Add name to state if player exists from API
getPlayerStats(player, team) { var data = {player, team} $.ajax({ type: 'POST', url: '/playerStats', data: data, success: this.getTeams }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "activatePlayer(request, response) {\n // console.log('in the create method ..................................................................' )\n Game.activePlayers.add(request.body)\n .then(player => response.json(player))\n .catch(error => response.json(error));\n }", "static createPlayer() {\n ...
[ "0.64863676", "0.64585626", "0.64165", "0.6278673", "0.616512", "0.61334735", "0.6106225", "0.6089359", "0.60689735", "0.6056889", "0.60164297", "0.6008652", "0.59876853", "0.59806937", "0.59537077", "0.59371233", "0.5933002", "0.5917651", "0.58890855", "0.58757734", "0.58520...
0.0
-1
handle state change of player A/B handle getting player stats
render() { return ( <div> <Search getPlayerStats={this.getPlayerStats}/> <br></br> <div> <TeamA team={this.state.teamA}/> <TeamB team={this.state.teamB}/> <br></br> <Results toggleResults={this.showResults} show={this.state.showResults} teamA={this.state.teamA} teamB={this.state.teamB}/> {/* <button onClick={this.showResults}>Show Results</button> */} </div> <br></br> <form onSubmit={this.clearData}> <input type="submit" value="Start New Game"></input> </form> </div> ) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "playerStateChanged(playerCurrentState) {\n // console.log('player current update state', playerCurrentState)\n }", "function handlePlayerChange() {\n currentPlayer = currentPlayer === \"X\" ? \"O\" : \"X\";\n //updating interface\n statusDisplay.innerHTML = currentPlayerTurn();\n}", "stateManager() {\n ...
[ "0.69718987", "0.68139017", "0.67251", "0.644597", "0.6424989", "0.64116126", "0.6402223", "0.639108", "0.6334026", "0.6237516", "0.6199273", "0.6198273", "0.61787456", "0.61448216", "0.6144575", "0.61141974", "0.60604244", "0.6057528", "0.60392606", "0.6034837", "0.60246027"...
0.0
-1
Updates all the objects of the scene
function updateScene() { for(let scobj of objects) scobj.update(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "update() {\n this._objects.sky.update();\n this._objects.goal.update();\n }", "update() {\n let i, len;\n len = this.objects.length;\n for (i = 0; i < len; i++) {\n this.objects[i].update();\n }\n\n if (this.camera.update) {\n this.camera.update();\n }\n }", "update () {\n ...
[ "0.7845472", "0.77988863", "0.7513487", "0.74571306", "0.7128196", "0.70848274", "0.7038472", "0.70138013", "0.69952804", "0.6972461", "0.69612104", "0.6899919", "0.68974674", "0.68960583", "0.6889422", "0.68786377", "0.68019253", "0.67968565", "0.67696625", "0.67367893", "0....
0.86557734
0
Clears the canvas and draws all the objects of the scene
function drawScene() { for(let line of sceneVisibleLines) line.draw(); for(let scobj of objects) scobj.draw(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "clearCanvas( )\r\n {\r\n this.objs = [];\r\n console.log( \"Cleared scene and canvas.\" )\r\n\r\n }", "drawSceneToCanvas() {\n // draw each object in the scene\n this.scene.forEach(obj => {\n obj.draw(this.Canvas);\n });\n\n // clear the scene for the next frame\n ...
[ "0.8171426", "0.795989", "0.7921536", "0.7859356", "0.7819069", "0.7727348", "0.74508363", "0.74101424", "0.7388151", "0.73525697", "0.7316842", "0.731014", "0.7292289", "0.7244283", "0.722134", "0.7220497", "0.7212998", "0.7207404", "0.72040796", "0.7203996", "0.7198027", ...
0.0
-1
Adds an object to the scene.
function addObject(toAdd) { objects.push(toAdd); toAdd.calcCorners(); for(let line of toAdd.hitboxLines) sceneHitboxLines.push(line); for(let line of toAdd.visibleLines) sceneVisibleLines.push(line); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "add(object) {\n this.scene.add(object);\n object.children.forEach((child) => {\n this.objects.push (child);\n });\n \n }", "addObject(obj) {\n var className = Object.keys(obj)[0];\n var object = Object.values(obj)[0];\n this.addToScene(className, object);\n }", "function addObject(o...
[ "0.7613695", "0.7500546", "0.7370325", "0.7327658", "0.73065615", "0.7300055", "0.729889", "0.72526723", "0.7157753", "0.6985992", "0.69736344", "0.6899434", "0.68989086", "0.67322016", "0.66211516", "0.65851593", "0.65427566", "0.6503442", "0.6488871", "0.6441129", "0.635589...
0.7647139
0
Adds a line to the scene (visible and with a hitbox)
function addWall(line) { sceneVisibleLines.push(line); sceneHitboxLines.push(line); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function addLine () {\n\tconst linksCoords = this.getBoundingClientRect();\n\tline.style.width = `${linksCoords.width}px`;\n\tline.style.transform = `translate(${linksCoords.left}px, ${linksCoords.top}px)`;\n\tline.style.opacity = 1;\n}", "_addLine(line) {\n //line.initProgram(this.webgl);\n line._...
[ "0.73225", "0.7233352", "0.69816566", "0.68505836", "0.67988604", "0.66706055", "0.6667339", "0.6568214", "0.65414494", "0.6528886", "0.65072113", "0.6477257", "0.64547503", "0.63991475", "0.6398194", "0.6379594", "0.6378164", "0.63671136", "0.6362737", "0.6351865", "0.632100...
0.76673806
0
FUNCION PARA ENVIAR ARCHIVO A LA API Y GUARDAR
async function savingFile(diagrama, nameFile) { try { let params = { method: 'POST', body: JSON.stringify({ uri: nameFile, data: diagrama }), mode: 'cors', headers: { 'Content-Type': 'application/json', "Access-Control-Allow-Origin": "*" } }; let response = await fetch(`${Api.serverName}/save`, params); response = await response.json(); //console.log(`respuesta de api ${JSON.stringify(response, null, 2)}`); return response; } catch (e) { console.log(e); return false; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function descargarArchivo() {\n\tcargarContenido(campoUrl.value, 'GET', mostrarContenido);\n}", "archive(req, res) {\n PetsService.archive(req.params.id)\n .then((result) => {\n res.json(result);\n })\n .catch((error) => {\n res.status(500).json(error);\n });\n }", "async ...
[ "0.5890537", "0.57121897", "0.56764305", "0.5672958", "0.5617494", "0.54200864", "0.5351704", "0.53480566", "0.53010553", "0.527073", "0.5253998", "0.52026224", "0.51985675", "0.51840365", "0.51621246", "0.5134587", "0.5134079", "0.51182246", "0.50980586", "0.50814307", "0.50...
0.0
-1
FUNCION DE CONSULTA A API PARA COMPILAR EL DIAGRAMA
async function runCompilete(diagrama, nameFile) { try { let params = { method: 'POST', body: JSON.stringify({ uri: nameFile, data: diagrama }), mode: 'cors', headers: { 'Content-Type': 'application/json', "Access-Control-Allow-Origin": "*" } }; let response = await fetch(`${Api.serverName}/scanner`, params); response = await response.json(); //console.log(`respuesta de api ${JSON.stringify(response, null, 2)}`); return response; } catch (e) { console.log(e); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function API(){}", "function API(){}", "function baixaSCCD(par_id,par_destino,par_filial_app,element) {\n params ={\n id: par_id,\n destino: par_destino,\n filial_app: par_filial_app\n }\n loadAPI('POST','',api_baixa_sccd,params).then((ret)=>{\n sendLog('AVISO',`(009) Regis...
[ "0.5731918", "0.5731918", "0.55474585", "0.5543658", "0.55281985", "0.5515979", "0.54961735", "0.5476927", "0.5467373", "0.5442307", "0.54012483", "0.5384089", "0.5349088", "0.5310298", "0.5269769", "0.5268304", "0.52269393", "0.5209243", "0.52032435", "0.51942223", "0.519225...
0.5559603
2
Name: roundcorners Goal: like it says, div with border with rounded corners Input: the div Output: nothing Caller: everywhere
function roundcorners(d) { var w = parseInt(d.css("height")) / 10; w = (w > 10) ? 10 : Math.round(w); w = (w < 6) ? 6 : w; d.css("border-radius", w + "px").css("-moz-border-radius", w + "px"); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function roundCorners(element) {\r\n\tvar size = 20;\r\n\tvar settings = {\r\n\t\ttl: { radius: size },\r\n\t\ttr: { radius: size },\r\n\t\tbl: { radius: size },\r\n\t\tbr: { radius: size },\r\n\t\tantiAlias: true\r\n\t}\r\n\tcurvyCorners(settings, element);\r\n}", "function RoundCornersModifier() {\n }", "...
[ "0.7227442", "0.70938843", "0.656501", "0.6551818", "0.6547582", "0.6518514", "0.65043706", "0.64971596", "0.6361358", "0.6348139", "0.63428354", "0.61451274", "0.6071564", "0.6057548", "0.5916379", "0.58885044", "0.5858342", "0.58253217", "0.58208513", "0.58208513", "0.58177...
0.69990057
2
Name: filteredjson Goal: filter an array of json objects Input: array, attribute,value Output: filtered array Caller: filtere.js
function filteredjson(obj,key,val) { var res = jQuery.grep(obj, function (el, i) { return (el[key]==val); }); return res; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function filterJson(source_json){\n try{\n var fdata = [],\n filter = [\"Manufacturers\", \"Device List\", \"Current Test Date\", \"Estimated End Date\"];\n// jData = source_json;\n// console.log(\"Collection Data\", jData);\n\n source_json.forEach(function(content...
[ "0.7472138", "0.7009973", "0.700276", "0.6592936", "0.6498012", "0.6458053", "0.6386227", "0.63729465", "0.6300128", "0.6273036", "0.6259465", "0.6215633", "0.61964893", "0.61295825", "0.6087601", "0.6087566", "0.6061556", "0.60601693", "0.6054482", "0.60420406", "0.60420406"...
0.64105535
6
Name: myParseJSON Goal: clean the response of ajax calls, remove "returns" (remove trailing and tailing returns, replace returns with ) Input: json string Output: json object Caller: everywhere
function myParseJSON(data) { data = data.substr(data.indexOf('{')); while (data.substr(data.length-1)=='\n') data = data.substr(0, data.length - 1); data = data.split("\n").join("<br/>"); data = data.split("\r").join(""); return jQuery.parseJSON(data); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function jsonParseClean (str) {\n try {\n str = str.trim();\n str = str.replace(/\\u0000/g, '').replace(/\\u\\d\\d\\d\\d/g, '');\n str = str.replace('\\b', ' ');\n if (str[0] !== '{') {\n str = str.substring(str.indexOf('{'), str.length);\n }\n\n // Remove Unicode escape sequences.\n // ...
[ "0.655008", "0.6369381", "0.634323", "0.61644614", "0.6114253", "0.60998625", "0.6096415", "0.60639924", "0.6011278", "0.6011278", "0.59198606", "0.59168905", "0.5868652", "0.58667815", "0.58581203", "0.58038735", "0.58028007", "0.57985055", "0.57875806", "0.5759228", "0.5750...
0.7033008
0
Name: calculateWCSparameters Goal: calculate width,height and bbox vor wms request based on indicator_surface data Input: indicator surface record Output: string for wns request Caller: downloadmap
function calculateWCSparameters(data) { if(!validateWCSparameters(data)){ return ""; } var extent = data.extent; var pixelX = data.pixel_size_x; var pixelY = data.pixel_size_y; var points = extent.substr(9, extent.length - 11).split(","); var minx = 180; var miny = 90; var maxx = -180; var maxy = -90; var point; for (var i = 0; i < points.length; i++) { point = points[i].split(" "); point[0] = parseFloat(point[0]) point[1] = parseFloat(point[1]) minx = (minx < point[0]) ? minx : point[0]; miny = (miny < point[1]) ? miny : point[1]; maxx = (maxx > point[0]) ? maxx : point[0]; maxy = (maxy > point[1]) ? maxy : point[1]; } if (minx == (-180) && maxx == 180) minx = 180; var deltaX = maxx - minx; var deltaY = maxy - miny; var w = Math.round(deltaX/pixelX); var h = Math.round(deltaY/pixelY); //Limit image area to 500x500px var maxArea = 500 * 500; var currentArea = w * h; if(currentArea > maxArea){ var scaleFactor = Math.sqrt(currentArea/maxArea); w = Math.round(w / scaleFactor); h = Math.round(h / scaleFactor); } var str = '&bbox=' + minx + ',' + miny + ',' + maxx + ',' + maxy + '&width=' + w + '&height=' + h + ''; return str; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function validateWCSparameters(data) {\n\tvar extent = data.extent;\n var pixelX = data.pixel_size_x;\n var pixelY = data.pixel_size_y;\n\tvar valid = true;\n\tvar msg = \"\";\n\tif(!extent || extent == 'null'){\n\t\tmsg = 'extent';\n\t\tvalid = false;\n\t}\n\tif(!pixelX || pixelX == 'null'){\n\t\tmsg = 'pix...
[ "0.59159774", "0.5813878", "0.50911796", "0.4989126", "0.49884707", "0.48918727", "0.48918727", "0.48918727", "0.47870693", "0.47253877", "0.4701311", "0.46813214", "0.46360144", "0.4627737", "0.4603117", "0.4602153", "0.45894963", "0.45891666", "0.45870695", "0.4565591", "0....
0.7143654
0
Name: calculateWCSparameters Goal: calculate width,height and bbox vor wms request based on indicator_surface data Input: indicator surface record Output: string for wns request Caller: downloadmap
function validateWCSparameters(data) { var extent = data.extent; var pixelX = data.pixel_size_x; var pixelY = data.pixel_size_y; var valid = true; var msg = ""; if(!extent || extent == 'null'){ msg = 'extent'; valid = false; } if(!pixelX || pixelX == 'null'){ msg = 'pixel_size_x'; valid = false; } if(!pixelY || pixelY == 'null'){ msg = 'pixel_size_y'; valid = false; } if(!valid){ $("<div title='WCS request problem'>Map \'" + msg + "\' parameter is missing</div>").dialog( {resizable: false, modal: true, draggable: false}) .prev(".ui-dialog-titlebar").css("background","rgb(81, 130, 189)").css("color","#eeeeee"); } return valid; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function calculateWCSparameters(data) {\n\tif(!validateWCSparameters(data)){\n\t\treturn \"\";\n\t}\n var extent = data.extent;\n var pixelX = data.pixel_size_x;\n var pixelY = data.pixel_size_y;\n\n var points = extent.substr(9, extent.length - 11).split(\",\");\n var minx = 180;\n var miny = 90...
[ "0.71442693", "0.5813898", "0.5089971", "0.49887782", "0.49868003", "0.48905045", "0.48905045", "0.48905045", "0.47864968", "0.47253147", "0.4699676", "0.46810398", "0.4636042", "0.46269733", "0.4601521", "0.46007258", "0.45887873", "0.45887506", "0.45852277", "0.45628235", "...
0.59160995
1
Name: thesortcomparer Goal: help function Input: Output: Caller: sortdata
function thesortcomparer (prop,updown) { return function (a, b) { var A = a[prop], B = b[prop]; if(updown) return ((A < B) ? -1 : (A > B) ? +1 : 0); else return ((A < B) ? 1 : (A > B) ? -1 : 0); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function sortData (data) {\n ...\n}", "function Sort() {}", "function twpro_sortJobs(){\r\n\t\tif (TWPro.twpro_failure) return;\r\n\t\tvar sortby = TWPro.twpro_jobsort, twpro_jobValues = TWPro.twpro_jobValues;\r\n\t\tvar sortfunc = function(twpro_a, twpro_b){\r\n\t\t\tvar twpro_a_str = twpro_a.name,\r\n\t\t...
[ "0.73706204", "0.7137762", "0.704511", "0.6934818", "0.69219196", "0.69219196", "0.679446", "0.6720737", "0.66758865", "0.6664106", "0.66158867", "0.6613068", "0.65553623", "0.6528278", "0.65183663", "0.6515049", "0.65131795", "0.65096676", "0.65009034", "0.6495278", "0.64905...
0.653091
13
Name: sortdata Goal: sort array of json objects Input: array of json objects, propery to sort on, asc or desc Output: sorted array Caller: sortservicedata (data.js)
function sortdata(data,prop,updown) { data.sort(thesortcomparer(prop,updown)); return data; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function sortData (data) {\n ...\n}", "function sortJson() {\r\n\t \r\n}", "sortData() {\n this.data.sort(($val1, $val2 ) => {\n const a = JSON.stringify($val1[this.sortBy]);\n const b = JSON.stringify($val2[this.sortBy]);\n if ( a < b ){\n return -th...
[ "0.80898064", "0.7678605", "0.7550328", "0.7409286", "0.728958", "0.72563493", "0.72563493", "0.71931946", "0.71380186", "0.70497626", "0.7027396", "0.6994853", "0.694782", "0.6944851", "0.69384164", "0.6936623", "0.69049186", "0.6801201", "0.67193884", "0.67091376", "0.66443...
0.68598956
17
Name: activateDownloadBlueprint Goal: make blueprint icons acive or not Input: true or false Output: nothing Caller: getdata,filter,presentation,data
function activateDownloadBlueprint(active) { if (active) { $("#divshowdownloadblueprint").html('<a href="javascript:showblueprint();"><img src="images/Buttons_Ioanna/png/final-icons_02.png" title="Show Blueprint (html)" onmouseover="showblueprintImg(this,1);" onmouseout="showblueprintImg(this,0);" /></a> &nbsp;&nbsp; <a href="javascript:downloadblueprint();"><img src="images/Buttons_Ioanna/png/final-icons_03.png" title="Download Blueprint (CSV)" onmouseover="downloadblueprintImg(this,1);" onmouseout="downloadblueprintImg(this,0);" /></a>'); } else { $("#divshowdownloadblueprint").html('<img src="images/Buttons_Ioanna/png/final-icons_02.png" title="Show Blueprint (html)" style="opacity:0.4; filter:alpha(opacity=40)" /> &nbsp;&nbsp; <img src="images/Buttons_Ioanna/png/final-icons_03.png" title="Download Blueprint (CSV)" style="opacity:0.4; filter:alpha(opacity=40)" />'); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function PixFileDownload() {\n}", "function downloadPalette(){\n var x = activePalette;\n //check palette is ready for download\n if(palettes[x] && palettes[x].colours.length > 0)\n {\n if(palettes[x].bytes.length > 0)\n {\n //ready\n Utils.download(palettes[x].byt...
[ "0.54702926", "0.5367335", "0.5331662", "0.5237132", "0.51658666", "0.5158594", "0.51118237", "0.5048415", "0.50081235", "0.49987507", "0.49847102", "0.4971586", "0.49547496", "0.4949185", "0.4895529", "0.48939472", "0.4893765", "0.48889494", "0.48739544", "0.48693514", "0.48...
0.65365267
0
All subject to change.
run(message,args){ var tempnum = 0; var members = message.guild.members.array(); if(!fs.existsSync('./commands/economy/money/' + message.guild.name.toLowerCase())){ fs.mkdirSync('./commands/economy/money/' + message.guild.name.toLowerCase()); } var moneys = []; for(var i = 0; i < members.length; i++){ tempnum = i; var file = ('./commands/economy/money/' + message.guild.name.toLowerCase() + '/' + members[i].displayName.toLowerCase() + '.txt'); if(fs.existsSync(file)){ moneys[i] = parseInt(fs.readFileSync(file)); }else{ fs.appendFile(file,'100',(err) => { if (err){ message.channel.send('Error creating a file.'); }else{ console.log(members[tempnum].displayName.toLowerCase()); } }); moneys[i] = 100; } } message.reply(this.maxNum(moneys,members)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "notify() {\n console.log('Subject1: notifying observers...');\n this.#observers.forEach((observer) => {\n observer.update(this);\n });\n }", "function Subject() {\n this.observers = [];\n}", "function Subject(){\n this.observers = new ObserverList();\n}", "function Subject () {\n this._obse...
[ "0.64752924", "0.639392", "0.6326188", "0.6320036", "0.60490346", "0.60490346", "0.60490346", "0.59762806", "0.5966729", "0.5966729", "0.5966729", "0.5966729", "0.5966729", "0.5799219", "0.5799219", "0.578327", "0.578327", "0.578327", "0.578327", "0.578327", "0.578327", "0....
0.0
-1
se crea una funcion que cambie los colores de los parrafos
function changeColor (event){ event.currentTarget.style.color = rgb(); //se llama a la primera función }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function principal(){\n\n borraCanvas();\n\n console.log(ratonX + ' - ' + ratonY);\n\n for(i=0; i<numParticulas;i++){\n particulas[i].actualiza();\n }\n\n}", "function pintar(ctx){\n //limpiar canvas o linezo\n ctx.fillStyle=bgColor;\n ctx.fillRect(0,0,canvas.width,canvas.height);\n\n //si el ...
[ "0.6235781", "0.59992427", "0.5997088", "0.59485304", "0.5921623", "0.58870745", "0.5866353", "0.58512574", "0.58103925", "0.58012736", "0.579985", "0.57888764", "0.5781295", "0.57718176", "0.57695043", "0.5745119", "0.5717099", "0.5698588", "0.56891334", "0.5684544", "0.5669...
0.0
-1
se crea una uncion que retorne el color negro de los parrafos
function returnColor(event){ event.currentTarget.style.color = 'black'; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function generarPaleta() {\n for (var i = 0 ; i < nombreColores.length ; i++ ){\n var color = document.createElement ('div');\n color.style.backgroundColor = nombreColores[i];\n color.className = 'color-paleta';\n paleta.appendChild(color);\n }\n}", "function paletaColores(){\n var color;\n for (...
[ "0.68961483", "0.6786749", "0.6625565", "0.6389137", "0.6295726", "0.62604254", "0.6251973", "0.6204122", "0.61923873", "0.615627", "0.61506635", "0.6130707", "0.6115874", "0.6082596", "0.6074922", "0.6054289", "0.60507923", "0.60497105", "0.6038333", "0.602805", "0.6019975",...
0.0
-1
Returns true if the given dom target is in whitespace, else false.
function _isWorkspaceWhitespace(elem) { var clicked = $(elem); // anything but a descendent of column class return $.contains(document.documentElement, elem) && (clicked.hasClass(COLUMN_CLASS) || !clicked.parents().hasClass(COLUMN_CLASS) || clicked.hasClass('clusterExpanded')); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function isWhitespaceNode(node) {\n if (!node || node.nodeType != 3) {\n return false;\n }\n var text = node.data;\n if (text === \"\") {\n return true;\n }\n var parent = node.parentNode;\n if (!parent || parent.nodeType != 1) {\n r...
[ "0.64076", "0.64076", "0.64076", "0.6373588", "0.6373588", "0.6370194", "0.6369004", "0.6369004", "0.6369004", "0.6369004", "0.6369004", "0.6369004", "0.6369004", "0.6369004", "0.6369004", "0.6369004", "0.6369004", "0.6369004", "0.6369004", "0.6369004", "0.6369004", "0.6369...
0.65148073
0
summary of text in A CommonSense Guide to Data Structures and Algorithms by Jay Wengrow for each pass, find the lowest value and put it at index 0 of the pass
function selectionSort(arr){ let lowestIndex const swapInArray = (arr, i, j) => [arr[i], arr[j]] = [arr[j], arr[i]] for (let i = 0; i < arr.length; i++) { lowestIndex = i for (let j = i; j < arr.length; j++) { if (arr[j] < arr[lowestIndex]) { lowestIndex = j } } if (i != lowestIndex) { swapInArray(arr,i,lowestIndex) } } return arr }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function indexOfSmallest() {\n\t\t\tindex = 0;\n\t\t\tvar value = diffArray[0];\n\t\t\tfor (var i = 1; i < diffArray.length; i++) {\n \t\t\t\tif (diffArray[i] < value) {\n \t\t\t\tvalue = diffArray[i];\n \t\t\t\tindex = i;\n \t\t\t\t}\n\t\t\t}\n\t\t\tmatchSelect();\n\t\t}", "function high(x){\nlet result ...
[ "0.6152972", "0.5980473", "0.5927026", "0.5825105", "0.5819738", "0.57870495", "0.57413894", "0.57059467", "0.5627265", "0.56260055", "0.56185997", "0.5603823", "0.5595871", "0.5583291", "0.5578379", "0.5570007", "0.55303425", "0.5513855", "0.55061895", "0.55052966", "0.55043...
0.0
-1
When the user clicks on the button, scroll to the top of the document
function topFunction() { $('html, body').stop().animate( { scrollTop : 0 } ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function scrollToTop () {\n //getting the currentPosition position of the button\n let currentPosition = document.documentElement.scrollTop || document.body.scrollTop;\n //if the position is greater than 0 then we'll scroll to the top of the page\n if (currentPosition > 0) {\n ...
[ "0.8500354", "0.8494407", "0.823897", "0.8031184", "0.80240875", "0.8013301", "0.79951185", "0.7957891", "0.7950808", "0.7946424", "0.7924129", "0.79108864", "0.79088783", "0.78972363", "0.7891453", "0.7872319", "0.7842605", "0.7819863", "0.78190035", "0.78024554", "0.7774074...
0.0
-1
Since component got loaded is going to ask for data to the server every second.
componentDidMount(){ setInterval(this.updateData(), 1000); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "componentDidMount() {\n // Load initial Data, otherwise there would be a gap till loaded\n this.fetchData()\n // update Data every 5 seconds\n this.updateData = setInterval(\n () => this.fetchData(),\n 5000\n )\n }", "componentDidUpdate() {\n this.loadData();\n }", "componen...
[ "0.70638186", "0.6793341", "0.6769066", "0.6650608", "0.66448116", "0.664109", "0.66158783", "0.6606495", "0.65870136", "0.65158314", "0.65003353", "0.64651674", "0.64604163", "0.64467853", "0.6418393", "0.64109707", "0.6385306", "0.63632345", "0.6358338", "0.6358338", "0.635...
0.64537084
13
The functions 'response', 'results', and 'thumbnails' process a search query progressively, allowing you to debug intermediate steps.
async response(request={}) { //Just the raw response we get from the server; no post-processing whatsoever const defaults={type:'All',creator:null,searchText:'',likedBy:null,...request} const response=await window.fetchJson('search',{...defaults,...request}) if(response.status!=='OK') { console.error('Search response status was not "OK"!\nRequest:',request,'\nResponse:',response) //Even if the response is not "OK" (it might even be undefined), the show MUST go on. We return the response anyway. //All functions (such as search.results) that use this search.response function operate under the assumption that the results are ok to use. } return await window.fetchJson('search',{...defaults,...request}) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function runSearch() {\n ps.search()\n .then(function(rsp) {\n if(rsp.stat === \"fail\") {\n ps.showError(rsp);\n }\n else if (rsp.stat === \"ok\") {\n ps.paging = rsp.photos;\n ps.parseSearchRes...
[ "0.6763034", "0.64328384", "0.621448", "0.6212669", "0.615236", "0.61230737", "0.6122161", "0.6117007", "0.61020255", "0.60640466", "0.6026735", "0.6016844", "0.6013802", "0.59907085", "0.5986488", "0.59843034", "0.59827214", "0.5948088", "0.5940883", "0.5939307", "0.5939271"...
0.0
-1
Get lyrics from server
function getMp3 () { var url = controller_url + "?action=lib_display"; // get mp3 file list in json $.getJSON(url, function (mp3) { // log('result :', mp3); if (mp3) { $.each(mp3, function(i, val){ var pos = val.file.lastIndexOf("/"); path = val.file.substr(0, pos); file = val.file.substr(pos+1); $('#filelist').append("<li><span class='add_song' s_id='" + val.s_id['$id'] + "' path='" + path + "' title='click to add to playlist'>" + file + "</span><img s_id='" + val.s_id['$id'] + "' class='float_right_button tag' alt='[Tag]' title='show/edit tags' /></li>"); }); // default initial action: // - add first song to playlist $('#filelist .add_song:first').trigger( "click" ); // - load first song $('.play_song:first()').trigger('click'); } }); return; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getLyrics() {\n var lyricsSong = $(this).attr(\"data-song\");\n lyricsSong.replace(/\\W+/g, \"-\").toLowerCase();\n var lyricsArtist = $(this).attr(\"data-artist\");\n lyricsArtist.replace(/\\W+/g, \"-\").toLowerCase();\n $.ajax({\n url: `https://api.lyrics.ovh/v1/${lyricsArtist}/${lyr...
[ "0.7907434", "0.76425904", "0.7592017", "0.75650173", "0.7560927", "0.7502474", "0.73807615", "0.7354878", "0.7299753", "0.7265975", "0.72622377", "0.71058714", "0.70764816", "0.70469797", "0.7037895", "0.6959995", "0.6867315", "0.67673236", "0.666006", "0.659275", "0.6571645...
0.0
-1
Get lyrics from server
function getLyrics (s_id) { // var pos = ele_song.attr('src').lastIndexOf("/"); // attach song_file name to the query // var url = "get_lyrics.php?id=" + ele_song.attr('src').substring(pos+1); var url = controller_url + "?action=get_lyrics&s_id=" + s_id; // log('url', url); setLyrics('Fetching lyrics ...'); // get lyrics in json $.getJSON(url, function (json) { hasLyrics = false; if (json) { setCover(json.cover); if (json.lyrics && json.lyrics.length > 0) { hasLyrics = true; // show lyrics lrc.start(ele_song, ele_lyrics, json.lyrics); $('#raw_lyrics').val(json.lyrics); $('#lyrics_s_id').val(s_id); } } if (hasLyrics === false) { setLyrics('No lyrics available.'); } }); return; /* $.ajax(url) .done( function(data) { // log( "Sample of data: ", data.slice( 0, 100 ) ); data = $.parseJSON(data); log( "Sample of data: ", data ); // show lyrics lrc.start(ele_song, ele_lyrics, data); }) .always( function() { setLyrics('Fetching lyrics ...'); }) .fail( function() { setLyrics('No lyrics available.'); }); */ }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getLyrics() {\n var lyricsSong = $(this).attr(\"data-song\");\n lyricsSong.replace(/\\W+/g, \"-\").toLowerCase();\n var lyricsArtist = $(this).attr(\"data-artist\");\n lyricsArtist.replace(/\\W+/g, \"-\").toLowerCase();\n $.ajax({\n url: `https://api.lyrics.ovh/v1/${lyricsArtist}/${lyr...
[ "0.7907434", "0.76425904", "0.7592017", "0.75650173", "0.7560927", "0.7502474", "0.73807615", "0.7354878", "0.7299753", "0.7265975", "0.72622377", "0.71058714", "0.70764816", "0.70469797", "0.6959995", "0.6867315", "0.67673236", "0.666006", "0.659275", "0.6571645", "0.6535111...
0.7037895
14