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
Blocco da valorizzare solo se si intende identificare con un progressivo il file che si sta trasmettendo. L'elemento 1.3 non va mai valorizzato in quanto riservato al sistema Occorrenze:
function createInstance_DatiFatturaHeader(param) { var msgContext = '<DatiFatturaHeader>'; var xbrlProgressivo = ''; if (param.progressivoInvio.length>0) xbrlProgressivo = xml_createElementWithValidation("ProgressivoInvio",xml_escapeString(param.progressivoInvio),0,'1...10', msgContext); var xbrlCFDichiarante = ''; if (param.codicefiscaleDichiarante.length>0) xbrlCFDichiarante = xml_createElementWithValidation("CodiceFiscale", xml_escapeString(param.codicefiscaleDichiarante), 0, '11...16', msgContext); var xbrlCodiceCaricaDichiarante = ''; if (parseInt(param.codiceCarica)>0) xbrlCodiceCaricaDichiarante = xml_createElementWithValidation("Carica", param.codiceCarica, 0, '1...2', msgContext); var xbrlDichiarante = ''; if (xbrlCFDichiarante.length > 0 || xbrlCodiceCaricaDichiarante.length > 0) { xbrlDichiarante = xml_createElement("Dichiarante", xbrlCFDichiarante + xbrlCodiceCaricaDichiarante); } var xbrlContent = xbrlProgressivo + xbrlDichiarante; var xbrlHeader = xml_createElement("DatiFatturaHeader", xbrlContent); return xbrlHeader; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function daFileFbk(){\r\n var limit = 150; \r\n var parrafo = document.getElementById('foto-feedback-paragraph');\r\n \r\n if( ! escogioFoto() && noUsado() == limit){\r\n parrafo.style.color='red';\r\n parrafo.innerHTML='<b>Escoge una foto del juego de hoy.</b>'; ...
[ "0.5751988", "0.5737984", "0.57237184", "0.56594044", "0.56232226", "0.5618416", "0.5593088", "0.55860615", "0.5568662", "0.5539805", "0.55139136", "0.5505049", "0.5493453", "0.5454991", "0.5454208", "0.5436474", "0.54314744", "0.54243207", "0.54183614", "0.5368884", "0.53586...
0.0
-1
Performs actual calculations to verify the 'armstrongness' of the input and outputs result to the user
function checkValue(val) { let output = 0; for (const char of val) { output += Math.pow(char, 3); } if (output == val) { return true || false; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function CalculateResults()\r\n {\r\n var inputsAllValid;\r\n\r\n // Fetch all input values from the on-screen form.\r\n\r\n inputsAllValid = FetchInputValues();\r\n\r\n // If the fetched input values are all valid...\r\n\r\n if (inputsAllValid)\r\n {\r\n // Do the natural gas pressure ...
[ "0.65036535", "0.6237563", "0.61095834", "0.60646546", "0.60173666", "0.5941137", "0.5925298", "0.5916405", "0.5908635", "0.58786196", "0.5875984", "0.58577573", "0.5820902", "0.5811287", "0.5797421", "0.57817173", "0.57722014", "0.5770395", "0.5759878", "0.57383597", "0.5727...
0.0
-1
Gets all call by all customers and sets them to statusList state.
getAllCalls(){ GetAllCustomers().then(async(response) => { const callList = await Promise.all(response.data.map(async (customer, id) => { var callResponse = await GetCallLogsByCustomerId(customer.id) if(callResponse.status == "OK") { return callResponse.data } })) const statusResponse = await GetAllStatus() if(statusResponse.status == "OK") { this.setState({statusList: statusResponse.data}) } this.buildCallsTableData(callList, response.data); }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getCustomers() {\n CustomerService.getCustomers()\n .success(function(custs) {\n $scope.gridOpts.data = custs;\n })\n .error(function(error) {\n $scope.status = 'Unable to load customer data: ' + error.message;\n...
[ "0.6240233", "0.6136181", "0.6102866", "0.5976002", "0.5974769", "0.5848147", "0.5843582", "0.5815147", "0.57983464", "0.57979554", "0.5793831", "0.57835865", "0.5773335", "0.5763073", "0.57528096", "0.5717742", "0.57162035", "0.56668085", "0.5666196", "0.5666149", "0.5634427...
0.65816563
0
Sets status to a call with given parameters, will notify on succes or error.
setStatusOfCall(callId, status, callsArrayId){ var patchData = { callId: callId, status: status } UpdateCallLog(patchData).then(response => { if(response.status === "OK") { var callsLogs = this.state.calls callsLogs[callsArrayId] = response.data; this.setState({calls: callsLogs, filteredCalls: callsLogs}) toast.success("Status Changed To " + response.data.status.description ) } else { toast.error("Error Changing Status") } }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function updateCallStatus(status) {\n $_this(\"#call-status\").html(status);\n}", "setStatusOfCall(callId, status, callsArrayId){\n var patchData = {\n callId: callId,\n status: status\n }\n\n UpdateCallLog(patchData).then(response => {\n if(response.status === \"OK\")\n {...
[ "0.6543013", "0.61126715", "0.57874435", "0.57742774", "0.5642735", "0.5571528", "0.55477214", "0.55229205", "0.55229205", "0.55152935", "0.55079836", "0.5498298", "0.54933405", "0.5418", "0.53999656", "0.5372049", "0.53691375", "0.5354892", "0.5344342", "0.53082156", "0.5292...
0.61631477
1
listener for internet connection
componentDidMount() { // NetInfo.addEventListener("connectionChange", this._handleConnectionChange); // NetInfo.isConnected.fetch().done(isConnected => { // this._handleConnectionChange; // }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function onNetworkStatusChanged()\n {\n setInternetConnectivity();\n }", "function doOnline() {\n console.log('Event: online\\n' + 'Network Type: ' + navigator.network.connection.type + '\\n');\n //setNetworkType();\n }", "function onConnected() {\n console.log(\"Conn...
[ "0.7400724", "0.7076013", "0.6905801", "0.68138766", "0.679155", "0.6715543", "0.6659728", "0.66023964", "0.6478125", "0.6457009", "0.64541906", "0.6399948", "0.6399948", "0.6353448", "0.63150644", "0.6313401", "0.6289535", "0.6286815", "0.6270326", "0.6194549", "0.61912364",...
0.0
-1
remove the internet listener
componentWillUnmount() { // NetInfo.removeEventListener("change", this._handleConnectionChange); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "cleanup() {\n const { ws, udp } = this.sockets;\n\n if (ws) {\n ws.removeAllListeners('error');\n ws.removeAllListeners('ready');\n ws.removeAllListeners('sessionDescription');\n ws.removeAllListeners('speaking');\n }\n\n if (udp) udp.removeAllListeners('error');\n\n this.sockets...
[ "0.6867692", "0.682865", "0.68000704", "0.68000704", "0.68000704", "0.65104675", "0.6488331", "0.6445912", "0.64288783", "0.6384493", "0.6362424", "0.6362424", "0.6362424", "0.63609797", "0.63594806", "0.6347866", "0.63193446", "0.6307796", "0.62908393", "0.6285485", "0.62810...
0.0
-1
using static to not create a new instance of the block object when calling it
static genesis(){ // return a new instance of the this block class, with dummy data, // the dummy hash just reads first-hash // with an empty array for data return new this('Genesis time', '-----', 'f1r57-h45h', [], 0, DIFFICULTY); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "StaticBlock() {\n pushContext();\n }", "static block() { INSTANCES_COUNT = -1; }", "constructor() { \n \n Block.initialize(this);\n }", "function enterBlock(){\n blockContext = Object.create(blockContext)\n }", "function enterBlock(){\n blockContext = Objec...
[ "0.74672204", "0.69368273", "0.68139464", "0.6769629", "0.6769629", "0.6386431", "0.6367334", "0.6349573", "0.6287399", "0.6286187", "0.6273854", "0.62277627", "0.62277627", "0.6208401", "0.6202992", "0.6193558", "0.61876845", "0.6181156", "0.6090327", "0.6084948", "0.6083892...
0.5683209
57
Hash function: uses timestamp, lasthash and stored data as the N that represents the hashe
static hash(timestamp, lastHash, data, nonce, difficulty){ return ChainUtil.hash(`${timestamp}${lastHash}${data}${nonce}${difficulty}`).toString(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "static hash(timestamp, lastHash, data, nonce, difficulty) {\n \treturn ChainUtil.hash(`${timestamp}${lastHash}${data}${nonce}${difficulty}`).toString();\n }", "calculateHash(){ \r\n return SHA256(this.index + this.previousHas...
[ "0.78690886", "0.7355337", "0.73309845", "0.73182297", "0.73091763", "0.7297435", "0.7273449", "0.72452766", "0.7225147", "0.7198172", "0.7198172", "0.7193585", "0.71111614", "0.69616747", "0.68930244", "0.68919784", "0.68058074", "0.6762053", "0.6741979", "0.6735577", "0.668...
0.7995697
0
add leading zeroes if it's less than 10
function addLeadingZeroes(time) { return time < 10 ? `0${time}` : time }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function addLeadingZero(i) {\n if (i<10) {\n i = \"0\" + i;\n }\n return i;\n}", "function appendLeadingZeroes(n){\n if(n <= 9){\n return \"0\" + n;\n }\n return n\n}", "function addLeadingZero (n) {\n if(n <= 9) {\n return '0'+ n; \n } else {\n return '' + n; ...
[ "0.82120425", "0.8100252", "0.8022078", "0.77793133", "0.77631044", "0.7762038", "0.77576643", "0.77438617", "0.7734648", "0.77092063", "0.7697448", "0.7696939", "0.7686121", "0.76790303", "0.7658734", "0.76448584", "0.7633852", "0.76337606", "0.76302874", "0.76190233", "0.76...
0.75564784
30
Make an item editable
function editItem(id) { // we search for the id var _index = -1; var _section = -1; for (_sec in myKey.data) { for (_item in myKey.data[_sec]["content"]) { if (myKey.data[_sec]["content"][_item]["id"] == id) { _section = _sec; _index = _item; break; } } } var _form = '<tr id="row_'+id+'" class="row_form"><form name="edit_'+id+'">'; _form += '<td class="form_title"><input type="text" name="title" size="30" value="'+htmlentities(myKey.data[_section]["content"][_index]["title"])+'" /></td>'; _form += '<td class="form_login"><input type="text" name="login" size="30" value="'+htmlentities(myKey.data[_section]["content"][_index]["user"])+'" /></td>'; _form += '<td class="form_password"><input type="text" name="password" size="30" value="'+htmlentities(myKey.data[_section]["content"][_index]["password"])+'" onKeyPress="submitEnter(\'modifyItem('+_section+','+id+')\')" /></td>'; _form += '<td class="form_comment"><input type="text" name="comment" size="60"value="'+htmlentities(myKey.data[_section]["content"][_index]["comment"])+'" onKeyPress="submitEnter(\'modifyItem('+_section+','+id+')\')" /></td>'; _form += '<td class="form_button"><input type="button" onClick="modifyItem('+_section+','+id+')" value="OK" /></td></form></tr>'; $("#row_"+id).replaceWith(_form); // we remplace the line by the form }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "set editable(value) {}", "get editable() {}", "function editable(el) {\n // set the clicked list element as editable\n el.target.contentEditable = true;\n //set the focus on this element in order to be able to change the text\n // and to keep the drag functionality working\n el.target.focus();\n}", "edi...
[ "0.7832706", "0.76890695", "0.7298008", "0.723219", "0.71760714", "0.7006337", "0.6991115", "0.6939955", "0.69354296", "0.69242406", "0.6768807", "0.67586416", "0.67541623", "0.67514807", "0.66920185", "0.66461456", "0.66443276", "0.6589675", "0.6564702", "0.65615666", "0.648...
0.0
-1
will save change we have to proceed with id, and not index, because user may delete previous lines while editing
function modifyItem(section, id) { if (document.forms['edit_'+id].elements['title'].value == '' || document.forms['edit_'+id].elements['login'].value == '' || document.forms['edit_'+id].elements['password'].value == '') { error("Les champs Titre, Login et MdP sont obligatoires"); return; } var _index = -1; // we have to search the right object, and feed it // I didn't find a better way than a loop, sorry for (var _item in myKey.data[section]["content"]) { if (myKey.data[section]["content"][_item]["id"] == id) { _index = _item; break; } } if (_index == -1) { // we did not found the right line error("Impossible de modifier l'élément"); return; } myKey.data[section]["content"][_index] = { title: document.forms['edit_'+id].elements['title'].value, user: document.forms['edit_'+id].elements['login'].value, password: document.forms['edit_'+id].elements['password'].value, comment: document.forms['edit_'+id].elements['comment'].value, id: id // do not change }; // we serialize and then encrypt data (the whole section) var _content = JSON.stringify(myKey.data[section]["content"]); var _data = myKey.encrypt(_content); // ask the server to do the same // we resend our key each time, to validate it's not anyone doing bullshit $.ajax({ type: 'POST', url: serverUrl+"request/change_data", data: {content: _data, id: myKey.data[section]["id"], user: myKey.user, key: myKey.key}, success: success, error: serverError }); // reset the line $("#row_"+id).replaceWith(addRow(_index, myKey.data[section]["content"][_index])); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function _inLineSave(saveit) {\n console.log (\"ListMain _inLineSave : saveit:\"+saveit+\" [\"+ inlineCtl.editidx + \"] : \" + JSON.stringify(inlineCtl.editval));\n if (saveit) { // save\n let clonearray = inlineCtl.records.slice(0);\n if (inlineCtl.editidx >= 0) { // save existing row\n clo...
[ "0.70907646", "0.6938121", "0.68092304", "0.6605289", "0.6424429", "0.63699573", "0.63286257", "0.6288464", "0.62252146", "0.61834395", "0.61721957", "0.6157781", "0.61292386", "0.61203444", "0.6114695", "0.6099024", "0.6097203", "0.6096143", "0.60840994", "0.60575503", "0.60...
0.0
-1
Delete an element of the array
function removeItem(id) { // we search for the id var _index = -1; var _section = -1; for (var _sec in myKey.data) { for (var _item in myKey.data[_sec]["content"]) { if (myKey.data[_sec]["content"][_item]["id"] == id) { _section = _sec; _index = _item; break; } } } var _result = window.confirm("Êtes-vous sur de vouloir supprimer '"+myKey.data[_section]["content"][_index]["title"]+"' ? Cette opération est irréversible."); if (_result === true && _index != -1 && _section != -1) { // we delete the line in the array myKey.data[_section]["content"].splice(_index,1); // we serialize and then encrypt data (the whole section) var _content = JSON.stringify(myKey.data[_section]["content"]); var _data = myKey.encrypt(_content); $.ajax({ type: 'POST', url: serverUrl+"request/change_data", data: {content: _data, id: myKey.data[_section]["id"], user: myKey.user, key: myKey.key}, success: success, error: serverError }); // delete DOM $("#row_"+id).remove(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "DeleteArrayElementAtIndex() {}", "function DeleteArrayElement(array, x) {\n var i = 0;\n while (i < array.length && array[i] != x)\n i++;\n array.splice(i, 1);\n}", "function deleteElement(someArr) {\r\nconsole.log(someArr.length);\r\ndelete someArr[2];\r\nconsole.log(someArr.length);\r\n}", "static re...
[ "0.8455729", "0.7927629", "0.7744278", "0.77332234", "0.7622343", "0.75672406", "0.7525732", "0.7511579", "0.7483059", "0.7464343", "0.7448058", "0.7440612", "0.74392563", "0.7433575", "0.74156415", "0.7393762", "0.7393762", "0.7393762", "0.7393762", "0.7393762", "0.7393762",...
0.0
-1
Easy API for creating new setFilters
function setFilters() {}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function setFilters(){}", "function setFilters(){}", "function setFilters(){}", "function setFilters(){}", "function setFilters(){}", "function setFilters(){}", "function setFilters(){}", "function setFilters(){}", "function setFilters(){}" ]
[ "0.8424095", "0.8424095", "0.8424095", "0.8424095", "0.8424095", "0.8424095", "0.8424095", "0.8424095", "0.8424095" ]
0.0
-1
Implement the identical functionality for filter and not
function winnow( elements, qualifier, not ) { if ( jQuery.isFunction( qualifier ) ) { return jQuery.grep( elements, function( elem, i ) { return !!qualifier.call( elem, i, elem ) !== not; } ); } // Single element if ( qualifier.nodeType ) { return jQuery.grep( elements, function( elem ) { return ( elem === qualifier ) !== not; } ); } // Arraylike of elements (jQuery, arguments, Array) if ( typeof qualifier !== "string" ) { return jQuery.grep( elements, function( elem ) { return ( indexOf.call( qualifier, elem ) > -1 ) !== not; } ); } // Simple selector that can be filtered directly, removing non-Elements if ( risSimple.test( qualifier ) ) { return jQuery.filter( qualifier, elements, not ); } // Complex selector, compare the two sets, removing non-Elements qualifier = jQuery.filter( qualifier, elements ); return jQuery.grep( elements, function( elem ) { return ( indexOf.call( qualifier, elem ) > -1 ) !== not && elem.nodeType === 1; } ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "filter() {\n\t}", "filter() {\n\t}", "function filter() {\n \n}", "function filterFunction() {\n \n}", "function Nothing$prototype$filter(pred) {\n return this;\n }", "removeAllFilters() {}", "function noFilter(filterObj) {\n return Object.\n keys(filterObj).\n ...
[ "0.7415891", "0.7415891", "0.71924883", "0.68619496", "0.67648804", "0.6652573", "0.64584637", "0.64584637", "0.64584637", "0.64584637", "0.6294628", "0.62928224", "0.6256001", "0.62469697", "0.6207571", "0.61991894", "0.61926854", "0.6190803", "0.6184332", "0.61646616", "0.6...
0.0
-1
Convert Stringformatted options into Objectformatted ones
function createOptions( options ) { var object = {}; jQuery.each( options.match( rnothtmlwhite ) || [], function( _, flag ) { object[ flag ] = true; } ); return object; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function normalizeOption(option){if(isString(option)){return normalizeStringOption(option);}else if(isGroup(option)){var title=option.title,options=option.options;return{title:title,options:options.map(function(option){return isString(option)?normalizeStringOption(option):option;})};}return option;}", "function ...
[ "0.66466105", "0.66000164", "0.66000164", "0.66000164", "0.6495313", "0.63192004", "0.62976897", "0.6296341", "0.629607", "0.6251182", "0.6246023", "0.6192017", "0.61583936", "0.61466974", "0.6105758", "0.60930765", "0.60897726", "0.60074645", "0.5976884", "0.5964293", "0.594...
0.0
-1
The ready event handler and self cleanup method
function completed() { document.removeEventListener( "DOMContentLoaded", completed ); window.removeEventListener( "load", completed ); jQuery.ready(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function readyCallBack() {\n}", "static ready() { }", "onReady() {}", "ready() {\r\n\t\tsuper.ready();\r\n\t}", "ready() {\n super.ready();\n }", "ready() {\n super.ready();\n }", "ready() {\n super.ready();\n }", "ready() {\n super.ready();\n }", "ready() {\...
[ "0.72463065", "0.7211212", "0.7172562", "0.7149137", "0.70596856", "0.70596856", "0.70596856", "0.70596856", "0.70596856", "0.70596856", "0.70596856", "0.70596856", "0.70596856", "0.70596856", "0.70596856", "0.70596856", "0.7042607", "0.7042607", "0.7042607", "0.7042607", "0....
0.0
-1
Mark scripts as having already been evaluated
function setGlobalEval( elems, refElements ) { var i = 0, l = elems.length; for ( ; i < l; i++ ) { dataPriv.set( elems[ i ], "globalEval", !refElements || dataPriv.get( refElements[ i ], "globalEval" ) ); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "globalEval() {\n // phase one, if we have head inserts, we build up those before going into the script eval phase\n let insertHeadElems = new ExtDomQuery_1.ExtDomQuery(...this.internalContext.getIf(Const_1.DEFERRED_HEAD_INSERTS).value);\n insertHeadElems.runHeadInserts(true);\n // phas...
[ "0.5987435", "0.5798831", "0.5772783", "0.57142234", "0.5673525", "0.56659687", "0.5592892", "0.5492997", "0.5467838", "0.53731847", "0.5336245", "0.5309647", "0.5303123", "0.52803385", "0.52720535", "0.52717704", "0.52695596", "0.52677536", "0.52672625", "0.52672625", "0.525...
0.0
-1
Support: IE <=9 only See 13393 for more info
function safeActiveElement() { try { return document.activeElement; } catch ( err ) { } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function isLowIE9() {\r\n var e = window.navigator.userAgent.toString().toUpperCase();\r\n var flag = false;\r\n if (e.indexOf(\"MSIE\") >= 0) {\r\n\r\n if (e.indexOf(\"MSIE 6.0\") > 0) flag = true;\r\n if (e.indexOf(\"MSIE 7.0\") > 0) flag = true;\r\n if (e.in...
[ "0.69001865", "0.6632586", "0.66062343", "0.66062343", "0.6462999", "0.63906205", "0.63459784", "0.62986887", "0.62986887", "0.62909245", "0.62504256", "0.6228042", "0.6219376", "0.6161653", "0.61427975", "0.61396265", "0.61259824", "0.61128104", "0.60863733", "0.60849094", "...
0.0
-1
Prefer a tbody over its parent table for containing new rows
function manipulationTarget( elem, content ) { if ( nodeName( elem, "table" ) && nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ) { return jQuery( ">tbody", elem )[ 0 ] || elem; } return elem; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function r(a,b){return fa.nodeName(a,\"table\")&&fa.nodeName(11!==b.nodeType?b:b.firstChild,\"tr\")?a.getElementsByTagName(\"tbody\")[0]||a.appendChild(a.ownerDocument.createElement(\"tbody\")):a}", "_createDataRows(tbody) {\r\n const that = this,\r\n rowDetailTemplate = that.rowDetailTemplate,...
[ "0.7107587", "0.7010916", "0.6952618", "0.67297685", "0.6453712", "0.6438194", "0.6407297", "0.6404014", "0.63836247", "0.6368428", "0.6368428", "0.63280684", "0.6327325", "0.6327325", "0.6292218", "0.62868154", "0.62868154", "0.6276107", "0.6218812", "0.62149054", "0.6211464...
0.0
-1
Replace/restore the type attribute of script elements for safe DOM manipulation
function disableScript( elem ) { elem.type = ( elem.getAttribute( "type" ) !== null ) + "/" + elem.type; return elem; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function disableScript( elem ) {\r\n\tvar attr = elem.getAttributeNode(\"type\");\r\n\telem.type = ( attr && attr.specified ) + \"/\" + elem.type;\r\n\treturn elem;\r\n}", "function disableScript( elem ) {\n\tvar attr = elem.getAttributeNode(\"type\");\n\telem.type = ( attr && attr.specified ) + \"/\" + elem.typ...
[ "0.7015873", "0.69847023", "0.69847023", "0.69847023", "0.69847023", "0.69847023", "0.69847023", "0.69847023", "0.69847023", "0.69847023", "0.69847023", "0.69413453", "0.6936604", "0.68999", "0.6887315", "0.6887315", "0.6887315", "0.6885814", "0.68844295", "0.68820846", "0.68...
0.0
-1
Fix IE bugs, see support tests
function fixInput( src, dest ) { var nodeName = dest.nodeName.toLowerCase(); // Fails to persist the checked state of a cloned checkbox or radio button. if ( nodeName === "input" && rcheckableType.test( src.type ) ) { dest.checked = src.checked; // Fails to return the selected option to the default selected state when cloning options } else if ( nodeName === "input" || nodeName === "textarea" ) { dest.defaultValue = src.defaultValue; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function IEcompatibility() {\n\t// Only do anything if this is IE\n\tif(Browser.ie){\n\t\tvar __fix = $$(\"#kbbcode-size-options\", \"#kbbcode-size-options span\", \n\t\t\t\t\t\t\"#kbbcode-colortable\", \"#kbbcode-colortable td\");\n\t\tif (__fix) {\n\t\t\t__fix.setProperty('unselectable', 'on');\n\t\t}\n\t}\n}", ...
[ "0.7220337", "0.70940924", "0.699044", "0.68625945", "0.66801953", "0.6574329", "0.6557123", "0.65142417", "0.65142417", "0.64660573", "0.64034224", "0.6379892", "0.6297539", "0.6296395", "0.62622595", "0.6166529", "0.6163856", "0.61358476", "0.61114734", "0.6054131", "0.6026...
0.0
-1
Executing both pixelPosition & boxSizingReliable tests require only one layout so they're executed at the same time to save the second computation.
function computeStyleTests() { // This is a singleton, we need to execute it only once if ( !div ) { return; } div.style.cssText = "box-sizing:border-box;" + "position:relative;display:block;" + "margin:auto;border:1px;padding:1px;" + "top:1%;width:50%"; div.innerHTML = ""; documentElement.appendChild( container ); var divStyle = window.getComputedStyle( div ); pixelPositionVal = divStyle.top !== "1%"; // Support: Android 4.0 - 4.3 only, Firefox <=3 - 44 reliableMarginLeftVal = divStyle.marginLeft === "2px"; boxSizingReliableVal = divStyle.width === "4px"; // Support: Android 4.0 - 4.3 only // Some styles come back with percentage values, even though they shouldn't div.style.marginRight = "50%"; pixelMarginRightVal = divStyle.marginRight === "4px"; documentElement.removeChild( container ); // Nullify the div so it wouldn't be stored in the memory and // it will also be a sign that checks already performed div = null; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function computePixelPositionAndBoxSizingReliable() {\n\t\t\t// Support: Firefox, Android 2.3 (Prefixed box-sizing versions).\n\t\t\tdiv.style.cssText = \"-webkit-box-sizing:border-box;-moz-box-sizing:border-box;\" +\n\t\t\t\t\"box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;\" +...
[ "0.72141", "0.7208893", "0.7208893", "0.7207913", "0.7207913", "0.7151905", "0.7151905", "0.7149795", "0.7133335", "0.7133335", "0.7133335", "0.7133335", "0.7133335", "0.7133335", "0.7133335", "0.7133335", "0.7133335", "0.7133335", "0.7133335", "0.7133335", "0.7133335", "0....
0.0
-1
Return a css property mapped to a potentially vendor prefixed property
function vendorPropName( name ) { // Shortcut for names that are not vendor prefixed if ( name in emptyStyle ) { return name; } // Check for vendor prefixed names var capName = name[ 0 ].toUpperCase() + name.slice( 1 ), i = cssPrefixes.length; while ( i-- ) { name = cssPrefixes[ i ] + capName; if ( name in emptyStyle ) { return name; } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function vendorPropName(name){// Shortcut for names that are not vendor prefixed\nif(name in emptyStyle){return name;}// Check for vendor prefixed names\nvar capName=name[0].toUpperCase()+name.slice(1),i=cssPrefixes.length;while(i--){name=cssPrefixes[i]+capName;if(name in emptyStyle){return name;}}}// Return a pro...
[ "0.8101963", "0.8101963", "0.78021914", "0.78021914", "0.78021914", "0.78021914", "0.78021914", "0.78021914", "0.78021914", "0.78021914", "0.7735111", "0.77216125", "0.7643077", "0.7609047", "0.76016206", "0.7530761", "0.7466321", "0.74608654", "0.744541", "0.74176997", "0.73...
0.0
-1
Return a property mapped along what jQuery.cssProps suggests or to a vendor prefixed property.
function finalPropName( name ) { var ret = jQuery.cssProps[ name ]; if ( !ret ) { ret = jQuery.cssProps[ name ] = vendorPropName( name ) || name; } return ret; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function vendorPropName(name){// Shortcut for names that are not vendor prefixed\nif(name in emptyStyle){return name;}// Check for vendor prefixed names\nvar capName=name[0].toUpperCase()+name.slice(1),i=cssPrefixes.length;while(i--){name=cssPrefixes[i]+capName;if(name in emptyStyle){return name;}}}// Return a pro...
[ "0.8121942", "0.8121942", "0.7477362", "0.7477362", "0.7477362", "0.7477362", "0.7477362", "0.7477362", "0.7477362", "0.7477362", "0.73348564", "0.73348564", "0.7179046", "0.7175243", "0.7073637" ]
0.7001662
95
Animations created synchronously will run synchronously
function createFxNow() { window.setTimeout( function() { fxNow = undefined; } ); return ( fxNow = jQuery.now() ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "_playAnimation() {\n if (this._animationLast === undefined && this._animationQueue.length > 0) {\n this._animationLast = this._animationCurrent;\n this._animationCurrent = this._animationQueue.shift();\n console.log(\"New: \" + this._animationCurrent.name);\n this...
[ "0.72297084", "0.7172655", "0.6751781", "0.6701827", "0.66490537", "0.6644208", "0.66413045", "0.65767395", "0.6515558", "0.64943016", "0.64906734", "0.6407048", "0.6392758", "0.6383256", "0.63779354", "0.6373179", "0.63684577", "0.6353303", "0.63494754", "0.6331653", "0.6321...
0.0
-1
Generate parameters to create a standard animation
function genFx( type, includeWidth ) { var which, i = 0, attrs = { height: type }; // If we include width, step value is 1 to do all cssExpand values, // otherwise step value is 2 to skip over Left and Right includeWidth = includeWidth ? 1 : 0; for ( ; i < 4; i += 2 - includeWidth ) { which = cssExpand[ i ]; attrs[ "margin" + which ] = attrs[ "padding" + which ] = type; } if ( includeWidth ) { attrs.opacity = attrs.width = type; } return attrs; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function setParameters() {\n params.viscosity = 0.02;\n params.u0 = -amplitude;\n params.one36th = 1 / 36;\n params.one9th = 1 / 9;\n params.four9ths = 4 / 9;\n params.gridSize = 5;\n params.m = int(height / params.gridSize);\n params.n = int(width / params.gridSize);\n}", "function generateAnimationPara...
[ "0.6477499", "0.6449747", "0.6239411", "0.62102515", "0.62051743", "0.6019592", "0.599829", "0.594838", "0.5940393", "0.5940393", "0.5912163", "0.5873654", "0.5832134", "0.5828958", "0.58236474", "0.5820797", "0.5813001", "0.579854", "0.57910967", "0.57835335", "0.5780475", ...
0.0
-1
Strip and collapse whitespace according to HTML spec
function stripAndCollapse( value ) { var tokens = value.match( rnothtmlwhite ) || []; return tokens.join( " " ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function stripAndCollapse(value){var tokens=value.match(rnothtmlwhite)||[];return tokens.join(\" \");}", "function stripAndCollapse(value){var tokens=value.match(rnothtmlwhite)||[];return tokens.join(\" \");}", "function stripAndCollapse(value){var tokens=value.match(rnothtmlwhite)||[];return tokens.join(\" \"...
[ "0.7922654", "0.7922654", "0.7922654", "0.76792663", "0.7598382", "0.75876707", "0.75836885", "0.75606817", "0.75550926", "0.75550926", "0.75550926", "0.75550926", "0.75550926", "0.75550926", "0.75550926", "0.75550926", "0.75550926", "0.75550926", "0.75550926", "0.75550926", ...
0.0
-1
Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
function addToPrefiltersOrTransports( structure ) { // dataTypeExpression is optional and defaults to "*" return function( dataTypeExpression, func ) { if ( typeof dataTypeExpression !== "string" ) { func = dataTypeExpression; dataTypeExpression = "*"; } var dataType, i = 0, dataTypes = dataTypeExpression.toLowerCase().match( rnothtmlwhite ) || []; if ( jQuery.isFunction( func ) ) { // For each dataType in the dataTypeExpression while ( ( dataType = dataTypes[ i++ ] ) ) { // Prepend if requested if ( dataType[ 0 ] === "+" ) { dataType = dataType.slice( 1 ) || "*"; ( structure[ dataType ] = structure[ dataType ] || [] ).unshift( func ); // Otherwise append } else { ( structure[ dataType ] = structure[ dataType ] || [] ).push( func ); } } } }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "constructor() {\n this.config = Config.ajax;\n this.xhr;\n this.Serialize;\n }", "function AjaxPipelineConstructor() {\r\n BaseObject.call(this,arguments);\r\n }", "function Ajax(__constructor) {\r\n if (Params.env.isFirefox) return GM_xmlhttpRequest(__constructor);\r\n ...
[ "0.6992614", "0.6823499", "0.6370965", "0.6163726", "0.59268177", "0.5839015", "0.5838031", "0.5838031", "0.5830174", "0.5830174", "0.5830174", "0.5830174", "0.5830174", "0.5830174", "0.57987124", "0.5788393", "0.5788393", "0.57442814", "0.5731633", "0.5730933", "0.5663518", ...
0.0
-1
Base inspection function for prefilters and transports
function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) { var inspected = {}, seekingTransport = ( structure === transports ); function inspect( dataType ) { var selected; inspected[ dataType ] = true; jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) { var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR ); if ( typeof dataTypeOrTransport === "string" && !seekingTransport && !inspected[ dataTypeOrTransport ] ) { options.dataTypes.unshift( dataTypeOrTransport ); inspect( dataTypeOrTransport ); return false; } else if ( seekingTransport ) { return !( selected = dataTypeOrTransport ); } } ); return selected; } return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function inspectPrefiltersOrTransports(structure, options, originalOptions, jqXHR) {\n\n var inspected = {},\n seekin...
[ "0.6271232", "0.62278324", "0.6089844", "0.6089844", "0.6089844", "0.6089844", "0.6089844", "0.6089844", "0.6089844", "0.6089844", "0.6089844", "0.6089844", "0.607385", "0.60586876", "0.60586876", "0.6036968", "0.601241", "0.601241", "0.601241", "0.601241", "0.601241", "0.6...
0.0
-1
A special extend for ajax options that takes "flat" options (not to be deep extended) Fixes 9887
function ajaxExtend( target, src ) { var key, deep, flatOptions = jQuery.ajaxSettings.flatOptions || {}; for ( key in src ) { if ( src[ key ] !== undefined ) { ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ]; } } if ( deep ) { jQuery.extend( true, target, deep ); } return target; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function ajaxExtend(target,src){var key,deep,flatOptions=jQuery.ajaxSettings.flatOptions||{};for(key in src){if(src[key]!==undefined){(flatOptions[key]?target:deep||(deep={}))[key]=src[key];}}if(deep){jQuery.extend(true,target,deep);}}", "function ajaxExtend(target,src){var key,deep,flatOptions=jQuery.ajaxSettin...
[ "0.76659936", "0.7609184", "0.75649804", "0.75649804", "0.75649804", "0.75649804", "0.75649804", "0.75649804", "0.75458026", "0.75458026", "0.75258815", "0.74553305", "0.7317385", "0.73116934", "0.72906065", "0.7289743", "0.72549486", "0.7240588", "0.72396123", "0.72396123", ...
0.0
-1
Handles responses to an ajax request: finds the right dataType (mediates between contenttype and expected dataType) returns the corresponding response
function ajaxHandleResponses( s, jqXHR, responses ) { var ct, type, finalDataType, firstDataType, contents = s.contents, dataTypes = s.dataTypes; // Remove auto dataType and get content-type in the process while ( dataTypes[ 0 ] === "*" ) { dataTypes.shift(); if ( ct === undefined ) { ct = s.mimeType || jqXHR.getResponseHeader( "Content-Type" ); } } // Check if we're dealing with a known content-type if ( ct ) { for ( type in contents ) { if ( contents[ type ] && contents[ type ].test( ct ) ) { dataTypes.unshift( type ); break; } } } // Check to see if we have a response for the expected dataType if ( dataTypes[ 0 ] in responses ) { finalDataType = dataTypes[ 0 ]; } else { // Try convertible dataTypes for ( type in responses ) { if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[ 0 ] ] ) { finalDataType = type; break; } if ( !firstDataType ) { firstDataType = type; } } // Or just use first one finalDataType = finalDataType || firstDataType; } // If we found a dataType // We add the dataType to the list if needed // and return the corresponding response if ( finalDataType ) { if ( finalDataType !== dataTypes[ 0 ] ) { dataTypes.unshift( finalDataType ); } return responses[ finalDataType ]; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function ajaxHandleResponses(s,jqXHR,responses){var firstDataType,ct,finalDataType,type,contents=s.contents,dataTypes=s.dataTypes;// Remove auto dataType and get content-type in the process\nwhile(dataTypes[0]===\"*\"){dataTypes.shift();if(ct===undefined){ct=s.mimeType||jqXHR.getResponseHeader(\"Content-Type\");}}...
[ "0.7849781", "0.78375864", "0.78375864", "0.77765334", "0.7762038", "0.77573496", "0.7718941", "0.7715676", "0.7673022", "0.7630034", "0.7614433", "0.7604816", "0.76005447", "0.759947", "0.7597553", "0.7597553", "0.7597553", "0.7597553", "0.7597553", "0.7597553", "0.7597553",...
0.0
-1
Chain conversions given the request and the original response Also sets the responseXXX fields on the jqXHR instance
function ajaxConvert( s, response, jqXHR, isSuccess ) { var conv2, current, conv, tmp, prev, converters = {}, // Work with a copy of dataTypes in case we need to modify it for conversion dataTypes = s.dataTypes.slice(); // Create converters map with lowercased keys if ( dataTypes[ 1 ] ) { for ( conv in s.converters ) { converters[ conv.toLowerCase() ] = s.converters[ conv ]; } } current = dataTypes.shift(); // Convert to each sequential dataType while ( current ) { if ( s.responseFields[ current ] ) { jqXHR[ s.responseFields[ current ] ] = response; } // Apply the dataFilter if provided if ( !prev && isSuccess && s.dataFilter ) { response = s.dataFilter( response, s.dataType ); } prev = current; current = dataTypes.shift(); if ( current ) { // There's only work to do if current dataType is non-auto if ( current === "*" ) { current = prev; // Convert response if prev dataType is non-auto and differs from current } else if ( prev !== "*" && prev !== current ) { // Seek a direct converter conv = converters[ prev + " " + current ] || converters[ "* " + current ]; // If none found, seek a pair if ( !conv ) { for ( conv2 in converters ) { // If conv2 outputs current tmp = conv2.split( " " ); if ( tmp[ 1 ] === current ) { // If prev can be converted to accepted input conv = converters[ prev + " " + tmp[ 0 ] ] || converters[ "* " + tmp[ 0 ] ]; if ( conv ) { // Condense equivalence converters if ( conv === true ) { conv = converters[ conv2 ]; // Otherwise, insert the intermediate dataType } else if ( converters[ conv2 ] !== true ) { current = tmp[ 0 ]; dataTypes.unshift( tmp[ 1 ] ); } break; } } } } // Apply converter (if not an equivalence) if ( conv !== true ) { // Unless errors are allowed to bubble, catch and return them if ( conv && s.throws ) { response = conv( response ); } else { try { response = conv( response ); } catch ( e ) { return { state: "parsererror", error: conv ? e : "No conversion from " + prev + " to " + current }; } } } } } } return { state: "success", data: response }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function ajaxConvert(s,response,jqXHR,isSuccess){var conv2,current,conv,tmp,prev,converters={}, // Work with a copy of dataTypes in case we need to modify it for conversion\ndataTypes=s.dataTypes.slice(); // Create converters map with lowercased keys\nif(dataTypes[1]){for(conv in s.converters){converters[conv.toLo...
[ "0.62714094", "0.62647414", "0.6205049", "0.6195484", "0.6194774", "0.6179257", "0.6179257", "0.6176538", "0.6153255", "0.60963935", "0.60910285", "0.60877764", "0.60877764", "0.60877764", "0.60877764", "0.60877764", "0.60756016", "0.60756016", "0.60756016", "0.6051014", "0.6...
0.0
-1
Callback for when everything is done
function done( status, nativeStatusText, responses, headers ) { var isSuccess, success, error, response, modified, statusText = nativeStatusText; // Ignore repeat invocations if ( completed ) { return; } completed = true; // Clear timeout if it exists if ( timeoutTimer ) { window.clearTimeout( timeoutTimer ); } // Dereference transport for early garbage collection // (no matter how long the jqXHR object will be used) transport = undefined; // Cache response headers responseHeadersString = headers || ""; // Set readyState jqXHR.readyState = status > 0 ? 4 : 0; // Determine if successful isSuccess = status >= 200 && status < 300 || status === 304; // Get response data if ( responses ) { response = ajaxHandleResponses( s, jqXHR, responses ); } // Convert no matter what (that way responseXXX fields are always set) response = ajaxConvert( s, response, jqXHR, isSuccess ); // If successful, handle type chaining if ( isSuccess ) { // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. if ( s.ifModified ) { modified = jqXHR.getResponseHeader( "Last-Modified" ); if ( modified ) { jQuery.lastModified[ cacheURL ] = modified; } modified = jqXHR.getResponseHeader( "etag" ); if ( modified ) { jQuery.etag[ cacheURL ] = modified; } } // if no content if ( status === 204 || s.type === "HEAD" ) { statusText = "nocontent"; // if not modified } else if ( status === 304 ) { statusText = "notmodified"; // If we have data, let's convert it } else { statusText = response.state; success = response.data; error = response.error; isSuccess = !error; } } else { // Extract error from statusText and normalize for non-aborts error = statusText; if ( status || !statusText ) { statusText = "error"; if ( status < 0 ) { status = 0; } } } // Set data for the fake xhr object jqXHR.status = status; jqXHR.statusText = ( nativeStatusText || statusText ) + ""; // Success/Error if ( isSuccess ) { deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] ); } else { deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] ); } // Status-dependent callbacks jqXHR.statusCode( statusCode ); statusCode = undefined; if ( fireGlobals ) { globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError", [ jqXHR, s, isSuccess ? success : error ] ); } // Complete completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] ); if ( fireGlobals ) { globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] ); // Handle the global AJAX counter if ( !( --jQuery.active ) ) { jQuery.event.trigger( "ajaxStop" ); } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function done() {}", "function finished(err){\n }", "onFinish() {}", "function AllDone(){\n \n}", "async onFinished() {}", "done() {}", "_onEnd() {}", "done () {}", "complete() {}", "function onFinish() {\n console.log('finished!');\n}", "function complete(){\r\n ...
[ "0.7607877", "0.73473793", "0.73289984", "0.7317956", "0.7304225", "0.72417575", "0.7235767", "0.69856775", "0.68565404", "0.6855536", "0.6845145", "0.6817738", "0.6773241", "0.6773241", "0.6773241", "0.6773241", "0.677228", "0.67654777", "0.67654777", "0.6763289", "0.6711056...
0.0
-1
Same as native getBoundingClientRect, except it takes into account parent offsets if the element lies within a nested document ( or like).
function getActualBoundingClientRect(node) { var boundingRect = node.getBoundingClientRect(); // The original object returned by getBoundingClientRect is immutable, so we clone it // We can't use extend because the properties are not considered part of the object by hasOwnProperty in IE9 var rect = {}; for (var k in boundingRect) { rect[k] = boundingRect[k]; } if (node.ownerDocument !== document) { var _frameElement = node.ownerDocument.defaultView.frameElement; if (_frameElement) { var frameRect = getActualBoundingClientRect(_frameElement); rect.top += frameRect.top; rect.bottom += frameRect.top; rect.left += frameRect.left; rect.right += frameRect.left; } } return rect; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getBoundingClientRect(element) {\n var el, parent, top;\n if (element.getBoundingClientRect != null) {\n return element.getBoundingClientRect();\n }\n top = 0;\n el = element;\n while (el) {\n top += el.offsetT...
[ "0.7891227", "0.7073936", "0.6952669", "0.688801", "0.6880152", "0.6874782", "0.6874782", "0.68610895", "0.6841531", "0.6841531", "0.6841531", "0.6841531", "0.6835384", "0.6815901", "0.6804914", "0.6804137", "0.6781507", "0.6781507", "0.6771269", "0.6771269", "0.6771269", "...
0.63515276
96
Updates the position of the popper, computing the new offsets and applying the new style. Prefer `scheduleUpdate` over `update` because of performance reasons.
function update() { // if popper is destroyed, don't perform any further update if (this.state.isDestroyed) { return; } var data = { instance: this, styles: {}, arrowStyles: {}, attributes: {}, flipped: false, offsets: {} }; // compute reference element offsets data.offsets.reference = getReferenceOffsets(this.state, this.popper, this.reference); // compute auto placement, store placement inside the data object, // modifiers will be able to edit `placement` if needed // and refer to originalPlacement to know the original value data.placement = computeAutoPlacement(this.options.placement, data.offsets.reference, this.popper, this.reference, this.options.modifiers.flip.boundariesElement, this.options.modifiers.flip.padding); // store the computed placement inside `originalPlacement` data.originalPlacement = data.placement; // compute the popper offsets data.offsets.popper = getPopperOffsets(this.popper, data.offsets.reference, data.placement); data.offsets.popper.position = 'absolute'; // run the modifiers data = runModifiers(this.modifiers, data); // the first `update` will call `onCreate` callback // the other ones will call `onUpdate` callback if (!this.state.isCreated) { this.state.isCreated = true; this.options.onCreate(data); } else { this.options.onUpdate(data); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function update() {\n\t // if popper is destroyed, don't perform any further update\n\t if (this.state.isDestroyed) {\n\t return;\n\t }\n\t\n\t var data = {\n\t instance: this,\n\t styles: {},\n\t arrowStyles: {},\n\t attributes: {},\n\t flipped: false,\n\t offsets: {}\n\t };\n\t\n\t // ...
[ "0.81239015", "0.8096504", "0.80928975", "0.80928975", "0.80928975", "0.80928975", "0.8074649", "0.8074649", "0.8074649", "0.8074649", "0.8074649", "0.8074649", "0.8074649", "0.8074649", "0.8074649", "0.8074649", "0.8074649", "0.8074649", "0.8074649", "0.8074649", "0.8074649"...
0.0
-1
Setup needed event listeners used to update the popper position
function setupEventListeners(reference, options, state, updateBound) { // Resize event listener on window state.updateBound = updateBound; window.addEventListener('resize', state.updateBound, { passive: true }); // Scroll event listener on scroll parents var scrollElement = getScrollParent(reference); attachToScrollParents(scrollElement, 'scroll', state.updateBound, state.scrollParents); state.scrollElement = scrollElement; state.eventsEnabled = true; return state; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function g(e){if(Q.popperInstance?(y()||Q.popperInstance.scheduleUpdate(),Q.props.livePlacement&&!y()&&Q.popperInstance.enableEventListeners()):(Q.popperInstance=v(),Q.props.livePlacement||Q.popperInstance.disableEventListeners())\n/**\n * If the instance previously had followCursor behavior, it will be\n ...
[ "0.6769328", "0.64210093", "0.64043796", "0.6225007", "0.61851645", "0.6183115", "0.61671126", "0.6155106", "0.6139235", "0.6106033", "0.6097217", "0.60809004", "0.60684043", "0.6066761", "0.6035161", "0.60333353", "0.60276574", "0.602691", "0.6025185", "0.6017188", "0.601718...
0.0
-1
It will add resize/scroll events and start recalculating position of the popper element when they are triggered.
function enableEventListeners() { if (!this.state.eventsEnabled) { this.state = setupEventListeners(this.reference, this.options, this.state, this.scheduleUpdate); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "adoptPositionOnResize() {\n if (this.adoptOnResize) {\n\n /**\n * Get app event manager\n * @type {ApplicationEventManager|{subscribe, eventList}}\n */\n const appEventManager = this.view.controller.root().eventManager;\n\n appEventManager.subscribe({\n event: {name: appE...
[ "0.6575021", "0.65694153", "0.653866", "0.6458037", "0.6440974", "0.6427518", "0.6427518", "0.6427518", "0.6427518", "0.6427518", "0.6427518", "0.6427518", "0.6427518", "0.6427518", "0.6427518", "0.6427518", "0.6427518", "0.6427518", "0.6427518", "0.6427518", "0.6427518", "...
0.0
-1
Remove event listeners used to update the popper position
function removeEventListeners(reference, state) { // Remove resize event listener on window window.removeEventListener('resize', state.updateBound); // Remove scroll event listener on scroll parents state.scrollParents.forEach(function (target) { target.removeEventListener('scroll', state.updateBound); }); // Reset state state.updateBound = null; state.scrollParents = []; state.scrollElement = null; state.eventsEnabled = false; return state; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "_removeEvents () {\n this.container.classList.remove(\"tooltiped\");\n\n this.container.removeEventListener(\"mouseenter\", this._mouseOver);\n this.container.removeEventListener(\"mousemove\", this._mouseMove);\n this.container.removeEventListener(\"mouseleave\", this._mouseOut);\n ...
[ "0.6902162", "0.6785765", "0.6785765", "0.6785765", "0.6770545", "0.6743059", "0.6592434", "0.6507296", "0.6457278", "0.6452451", "0.6450113", "0.64127916", "0.63347775", "0.629248", "0.62742007", "0.62729037", "0.6259061", "0.62421805", "0.6237802", "0.62315637", "0.62195307...
0.0
-1
It will remove resize/scroll events and won't recalculate popper position when they are triggered. It also won't trigger onUpdate callback anymore, unless you call `update` method manually.
function disableEventListeners() { if (this.state.eventsEnabled) { window.cancelAnimationFrame(this.scheduleUpdate); this.state = removeEventListeners(this.reference, this.state); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function update(){ // if popper is destroyed, don't perform any further update\nif(this.state.isDestroyed){return;}var data={instance:this,styles:{},arrowStyles:{},attributes:{},flipped:false,offsets:{}}; // compute reference element offsets\ndata.offsets.reference = getReferenceOffsets(this.state,this.popper,this...
[ "0.7482764", "0.7286201", "0.7253429", "0.7253429", "0.7253429", "0.7253429", "0.7253429", "0.7253429", "0.7253429", "0.7253429", "0.7253429", "0.7253429", "0.7253429", "0.7253429", "0.7253429", "0.7253429", "0.7253429", "0.7253429", "0.7253429", "0.7253429", "0.7253429", "...
0.0
-1
TOOLTIP PLUGIN DEFINITION =========================
function Plugin(option) { return this.each(function () { var $this = $(this) var data = $this.data('bs.tooltip') var options = typeof option == 'object' && option if (!data && /destroy|hide/.test(option)) return if (!data) $this.data('bs.tooltip', (data = new Tooltip(this, options))) if (typeof option == 'string') data[option]() }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "_addTooltips() {\n $(this.el.querySelectorAll('[title]')).tooltip({\n delay: { show: 500, hide: 0 }\n });\n }", "function initInstanceInfoTooltip() {\n jQuery('#instance-tooltip').tooltip();\n}", "get tooltip() {}", "function tooltips() {\r\n\t$('.tooltip-link')...
[ "0.7193489", "0.7177543", "0.71230096", "0.7107687", "0.7008811", "0.69535863", "0.6937391", "0.6877154", "0.685422", "0.68206614", "0.6799643", "0.6799365", "0.6754513", "0.6752117", "0.6705143", "0.6687539", "0.6659539", "0.66462636", "0.6641098", "0.66409045", "0.66404915"...
0.0
-1
POPOVER PLUGIN DEFINITION =========================
function Plugin(option) { return this.each(function () { var $this = $(this) var data = $this.data('bs.popover') var options = typeof option == 'object' && option if (!data && /destroy|hide/.test(option)) return if (!data) $this.data('bs.popover', (data = new Popover(this, options))) if (typeof option == 'string') data[option]() }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function PopoverConfig() { }", "function Plugin(option){return this.each(function(){var $this=$(this);var data=$this.data('bs.popover');var options=(typeof option==='undefined'?'undefined':_typeof(option))=='object'&&option;if(!data&&/destroy|hide/.test(option))return;if(!data)$this.data('bs.popover',data=new Po...
[ "0.65172714", "0.6155215", "0.614206", "0.60616994", "0.6005223", "0.59905416", "0.59692305", "0.58698756", "0.58214915", "0.58214915", "0.5795073", "0.5791303", "0.5788668", "0.57536405", "0.5745262", "0.572578", "0.5721664", "0.57004213", "0.5683987", "0.5673775", "0.564506...
0.0
-1
Start of use strict
function menuzordActive () { if ($("#menuzord").length) { $("#menuzord").menuzord({ indicatorFirstLevel: '<i class="fa fa-angle-down"></i>' }); }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function strictly() {\n 'use strict';\n\n}", "function strictMode() {\n 'use strict';\n\n //..\n //..\n }", "function forUseStrict() {\n \"use strict\";\n // start coding from here\n console.log(\"hello world\");\n}", "function foo() {\n \"use strict\";\n}", "function __strict(x) {return x}"...
[ "0.7287052", "0.71162987", "0.6859894", "0.6771674", "0.67700136", "0.67700136", "0.66755503", "0.6630454", "0.65875006", "0.6533388", "0.6468096", "0.6466857", "0.64557034", "0.64051884", "0.64051884", "0.63961536", "0.6391159", "0.63859975", "0.63765", "0.63653886", "0.6354...
0.0
-1
Demo Scripts for Bootstrap Carousel and Animate.css article on SitePoint by Maria Antonietta Perna Function to animate slider captions
function doAnimations(elems) { //Cache the animationend event in a variable var animEndEv = 'webkitAnimationEnd animationend'; elems.each(function() { var $this = $(this), $animationType = $this.data('animation'); $this.addClass($animationType).one(animEndEv, function() { $this.removeClass($animationType); }); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function mhome_slider() {\n //Function to animate slider captions \n function doAnimations(elems) {\n //Cache the animationend event in a variable\n var animEndEv = 'webkitAnimationEnd animationend';\n elems.each(function() {\n var $this = $(this),\n ...
[ "0.7483857", "0.6853174", "0.6811745", "0.6604594", "0.66032684", "0.6597424", "0.6597424", "0.659365", "0.65914416", "0.6587788", "0.6587006", "0.64317006", "0.64129376", "0.64031065", "0.6194856", "0.6177388", "0.61410666", "0.6130886", "0.6097333", "0.60883355", "0.6085014...
0.0
-1
Fetch Figma exported pngs.
function run() { return new Promise((resolve, reject) => { if (map.length == 0) { reject() } for (let i = 0; i < map.length; i++) { promises.push(() => { console.log('Fetching pngs into', `${map[i].destination_path}/png`, 'dir.') return fetchPngs(map[i]) }) } runSync(promises).then(() => {}) resolve() }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "static formImages() {\n let mainfsDirCount = PP64.fs.mainfs.getDirectoryCount();\n for (let d = 0; d < mainfsDirCount; d++) {\n let dirFileCount = PP64.fs.mainfs.getFileCount(d);\n for (let f = 0; f < dirFileCount; f++) {\n let fileBuffer = PP64.fs.mainfs.get(d, f);\n if (!PP64.utils....
[ "0.66665214", "0.6033683", "0.6020922", "0.6012707", "0.60096014", "0.60054624", "0.5959849", "0.5909616", "0.5904622", "0.58940345", "0.58809626", "0.58610386", "0.5841207", "0.58067113", "0.5760935", "0.5748609", "0.57395506", "0.5739411", "0.57222533", "0.5695491", "0.5687...
0.0
-1
getComputedStyle is preferred here because it preserves subpixel values, while jQuery's .width() rounds to an integer.
function setWidth() { var width; var style = window.getComputedStyle ? window.getComputedStyle(ta, null) : null; if (style) { width = parseFloat(style.width); if (style.boxSizing === 'border-box' || style.webkitBoxSizing === 'border-box' || style.mozBoxSizing === 'border-box') { $.each(['paddingLeft', 'paddingRight', 'borderLeftWidth', 'borderRightWidth'], function(i,val){ width -= parseFloat(style[val]); }); } } else { width = $ta.width(); } mirror.style.width = Math.max(width,0) + 'px'; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function _getComputedStyle(el, style) {\n var computedStyle;\n if (typeof el.currentStyle != 'undefined') {\n computedStyle = el.currentStyle;\n } else {\n // In case of Firefox throwing\n // \"Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsI...
[ "0.64492387", "0.64413935", "0.64183706", "0.6353362", "0.6353362", "0.62457746", "0.62238926", "0.62238926", "0.62238926", "0.61197215", "0.6103333", "0.6066923", "0.6066923", "0.6066923", "0.6066923", "0.60458344", "0.60310006", "0.60276747", "0.60276747", "0.60276747", "0....
0.0
-1
Using mainly bare JS in this function because it is going to fire very often while typing, and needs to very efficient.
function adjust() { var height, originalHeight; if (mirrored !== ta) { initMirror(); } else { setWidth(); } if (!ta.value && options.placeholder) { // If the textarea is empty, copy the placeholder text into // the mirror control and use that for sizing so that we // don't end up with placeholder getting trimmed. mirror.value = ($ta.attr("placeholder") || ''); } else { mirror.value = ta.value; } mirror.value += options.append || ''; mirror.style.overflowY = ta.style.overflowY; originalHeight = parseFloat(ta.style.height) || 0; // Setting scrollTop to zero is needed in IE8 and lower for the next step to be accurately applied mirror.scrollTop = 0; mirror.scrollTop = 9e4; // Using scrollTop rather than scrollHeight because scrollHeight is non-standard and includes padding. height = mirror.scrollTop; if (maxHeight && height > maxHeight) { ta.style.overflowY = 'scroll'; height = maxHeight; } else { ta.style.overflowY = 'hidden'; if (height < minHeight) { height = minHeight; } } height += boxOffset; if (Math.abs(originalHeight - height) > 1/100) { ta.style.height = height + 'px'; // Trigger a repaint for IE8 for when ta is nested 2 or more levels inside an inline-block mirror.className = mirror.className; if (callback) { options.callback.call(ta,ta); } $ta.trigger('autosize.resized'); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function autoType(elementClass, typingSpeed){\n var thhis = $(elementClass);\n thhis.css({\n \"position\": \"relative\",\n \"display\": \"inline-block\"\n });\n thhis.prepend('<div class=\"cursor\" style=\"right: initial; left:0;\"></div>');\n thhis = thhis.find(\".text-js\");\n var text = thhis.text()...
[ "0.63782066", "0.6187655", "0.61184615", "0.61086214", "0.60925686", "0.60610926", "0.60143197", "0.59713656", "0.59592235", "0.595546", "0.5937028", "0.5860903", "0.5839465", "0.5824016", "0.580592", "0.58027625", "0.5765744", "0.5713633", "0.5699032", "0.5671903", "0.566388...
0.0
-1
This is done to register the method called with moment() without creating circular dependencies.
function setHookCallback (callback) { hookCallback = callback; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "constructor(moment) {\n this.moment = moment;\n }", "moment(date) {\n return moment(date);\n }", "viewDateMoment () {\n const m = moment(this.props.viewDate)\n return function () {\n return m.clone()\n }\n }", "function Sb(a,b){return function(c,d){var e,f;\n//invert the arguments,...
[ "0.6808374", "0.6107414", "0.59236145", "0.574654", "0.574654", "0.574654", "0.574654", "0.574654", "0.574654", "0.574654", "0.574654", "0.574654", "0.574654", "0.574654", "0.574654", "0.574654", "0.5738129", "0.5738129", "0.5738129", "0.57364327", "0.57364327", "0.57364327...
0.0
-1
compare two arrays, return the number of differences
function compareArrays(array1, array2, dontConvert) { var len = Math.min(array1.length, array2.length), lengthDiff = Math.abs(array1.length - array2.length), diffs = 0, i; for (i = 0; i < len; i++) { if ((dontConvert && array1[i] !== array2[i]) || (!dontConvert && toInt(array1[i]) !== toInt(array2[i]))) { diffs++; } } return diffs + lengthDiff; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function compareArrays(array1, array2) {\n var len = Math.min(array1.length, array2.length),\n lengthDiff = Math.abs(array1.length - array2.length),\n diffs = 0,\n i;\n for (i = 0; i < len; i++) {\n if (~~array1[i] !== ~~array2[i]) {\n diffs+...
[ "0.82791424", "0.82791424", "0.82791424", "0.82791424", "0.82791424", "0.82791424", "0.82791424", "0.82791424", "0.82791424", "0.82791424", "0.82791424", "0.79984933", "0.79866725", "0.79537725", "0.7922521", "0.77097225", "0.75572866", "0.75463253", "0.75318825", "0.7503132", ...
0.0
-1
pick the locale from the array try ['enau', 'engb'] as 'enau', 'engb', 'en', as in move through the list trying each substring from most specific to least, but move to the next array item if it's a more specific variant than the current root
function chooseLocale(names) { var i = 0, j, next, locale, split; while (i < names.length) { split = normalizeLocale(names[i]).split('-'); j = split.length; next = normalizeLocale(names[i + 1]); next = next ? next.split('-') : null; while (j > 0) { locale = loadLocale(split.slice(0, j).join('-')); if (locale) { return locale; } if (next && next.length >= j && compareArrays(split, next, true) >= j - 1) { //the next array item is better than a shallower substring of this one break; } j--; } i++; } return null; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function chooseLocale(names) {\n var i = 0, j, next, locale, split;\n \n while (i < names.length) {\n split = normalizeLocale(names[i]).split('-');\n j = split.length;\n next = normalizeLocale(names[i + 1]);\n next = next ? next.split('-') : nu...
[ "0.7080607", "0.7076074", "0.7076074", "0.7076074", "0.7076074", "0.7076074", "0.7076074", "0.7076074", "0.7076074", "0.7076074", "0.7076074", "0.7076074", "0.7076074", "0.7076074", "0.7076074", "0.7076074", "0.7076074", "0.7076074", "0.7076074", "0.7076074", "0.7076074", "...
0.0
-1
This function will load locale and then set the global locale. If no arguments are passed in, it will simply return the current global locale key.
function locale_locales__getSetGlobalLocale (key, values) { var data; if (key) { if (isUndefined(values)) { data = locale_locales__getLocale(key); } else { data = defineLocale(key, values); } if (data) { // moment.duration._locale = moment._locale = data; globalLocale = data; } } return globalLocale._abbr; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getSetGlobalLocale(key,values){var data;if(key){if(isUndefined(values)){data = getLocale(key);}else {data = defineLocale(key,values);}if(data){ // moment.duration._locale = moment._locale = data;\nglobalLocale = data;}else {if(typeof console !== 'undefined' && console.warn){ //warn user if arguments are p...
[ "0.7326281", "0.7298282", "0.72949594", "0.7249536", "0.7249536", "0.7249536", "0.7249536", "0.7249536", "0.7249536", "0.7241694", "0.7241694", "0.7230461", "0.721812", "0.72144645", "0.72104096", "0.72104096", "0.72104096", "0.72104096", "0.7206585", "0.72062016", "0.7206119...
0.0
-1
format date using native date object
function formatMoment(m, format) { if (!m.isValid()) { return m.localeData().invalidDate(); } format = expandFormat(format, m.localeData()); formatFunctions[format] = formatFunctions[format] || makeFormatFunction(format); return formatFunctions[format](m); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "formatDate(date) {\n\t\treturn date.toString()\n\t\t.replace(/(\\d{4})(\\d{2})(\\d{2})/, (string, year, month, day) => `${year}-${month}-${day}`);\n\t}", "static formatDate(date) {\n return new Date(date).toLocaleDateString();\n }", "formatTheDate(date, format) {\n const [ year, month, day ] = (date.toI...
[ "0.7533655", "0.74216735", "0.73876154", "0.7384637", "0.73507214", "0.73370844", "0.73058504", "0.73006034", "0.72939163", "0.72939163", "0.72939163", "0.72215176", "0.7214274", "0.7211496", "0.7188798", "0.7183839", "0.717959", "0.71692467", "0.7167987", "0.71589184", "0.71...
0.0
-1
date from iso format
function configFromISO(config) { var i, l, string = config._i, match = extendedIsoRegex.exec(string) || basicIsoRegex.exec(string), allowTime, dateFormat, timeFormat, tzFormat; if (match) { getParsingFlags(config).iso = true; for (i = 0, l = isoDates.length; i < l; i++) { if (isoDates[i][1].exec(match[1])) { dateFormat = isoDates[i][0]; allowTime = isoDates[i][2] !== false; break; } } if (dateFormat == null) { config._isValid = false; return; } if (match[3]) { for (i = 0, l = isoTimes.length; i < l; i++) { if (isoTimes[i][1].exec(match[3])) { // match[2] should be 'T' or space timeFormat = (match[2] || ' ') + isoTimes[i][0]; break; } } if (timeFormat == null) { config._isValid = false; return; } } if (!allowTime && timeFormat != null) { config._isValid = false; return; } if (match[4]) { if (tzRegex.exec(match[4])) { tzFormat = 'Z'; } else { config._isValid = false; return; } } config._f = dateFormat + (timeFormat || '') + (tzFormat || ''); configFromStringAndFormat(config); } else { config._isValid = false; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function isoDate(date)\n{\n\treturn date.getFullYear() + \"-\" + (date.getMonth() + 1) + \"-\" + date.getDate()\n}", "function dateFromISO8601(isostr) {\n var parts = isostr.match(/\\d+/g);\n var date = new Date(parts[0], parts[1] - 1, parts[2], parts[3], parts[4], parts[5]);\n var mm = date...
[ "0.7161587", "0.7084152", "0.69561076", "0.68181574", "0.66757625", "0.66372114", "0.6559707", "0.6525335", "0.6466161", "0.6465599", "0.644205", "0.64171946", "0.6406543", "0.6406543", "0.6406543", "0.6406543", "0.63656497", "0.63241196", "0.6322188", "0.62742394", "0.626350...
0.0
-1
date from iso format or fallback
function configFromString(config) { var matched = aspNetJsonRegex.exec(config._i); if (matched !== null) { config._d = new Date(+matched[1]); return; } configFromISO(config); if (config._isValid === false) { delete config._isValid; utils_hooks__hooks.createFromInputFallback(config); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function isoToDate(s) {\n if (s instanceof Date) { return s; }\n if (typeof s === 'string') { return new Date(s); }\n}", "function isoStringToDate(match){var date=new Date(0);var tzHour=0;var tzMin=0;// match[8] means that the string contains \"Z\" (UTC) or a timezone like \"+01:00\" or \"+0100\"\nvar dateSett...
[ "0.69151974", "0.66991687", "0.6643978", "0.65537083", "0.65537083", "0.6520427", "0.6492825", "0.64871174", "0.6448661", "0.64316744", "0.64316744", "0.64103484", "0.64103484", "0.6407205", "0.64045346", "0.64045346", "0.64045346", "0.64045346", "0.64045346", "0.64045346", "...
0.0
-1
Pick the first defined of two or three arguments.
function defaults(a, b, c) { if (a != null) { return a; } if (b != null) { return b; } return c; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function pick() {\n\tvar args = arguments,\n\t\ti,\n\t\targ,\n\t\tlength = args.length;\n\tfor (i = 0; i < length; i++) {\n\t\targ = args[i];\n\t\tif (typeof arg !== 'undefined' && arg !== null) {\n\t\t\treturn arg;\n\t\t}\n\t}\n}", "function pick() {\n\t\tvar args = arguments,\n\t\t\ti,\n\t\t\targ,\n\t\t\tlengt...
[ "0.7629042", "0.75575334", "0.74523604", "0.7447829", "0.6875494", "0.6672635", "0.6649544", "0.66400206", "0.65779024", "0.6487554", "0.64760274", "0.64054173", "0.62996894", "0.62969613", "0.62835485", "0.61632556", "0.61517835", "0.5961853", "0.59598327", "0.5933788", "0.5...
0.0
-1
convert an array to a date. the array should mirror the parameters below note: all values past the year are optional and will default to the lowest possible value. [year, month, day , hour, minute, second, millisecond]
function configFromArray (config) { var i, date, input = [], currentDate, yearToUse; if (config._d) { return; } currentDate = currentDateArray(config); //compute day of the year from weeks and weekdays if (config._w && config._a[DATE] == null && config._a[MONTH] == null) { dayOfYearFromWeekInfo(config); } //if the day of the year is set, figure out what it is if (config._dayOfYear) { yearToUse = defaults(config._a[YEAR], currentDate[YEAR]); if (config._dayOfYear > daysInYear(yearToUse)) { getParsingFlags(config)._overflowDayOfYear = true; } date = createUTCDate(yearToUse, 0, config._dayOfYear); config._a[MONTH] = date.getUTCMonth(); config._a[DATE] = date.getUTCDate(); } // Default to current date. // * if no year, month, day of month are given, default to today // * if day of month is given, default month and year // * if month is given, default only year // * if year is given, don't default anything for (i = 0; i < 3 && config._a[i] == null; ++i) { config._a[i] = input[i] = currentDate[i]; } // Zero out whatever was not defaulted, including time for (; i < 7; i++) { config._a[i] = input[i] = (config._a[i] == null) ? (i === 2 ? 1 : 0) : config._a[i]; } // Check for 24:00:00.000 if (config._a[HOUR] === 24 && config._a[MINUTE] === 0 && config._a[SECOND] === 0 && config._a[MILLISECOND] === 0) { config._nextDay = true; config._a[HOUR] = 0; } config._d = (config._useUTC ? createUTCDate : createDate).apply(null, input); // Apply timezone offset from input. The actual utcOffset can be changed // with parseZone. if (config._tzm != null) { config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm); } if (config._nextDay) { config._a[HOUR] = 24; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function dateFromArray(input) {\n return new Date(input[0], input[1] || 0, input[2] || 1, input[3] || 0, input[4] || 0, input[5] || 0, input[6] || 0);\n }", "function dateFromArray(input) {\n return new Date(input[0], input[1] || 0, input[2] || 1, input[3] || 0, input[4] || 0, input[5] || 0, inp...
[ "0.7056393", "0.7056393", "0.69695306", "0.68494344", "0.6635454", "0.64599293", "0.6130074", "0.61271924", "0.6068227", "0.6014711", "0.6014711", "0.6014711", "0.6014711", "0.6014711", "0.5961244", "0.5961244", "0.5961244", "0.59004784", "0.5884784", "0.58764523", "0.5868481...
0.0
-1
date from string and format string
function configFromStringAndFormat(config) { // TODO: Move this to another part of the creation flow to prevent circular deps if (config._f === utils_hooks__hooks.ISO_8601) { configFromISO(config); return; } config._a = []; getParsingFlags(config).empty = true; // This array is used to make a Date, either with `new Date` or `Date.UTC` var string = '' + config._i, i, parsedInput, tokens, token, skipped, stringLength = string.length, totalParsedInputLength = 0; tokens = expandFormat(config._f, config._locale).match(formattingTokens) || []; for (i = 0; i < tokens.length; i++) { token = tokens[i]; parsedInput = (string.match(getParseRegexForToken(token, config)) || [])[0]; // console.log('token', token, 'parsedInput', parsedInput, // 'regex', getParseRegexForToken(token, config)); if (parsedInput) { skipped = string.substr(0, string.indexOf(parsedInput)); if (skipped.length > 0) { getParsingFlags(config).unusedInput.push(skipped); } string = string.slice(string.indexOf(parsedInput) + parsedInput.length); totalParsedInputLength += parsedInput.length; } // don't parse if it's not a known token if (formatTokenFunctions[token]) { if (parsedInput) { getParsingFlags(config).empty = false; } else { getParsingFlags(config).unusedTokens.push(token); } addTimeToArrayFromToken(token, parsedInput, config); } else if (config._strict && !parsedInput) { getParsingFlags(config).unusedTokens.push(token); } } // add remaining unparsed input length to the string getParsingFlags(config).charsLeftOver = stringLength - totalParsedInputLength; if (string.length > 0) { getParsingFlags(config).unusedInput.push(string); } // clear _12h flag if hour is <= 12 if (getParsingFlags(config).bigHour === true && config._a[HOUR] <= 12 && config._a[HOUR] > 0) { getParsingFlags(config).bigHour = undefined; } // handle meridiem config._a[HOUR] = meridiemFixWrap(config._locale, config._a[HOUR], config._meridiem); configFromArray(config); checkOverflow(config); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function makeDateFromStringAndFormat(string, format) {\n var datePartArray = [0, 0, 1, 0, 0, 0, 0],\n config = {\n tzh : 0, // timezone hour offset\n tzm : 0 // timezone minute offset\n },\n tokens = format.match(formattingTokens),\n ...
[ "0.7544057", "0.7378126", "0.71777546", "0.71777546", "0.71777546", "0.71777546", "0.71671367", "0.7163808", "0.7163808", "0.7163808", "0.7163808", "0.7163808", "0.71498096", "0.71486294", "0.71486294", "0.71486294", "0.70893186", "0.7086403", "0.70293576", "0.70293576", "0.7...
0.0
-1
date from string and array of format strings
function configFromStringAndArray(config) { var tempConfig, bestMoment, scoreToBeat, i, currentScore; if (config._f.length === 0) { getParsingFlags(config).invalidFormat = true; config._d = new Date(NaN); return; } for (i = 0; i < config._f.length; i++) { currentScore = 0; tempConfig = copyConfig({}, config); if (config._useUTC != null) { tempConfig._useUTC = config._useUTC; } tempConfig._f = config._f[i]; configFromStringAndFormat(tempConfig); if (!valid__isValid(tempConfig)) { continue; } // if there is any input that was not parsed add a penalty for that format currentScore += getParsingFlags(tempConfig).charsLeftOver; //or tokens currentScore += getParsingFlags(tempConfig).unusedTokens.length * 10; getParsingFlags(tempConfig).score = currentScore; if (scoreToBeat == null || currentScore < scoreToBeat) { scoreToBeat = currentScore; bestMoment = tempConfig; } } extend(config, bestMoment || tempConfig); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function makeDateFromStringAndArray(string, formats) {\n var output,\n inputParts = string.match(parseMultipleFormatChunker) || [],\n formattedInputParts,\n scoreToBeat = 99,\n i,\n currentDate,\n currentScore;\n for (i = 0; i < format...
[ "0.6992324", "0.6912437", "0.6811143", "0.67375225", "0.67375225", "0.67375225", "0.67375225", "0.67375225", "0.67109895", "0.67109895", "0.67109895", "0.66975677", "0.65970886", "0.65863997", "0.65863997", "0.65736145", "0.65736145", "0.65736145", "0.65736145", "0.65736145", ...
0.0
-1
Pick a moment m from moments so that m[fn](other) is true for all other. This relies on the function fn to be transitive. moments should either be an array of moment objects or an array, whose first element is an array of moment objects.
function pickBy(fn, moments) { var res, i; if (moments.length === 1 && isArray(moments[0])) { moments = moments[0]; } if (!moments.length) { return local__createLocal(); } res = moments[0]; for (i = 1; i < moments.length; ++i) { if (!moments[i].isValid() || moments[i][fn](res)) { res = moments[i]; } } return res; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function pickBy(fn, moments) {\n var res, i;\n if (moments.length === 1 && isArray(moments[0])) {\n moments = moments[0];\n }\n if (!moments.length) {\n return moment();\n }\n res = moments[0];\n for (i = 1; i < moments.length; ++i) {\n ...
[ "0.76112604", "0.76112604", "0.76112604", "0.76112604", "0.76112604", "0.76112604", "0.76112604", "0.76112604", "0.76112604", "0.76112604", "0.76112604", "0.76112604", "0.76112604", "0.76112604", "0.76112604", "0.76112604", "0.76112604", "0.76112604", "0.76112604", "0.76112604"...
0.0
-1
TODO: Use [].sort instead?
function min () { var args = [].slice.call(arguments, 0); return pickBy('isBefore', args); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "sort() {\n\t}", "sort() {\n\t}", "function Sort() {}", "sort(){\n\n }", "function sortItems(arr) {\r\n return arr.sort();\r\n}", "function sort(theArray){\n\n}", "function arrangeElements( array ) {\r\n\tarray = array.sort();\r\n\treturn array;\r\n}", "function alfa (arr){\n\tfor (var i = 0; i<...
[ "0.76896363", "0.76896363", "0.7431174", "0.7381352", "0.7223031", "0.7044736", "0.7002338", "0.697896", "0.69405884", "0.68795085", "0.6870758", "0.6870758", "0.68334246", "0.68275315", "0.6821634", "0.67999935", "0.6789589", "0.67690444", "0.6720508", "0.67083323", "0.67058...
0.0
-1
Return a moment from input, that is local/utc/zone equivalent to model.
function cloneWithOffset(input, model) { var res, diff; if (model._isUTC) { res = model.clone(); diff = (isMoment(input) || isDate(input) ? +input : +local__createLocal(input)) - (+res); // Use low-level api, because this fn is low-level api. res._d.setTime(+res._d + diff); utils_hooks__hooks.updateOffset(res, false); return res; } else { return local__createLocal(input).local(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function makeAs(input, model) {\n\t return model._isUTC ? moment(input).zone(model._offset || 0) :\n\t moment(input).local();\n\t }", "function makeAs(input, model) {\n return model._isUTC ? moment(input).zone(model._offset || 0) :\n moment(input).local();\n }", "funct...
[ "0.8499712", "0.84169763", "0.84169763", "0.84169763", "0.84169763", "0.84169763", "0.84169763", "0.84169763", "0.84169763", "0.84169763", "0.84169763", "0.84169763", "0.84169763", "0.84169763", "0.84169763", "0.84169763", "0.84169763", "0.84169763", "0.79524314", "0.79352164",...
0.0
-1
MOMENTS keepLocalTime = true means only change the timezone, without affecting the local hour. So 5:31:26 +0300 [utcOffset(2, true)]> 5:31:26 +0200 It is possible that 5:31:26 doesn't exist with offset +0200, so we adjust the time as needed, to be valid. Keeping the time actually adds/subtracts (one hour) from the actual represented time. That is why we call updateOffset a second time. In case it wants us to change the offset again _changeInProgress == true case, then we have to adjust, because there is no such time in the given timezone.
function getSetOffset (input, keepLocalTime) { var offset = this._offset || 0, localAdjust; if (!this.isValid()) { return input != null ? this : NaN; } if (input != null) { if (typeof input === 'string') { input = offsetFromString(matchShortOffset, input); } else if (Math.abs(input) < 16) { input = input * 60; } if (!this._isUTC && keepLocalTime) { localAdjust = getDateOffset(this); } this._offset = input; this._isUTC = true; if (localAdjust != null) { this.add(localAdjust, 'm'); } if (offset !== input) { if (!keepLocalTime || this._changeInProgress) { add_subtract__addSubtract(this, create__createDuration(input - offset, 'm'), 1, false); } else if (!this._changeInProgress) { this._changeInProgress = true; utils_hooks__hooks.updateOffset(this, true); this._changeInProgress = null; } } return this; } else { return this._isUTC ? offset : getDateOffset(this); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getSetOffset(input,keepLocalTime){var offset=this._offset||0,localAdjust;if(!this.isValid()){return input!=null?this:NaN;}if(input!=null){if(typeof input==='string'){input=offsetFromString(matchShortOffset,input);}else if(Math.abs(input)<16){input=input*60;}if(!this._isUTC&&keepLocalTime){localAdjust=getD...
[ "0.6657913", "0.6657913", "0.66179025", "0.66179025", "0.66179025", "0.66179025", "0.66179025", "0.66179025", "0.66179025", "0.66179025", "0.66179025", "0.66179025", "0.66179025", "0.66179025", "0.66179025", "0.66179025", "0.66179025", "0.66179025", "0.66179025", "0.66179025", ...
0.64416885
66
TODO: remove 'name' arg after deprecation is removed
function createAdder(direction, name) { return function (val, period) { var dur, tmp; //invert the arguments, but complain about it if (period !== null && !isNaN(+period)) { deprecateSimple(name, 'moment().' + name + '(period, number) is deprecated. Please use moment().' + name + '(number, period).'); tmp = val; val = period; period = tmp; } val = typeof val === 'string' ? +val : val; dur = create__createDuration(val, period); add_subtract__addSubtract(this, dur, direction); return this; }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "setName(name) { }", "constructor(name) {\n super(name);\n this.name = name;\n }", "constructor(name) {\n this.name = name;\n }", "constructor(name) {\n this.name = name;\n }", "constructor(name) {\n this.name = name;\n }", "constructor(name) {\n this.name = name;\n }", "construct...
[ "0.67782986", "0.6759405", "0.67381084", "0.67381084", "0.67381084", "0.67381084", "0.6733258", "0.6733258", "0.67120683", "0.66484624", "0.6612438", "0.6540716", "0.65202653", "0.65195", "0.6489472", "0.6465985", "0.6462259", "0.6415414", "0.6381141", "0.6297654", "0.6276111...
0.0
-1
If passed a locale key, it will set the locale for this instance. Otherwise, it will return the locale configuration variables for this instance.
function locale (key) { var newLocaleData; if (key === undefined) { return this._locale._abbr; } else { newLocaleData = locale_locales__getLocale(key); if (newLocaleData != null) { this._locale = newLocaleData; } return this; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function locale(key){var newLocaleData;if(key===undefined){return this._locale._abbr;}else{newLocaleData=getLocale(key);if(newLocaleData!=null){this._locale=newLocaleData;}return this;}}", "function locale(key){var newLocaleData;if(key===undefined){return this._locale._abbr;}else{newLocaleData=getLocale(key);if(...
[ "0.7284988", "0.7284988", "0.723156", "0.7204643", "0.7204643", "0.70898104", "0.70898104", "0.70898104", "0.70898104", "0.70898104", "0.70898104", "0.70898104", "0.70898104", "0.70898104", "0.70898104", "0.70898104", "0.70898104", "0.70898104", "0.70898104", "0.70898104", "0...
0.0
-1
supports only 2.0style add(1, 's') or add(duration)
function duration_add_subtract__add (input, value) { return duration_add_subtract__addSubtract(this, input, value, 1); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Duration(time) {\n var d = document.createElement('span');\n d.classList.add('duration');\n d.innerText = time;\n return d;\n}", "function duration_add_subtract__add (input, value) {\n\t return duration_add_subtract__addSubtract(this, input, value, 1);\n\t }", "function duration_add_subt...
[ "0.6431088", "0.6105697", "0.6105697", "0.6105697", "0.6105697", "0.6105697", "0.6105697", "0.6105697", "0.6105697", "0.6105697", "0.6105697", "0.6105697", "0.6105697", "0.60822755", "0.60589874", "0.6012247", "0.6012247", "0.6010167", "0.5885506", "0.5885506", "0.5885185", ...
0.58918107
77
supports only 2.0style subtract(1, 's') or subtract(duration)
function duration_add_subtract__subtract (input, value) { return duration_add_subtract__addSubtract(this, input, value, -1); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function duration_add_subtract__subtract (input, value) {\n\t return duration_add_subtract__addSubtract(this, input, value, -1);\n\t }", "function duration_add_subtract__subtract (input, value) {\n\t return duration_add_subtract__addSubtract(this, input, value, -1);\n\t }", "function durati...
[ "0.7399791", "0.7399791", "0.7399791", "0.7399791", "0.7399791", "0.7399791", "0.7399791", "0.7399791", "0.7399791", "0.7399791", "0.7399791", "0.7399791", "0.7379759", "0.7362836", "0.7362836", "0.7267587", "0.7267587", "0.7232643", "0.7232643", "0.7232643", "0.66817045", ...
0.72733253
67
helper function for moment.fn.from, moment.fn.fromNow, and moment.duration.fn.humanize
function substituteTimeAgo(string, number, withoutSuffix, isFuture, locale) { return locale.relativeTime(number || 1, !!withoutSuffix, string, isFuture); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function $a(a,b){var c;\n// moment.duration._locale = moment._locale = data;\nreturn a&&(c=p(b)?bb(a):_a(a,b),c&&(vf=c)),vf._abbr}", "function $a(a,b){var c;\n// moment.duration._locale = moment._locale = data;\nreturn a&&(c=p(b)?bb(a):_a(a,b),c&&(vf=c)),vf._abbr}", "function $a(a,b){var c;\n// moment.duration...
[ "0.6559213", "0.6559213", "0.6559213", "0.6559213", "0.64766085", "0.6381961", "0.6326815", "0.6326815", "0.6326815", "0.6326815", "0.6326815", "0.6326815", "0.6326815", "0.6326815", "0.6326815", "0.6215613", "0.6122844", "0.6122844", "0.6097173", "0.6097173", "0.6097173", ...
0.0
-1
This function allows you to set a threshold for relative time strings
function duration_humanize__getSetRelativeTimeThreshold (threshold, limit) { if (thresholds[threshold] === undefined) { return false; } if (limit === undefined) { return thresholds[threshold]; } thresholds[threshold] = limit; return true; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getSetRelativeTimeThreshold (threshold, limit) {\n if (thresholds[threshold] === undefined) {\n return false;\n }\n if (limit === undefined) {\n return thresholds[threshold];\n }\n thresholds[threshold] = limit;\n if (threshol...
[ "0.69783336", "0.69343334", "0.69072294", "0.69072294", "0.69072294", "0.69072294", "0.69072294", "0.69072294", "0.6901369", "0.6901369", "0.6901369", "0.6901369", "0.6901369", "0.6901369", "0.6895151", "0.68865347", "0.6871718", "0.6841288", "0.6824244", "0.6824244", "0.6824...
0.0
-1
arrayToList version 1 progressive verison Array elements are added to the list in the order that they appear in the array, from the 0th element to the .length 1th element.
function arrayToList_v1(array) { if (array.length == 0) return null; let list = {value: array[0], rest: null}; let node = list; for (let i = 1; i < array.length; i++) { node.rest = {value: array[i], rest: null}; node = node.rest; } return list; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function arrayToList(array) {\n var result = null;\n \n for (var i = array.length - 1; i >= 0; i--) {\n result = prepend(array[i], result);\n }\n \n return result;\n}", "function arrayToList(array = []) {\n let list = null;\n let i = array.length;\n while (i > 0) list = prepend(array[--...
[ "0.78120786", "0.77586645", "0.7687061", "0.76714367", "0.75177866", "0.7390571", "0.7143325", "0.7072136", "0.70287097", "0.7025907", "0.69670063", "0.6927238", "0.6916796", "0.68336266", "0.6806871", "0.6758736", "0.67371994", "0.6722723", "0.67137796", "0.6666359", "0.6666...
0.6918549
12
arrayToList version 2 regressive version Array elements are added to the list in reversed order, that is from the .length 1th element of the array to the 0th one. However, this does not change the order of list nodes, as the references to the rest node were set to the previously created node, instead of the newly created one.
function arrayToList_v2(array) { let list = null; for (let i = array.length - 1; i >=0 ; i--) { list = {value: array[i], rest: list}; } return list; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "arrayToList(arr, list=null) {\n if(arr.length > 0) {\n const node = { \n value: arr[arr.length-1],\n rest: list\n }\n\n // Instead of a for loop going backwards we can just keep slicing off the arr from 2nd to last element to first\n return this.arrayToList(arr.slice(0, arr.len...
[ "0.7525814", "0.74638516", "0.7239143", "0.7234324", "0.7216905", "0.7145329", "0.7142038", "0.7064695", "0.70497984", "0.70473033", "0.70433974", "0.7032031", "0.69376284", "0.6856255", "0.68446505", "0.6816118", "0.6728805", "0.6721094", "0.6690347", "0.6653071", "0.6594150...
0.74151886
2
function that checks if clicked on the boardmaker
function checkIn(i,j){ g_checker = true; var index = document.getElementsByClassName('row-'+i)[0].children[j]; g_newBoard[i][j] += 1; if(g_newBoard[i][j] > 3){ index.setAttribute("style", "background-color:white;"); g_newBoard[i][j] = 0; } if(g_newBoard[i][j] === 3){ index.setAttribute("style", "background-color:#D79922;"); } if(g_newBoard[i][j] === 1){ index.setAttribute("style", "background-color:#4056A1;"); } if(g_newBoard[i][j] === 2){ index.setAttribute("style", "background-color:#F13C20;"); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function checkVictoryClick() {\n\t// Dazu muss die gesamte Matrix durchlaufen werden\n\tfor(var i = 0; i < arrayDimensionLine; i++) {\n\t\tfor(var j = 0; j < arrayDimensionColumn; j++) {\n\t\t\t// Und fuer jede Zelle muss geprueft werden, ob sie auf der Map ist\n\t\t\tif(hexatileOnMap(i,j))\n\t\t\t\t// Dann wird g...
[ "0.7146314", "0.70943004", "0.7029384", "0.6993009", "0.6847714", "0.6830517", "0.68197036", "0.66940683", "0.669376", "0.6692744", "0.6690104", "0.66809297", "0.6678638", "0.6634238", "0.663058", "0.662401", "0.65964884", "0.6536326", "0.6522827", "0.6517985", "0.6512543", ...
0.0
-1
change the board according to the selection
function change(i,j){ if(g_checker){ var index = document.getElementsByClassName('row-'+i)[0].children[j]; g_newBoard[i][j] += 1; if(g_newBoard[i][j] > 3){ index.setAttribute("style", "background-color:white;"); g_newBoard[i][j] = 0; } if(g_newBoard[i][j] === 3){ index.setAttribute("style", "background-color:#D79922;"); } if(g_newBoard[i][j] === 1){ index.setAttribute("style", "background-color:#4056A1;"); } if(g_newBoard[i][j] === 2){ index.setAttribute("style", "background-color:#F13C20;"); } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "selectCell() {\n if(this.check_Reset())\n return;\n if (this.view.getCurrentSelectedPiece() != this.selectedPiece) {\n this.state = 'PROCESS_PIECE';\n }\n else {\n if (this.view.board.selectedCell != null) {\n this.state = 'REQUEST_PLAY_P'...
[ "0.6392018", "0.6380117", "0.6371731", "0.6338184", "0.62731093", "0.6271433", "0.6251563", "0.62507546", "0.61907345", "0.61677444", "0.61514395", "0.6148816", "0.61216956", "0.6117032", "0.6114959", "0.61141115", "0.61108667", "0.6079392", "0.60660064", "0.6064135", "0.6049...
0.59229475
50
apply the new board
function applyBoard(){ g_wall = new Wall(g_newBoard,0,0); reset(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function updateBoard(board) {\n\tvar newBoard = copyArray(board);\n\tfor (var i = 0; i < getHeight(board); i++) {\n\t\tfor (var j = 0; j < getWidth(board); j++) {\n\t\t\tvar neighborCount = countNeighbors(board, j, i);\n\t\t\tif (neighborCount === 3) {\n\t\t\t\tnewBoard[j][i] = 1;\n\t\t\t}\n\t\t\telse if (neighbor...
[ "0.66442454", "0.6634518", "0.64425874", "0.6410926", "0.6409043", "0.6390954", "0.63543725", "0.6344303", "0.6341869", "0.63381916", "0.6297657", "0.6277048", "0.62498033", "0.62179506", "0.62153035", "0.6211329", "0.6207918", "0.6198665", "0.6193621", "0.61816263", "0.61791...
0.7477831
0
'auth' is from 'combineReducers' from 'reducers/index.js'
function mapStateToProps({ auth }) { return { token: auth.token } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function combineReducers ($ngReduxProvider,\n productReducer,\n userReducer,\n middlewares) {\n\n console.log(productReducer);\n console.log(userReducer);\n\n var reducers = {\n product: productReducer,\n user: userReducer\n };\n\n var r...
[ "0.70234966", "0.6873373", "0.6849703", "0.6824132", "0.67862964", "0.67722094", "0.674233", "0.6687406", "0.6621628", "0.6621628", "0.6621628", "0.66134816", "0.66134816", "0.6605632", "0.6585326", "0.6585326", "0.6585326", "0.6554817", "0.6460225", "0.64466524", "0.639111",...
0.6761776
6
Accesses the appropriate property or calls its getter, depending on language
function callGetter(obj, propertyName) { if(language == 'objc') { return obj[propertyName]; } else if(language == 'cs') { propertyName = propertyName.charAt(0).toUpperCase() + propertyName.slice(1); return obj[propertyName]; } // Else, call a getter function var args = Array.prototype.slice.call(arguments, 2), methodName = propertyName.charAt(0).toUpperCase() + propertyName.slice(1); if('get'+methodName in obj) { methodName = 'get'+methodName; } else { methodName = 'is'+methodName; } return obj[methodName].apply(obj, args); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "get property(){}", "static get property(){}", "get language() { \n\t\treturn this.#currentLanguage;\n\t}", "get(property) {\n return this[property];\n }", "get lang() {\n return this.getAttribute('lang');\n }", "get lang () { return this._.recog.lang }", "getProperty(name) {\n return this._p...
[ "0.70705736", "0.65450746", "0.6493775", "0.6403127", "0.6349279", "0.6328018", "0.6156472", "0.6054255", "0.60532093", "0.60490006", "0.5967677", "0.5953486", "0.5895462", "0.586992", "0.586992", "0.586531", "0.584619", "0.58447534", "0.5811859", "0.5811497", "0.5791696", ...
0.61921066
6
Assert that a certain series of operations come out of the queue
function expect(q) { for(var i = 1; i < arguments.length; i++) { callMethod(q, 'expect', arguments[i]); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "checkQueue() {\n if (this._locked === false && this._stack.length > 0 && this._current < this._numberOfExecution) {\n this._locked = true;\n console.log('Received new item');\n let items = [];\n let remainSlots = this._numberOfExecution - this._current;\n ...
[ "0.6416316", "0.6344059", "0.6314339", "0.61254007", "0.6045645", "0.6015487", "0.598523", "0.57162356", "0.5704122", "0.5699484", "0.5688601", "0.5682499", "0.5682499", "0.5675537", "0.56539744", "0.56483895", "0.56458396", "0.5644898", "0.5635445", "0.56153995", "0.5607332"...
0.0
-1
set current volume level and store to
function _setVolume(v) { videoObject.volume = v; control_volume.seekSlider('seek', v); if(typeof localStorage != 'undefined') { localStorage.setItem('volume', v); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function MV_SetVolume(volume) {\n volume = Math.max(0, volume);\n volume = Math.min(volume, MV_MaxTotalVolume);\n\n MV_TotalVolume = volume;\n}", "function set_volume(){\n\t\taudio.volume = parseFloat(this.value / 100);\n\t}", "set volume(vol)\n {\n this._control.value = Math.max(0,Math.min(100,vo...
[ "0.74144095", "0.74120355", "0.73880714", "0.7236963", "0.717101", "0.7169664", "0.71038556", "0.7097744", "0.7087106", "0.70365304", "0.7019019", "0.69965756", "0.6995026", "0.69910365", "0.69901466", "0.6981654", "0.69679344", "0.6965144", "0.69648945", "0.69552225", "0.694...
0.7577558
0
Sets the size of the player
function setSize() { //console.log(width, height, height/width); /* that.css({ width : w + '%', paddingTop : height/width * w + '%', position : 'relative' }); */ /* that.css({ width : width, height : height }); div_wrapper.css({ width :width , height : height }); */ div_ratio.css({ width : '100%', paddingTop : height/width * 100 + '%' }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function changePlayerSize (size) {\n humanPlayer.size = size;\n\n $sizeBlocks.removeClass(eSize.SMALL + ' ' + eSize.MEDIUM + ' ' + eSize.LARGE).addClass(size).attr('data-size', size);\n}", "function sizePlayers() {\n outerPlayer.height(outerPlayer.width() * 9 / 16);\n innerPlayer.height(outerPlayer.heigh...
[ "0.77134883", "0.72535807", "0.7101112", "0.7090977", "0.70443684", "0.68601346", "0.6814398", "0.67500377", "0.6736123", "0.67303485", "0.67096174", "0.66109264", "0.6605752", "0.648677", "0.6486754", "0.6469332", "0.64463353", "0.63704544", "0.6363853", "0.63231784", "0.632...
0.6059051
57
converts seconds to a timestamp
function secondsToTime(s, forceHours) { if(isNaN(s)) { if(forceHours) return "00:00:00"; return "00:00"; } var _s = s; s = Math.ceil(s); var forceHours = forceHours || false; var hours = Math.floor(s / (60 * 60)); hours -= 60 * 60 * hours; var min = Math.floor(s / 60); s -= 60 * min; if(isNaN(hours)) hours = 0; if(isNaN(min)) min = 0; if(isNaN(s)) s = 0; var str = ''; if(hours > 0 || forceHours) { if(hours < 10) { hours = '0' + hours; } str += hours + ':'; } if(min < 10) { min = '0' + min; } if(s < 10) { s = '0' + s; } str += min; return str + ':' + s; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function timestamp(value) {\n var sec_num = value;\n var hours = Math.floor(sec_num / 3600);\n var minutes = Math.floor((sec_num - (hours * 3600)) / 60);\n var seconds = sec_num - (hours * 3600) - (minutes * 60);\n\n if (hours < 10) {hours = \"0\"+hours;}\n if (minut...
[ "0.715168", "0.68927556", "0.6877629", "0.67854875", "0.67162895", "0.66123414", "0.6534647", "0.6526031", "0.6502934", "0.64877874", "0.64877224", "0.64826053", "0.6470913", "0.6463964", "0.6463907", "0.64384633", "0.6431163", "0.6414423", "0.638436", "0.6361405", "0.6335689...
0.59423167
86
increases the ad pointer or sets it to null if there are no more ads
function _gotoNextAd() { nextAd++; if(nextAd >= player.clip.ads.length) { nextAd = null; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function AdsRefresh() {\n var detect_device = get_device();\n if (detect_device == 'desktop') {\n if (jQuery(\".node-type-recipe\").length > 0) {\n // Adding the adslot for desktop & mobile.\n if (jQuery('div#ad-multi_ad_leaderboard').length > 0) {\n var scrollTopPosition, bottomOfElement, ou...
[ "0.55693", "0.5512934", "0.54049003", "0.53304243", "0.5269616", "0.5240582", "0.52376586", "0.5179522", "0.5167669", "0.51491725", "0.5121991", "0.5073402", "0.5069809", "0.50062525", "0.49965", "0.4995619", "0.49791002", "0.49763164", "0.49457395", "0.49062073", "0.4900071"...
0.72789824
0
call handler for check if we have to play an ad
function _playNextAd(position) { if(nextAd != null && player.clip.ads[nextAd].position == position) { _log('_playNextAd(' + position + ')', nextAd, player.clip.ads[nextAd].position); player.ad = player.clip.ads[nextAd]; _changeSrc(player.ad.src); div_info_ad_timeleft.show(); that.addClass('is-playing-ad'); _gotoNextAd(); return true; } return false; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function LibAdInPlay()\n{\n // NOTES:\n // Preloading is not supported\n // Interstitial is supported\n // Rewarded is supported\n}", "function playAd() {\n // checks if advertisement is really paused\n if(adState == false) {\n // enable quizanswers\n signalRClient.sendMessageToAndroi...
[ "0.7274701", "0.6780306", "0.65186673", "0.6486319", "0.64084524", "0.6333651", "0.63009614", "0.62665886", "0.6166618", "0.61660665", "0.60781246", "0.6064204", "0.6017403", "0.59900767", "0.5947726", "0.59465486", "0.5868963", "0.5852208", "0.5833559", "0.5817933", "0.58061...
0.62139755
8
Follow mouse movement and draws them to canvas
function draw(ev, gl, canvas, a_Position, u_FragColor) { var x = ev.clientX; var y = ev.clientY var rect = ev.target.getBoundingClientRect(); //Remove last 2 array inputs if (g_lines.length > 2) { g_lines.splice(g_lines.length - 2, g_lines.length - 1); } // Convert to canvas coordinate x = ((x - rect.left) - canvas.width / 2) / (canvas.width / 2); y = (canvas.height / 2 - (y - rect.top)) / (canvas.height / 2); g_lines.push(x); g_lines.push(y); gl.clear(gl.COLOR_BUFFER_BIT); //Draw points on Canvas for (var i = 0; i < g_points.length; i++) { var xy = g_points[i]; var rgba = g_colors[i]; // Pass the position of a point to a_Position variable gl.vertexAttrib3f(a_Position, xy[0], xy[1], 0.0); // Pass the color of a point to u_FragColor variable gl.uniform4f(u_FragColor, rgba[0], rgba[1], rgba[2], rgba[3]); // Draw gl.drawArrays(gl.POINTS, 0, g_points.length); }; n = initVertexBuffers(ev, gl, canvas, a_Position, n); if (n < 0) { console.log('Failed to set the positions of the vertices'); return; } gl.drawArrays(gl.LINE_STRIP, 0, n); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function renderCanvas() {\n if (drawing) {\n ctx.moveTo(lastPos.x, lastPos.y);\n ctx.lineTo(mousePos.x, mousePos.y);\n ctx.stroke();\n lastPos = mousePos;\n }\n }", "function renderCanvas() {\n if (drawing) {\n ctx.moveTo(lastPos.x, lastPos.y);\n ctx.lineTo(mousePo...
[ "0.7522254", "0.75080335", "0.74913186", "0.7417376", "0.7409845", "0.7386347", "0.7386347", "0.7386347", "0.7386347", "0.7348065", "0.7115984", "0.7100368", "0.7097893", "0.7082986", "0.70583683", "0.70418555", "0.7035242", "0.69714904", "0.6946706", "0.69280875", "0.6920417...
0.0
-1
================== Initialize Buffers =======================================
function initVertexBuffers(ev, gl, canvas, a_Position, n) { n = g_lines.length / 2; //Number of (x,y) pairs if (end === true) { n = g_points.length; //(x,y) point pairs } //Create buffer object var vertexBuffer = gl.createBuffer(); if (!vertexBuffer) { console.log('Failed to create the buffer object'); return -1; } //Bind buffer to target and write data into buffer object gl.bindBuffer(gl.ARRAY_BUFFER, vertexBuffer); gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(g_lines), gl.STATIC_DRAW); //Initialize a_Position for shader var a_Position = gl.getAttribLocation(gl.program, 'a_Position'); if (a_Position < 0) { console.log('Failed to get the storage location of a_Position'); return -1; } gl.vertexAttribPointer(a_Position, 2, gl.FLOAT, false, 0, 0); gl.enableVertexAttribArray(a_Position); return n; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "createBuffers() {\n this.createBuffer('COLOR')\n this.createBuffer('POSITION')\n }", "function loadBuffers() {\n // Array-ify\n var names = [];\n var paths = [];\n for (var name in BUFFERS_TO_LOAD) {\n var path = BUFFERS_TO_LOAD[name];\n names.push(name);\n paths.push(path);\n }\n ...
[ "0.73176175", "0.71452385", "0.69972706", "0.69972706", "0.6889671", "0.68736875", "0.68256795", "0.6795424", "0.67588717", "0.672104", "0.67158973", "0.6683626", "0.6683626", "0.6568625", "0.65220445", "0.6513698", "0.6495004", "0.6490982", "0.64885545", "0.6488473", "0.6467...
0.0
-1
================= Extra Credit Functions ====================================
function pointSize(gl, a_PointSize, sizeChanger) { sizeChanger.addEventListener('click', function() { gl.vertexAttrib1f(a_PointSize, sizeChanger.value); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function chargeCreditCard() {\n\n }", "function buy20() {\n const credit = 2300;\n addCredit(credit);\n return credit;\n}", "function addCreditCard(custnumber, email, data, callback) {\n\n getBillingAndShippingAddress(custnumber, function(addresses) {\n\n if(!addresses || !addresses.billing_add...
[ "0.71417594", "0.67291623", "0.6501641", "0.6501539", "0.64749706", "0.6447205", "0.6435682", "0.64071214", "0.62398386", "0.6161521", "0.6136103", "0.61226064", "0.60704297", "0.6018662", "0.5992963", "0.5923159", "0.5889691", "0.58741164", "0.5831331", "0.582787", "0.581454...
0.0
-1
Does not work yet
function shiftLine(gl, a_Position, lineShifter) { var shiftedArray = []; gl.clear(gl.COLOR_BUFFER_BIT); lineShifter.addEventListener('click', function() { for (var i = 0; i < g_points.length; i++) { shiftedArray[i] = g_points[i][0] + .3; g_points[i][0] = shiftedArray[i]; gl.vertexAttrib3f(a_Position, g_points[i][0], g_points[i][1], 0.0); gl.drawArrays(gl.POINTS, 0, g_points.length); } gl.drawArrays(gl.LINE_STRIP, 0, n); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private internal function m248() {}", "private public function m246() {}", "protected internal function m252() {}", "transient private protected internal function m182() {}", "transient protected internal function m189() {}", "transient private internal function m185() {}", "static private internal fun...
[ "0.70720387", "0.70564437", "0.66682625", "0.63950133", "0.636974", "0.6360863", "0.63196564", "0.61084497", "0.60980797", "0.60698104", "0.58588", "0.5834202", "0.5828215", "0.579849", "0.5781462", "0.5765821", "0.574573", "0.5743822", "0.568587", "0.5642725", "0.5631619", ...
0.0
-1
Returns true if the maxValueCount value is valid.
isMaxValueCountValid() { if (this.isValueTypeSelect()) { return (this.isSingleSelect() || this.isMultipleSelect()); } return ((this.maxValueCount === null) || (this.maxValueCount === AnnotationMaxValueCount.NONE)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function maxValueCountRequired() {\n return ((vm.annotType.maxValueCount < 1) || (vm.annotType.maxValueCount > 2));\n }", "function isLessThanMaxValuePlusNonZero() {\n\t\n\tvar len = inputDigits.length;\n\n\tvar i, j;\n\n\tfor(i = 0; i < len; i++){\n\n\t\tif(inputDigits[i] > MAXVAL){\n\n\t\t\terrorMessag...
[ "0.7149446", "0.6726938", "0.66662204", "0.6664043", "0.6528222", "0.627548", "0.60015124", "0.57038605", "0.5689484", "0.5676869", "0.56721824", "0.5643552", "0.56225073", "0.56146497", "0.557657", "0.5554315", "0.5544934", "0.55034465", "0.5490678", "0.5475875", "0.5474719"...
0.8210685
0
Called when the annotation type's value type has been changed.
valueTypeChanged() { if (!this.isValueTypeSelect()) { this.maxValueCount = AnnotationMaxValueCount.NONE; } this.options = []; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function handleAnnotationTypeChange() {\n gAnnotationType = parseInt($('#annotation_type_id').val());\n globals.currentAnnotationsOfSelectedType = gCurrentAnnotations.filter(function(e) {\n return e.annotation_type.id === gAnnotationType;\n });\n setTool();\n setupCBCheckboxes();\n }", "func...
[ "0.6767074", "0.65800756", "0.62600935", "0.61884594", "0.6157069", "0.59539425", "0.5904408", "0.58459175", "0.57941115", "0.57693505", "0.57078177", "0.56280786", "0.5511516", "0.5461591", "0.544887", "0.5443955", "0.542222", "0.54216987", "0.5400331", "0.54001176", "0.5391...
0.73789895
0
Used to add an option. Should only be called when the value type is 'Select'.
addOption() { if (!this.isValueTypeSelect()) { throw new DomainError('value type is not select: ' + this.valueType); } this.options.push(''); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function optionAdd() {\n if (vm.annotType.valueType !== 'Select') {\n throw new Error('value type error: ' + vm.annotType.valueType);\n }\n\n if (!vm.annotType.options) {\n vm.annotType.options = [];\n }\n vm.annotType.options.push('');\n }", "function addOption(theSel, ...
[ "0.77989566", "0.73904634", "0.7381969", "0.7187327", "0.7187327", "0.7166405", "0.70861614", "0.7084701", "0.7045026", "0.70237374", "0.69763595", "0.69511616", "0.6941061", "0.69407755", "0.6897757", "0.68942875", "0.68754005", "0.6807149", "0.6749737", "0.6749737", "0.6734...
0.75692135
1
Used to remove an option. Should only be called when the value type is 'Select'.
removeOption(index) { if (this.options.length <= 1) { throw new DomainError('options is empty, cannot remove any more options'); } this.options.splice(index, 1); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "removeOption( e ){\n e.preventDefault();\n e.stopImmediatePropagation();\n\n let button = e.target.closest(this.params.optionsRemoverSelector);\n let select = e.target.closest(this.params.selector).querySelector('select');\n\n select.options[button.value].selected = false;\n ...
[ "0.7317568", "0.7134913", "0.70501876", "0.70277435", "0.69025457", "0.687277", "0.6827373", "0.6810946", "0.67752683", "0.67522734", "0.6732323", "0.66685575", "0.66188484", "0.6569636", "0.6549939", "0.6545505", "0.6526701", "0.65238976", "0.6502487", "0.64449394", "0.64277...
0.63611084
22
Returns true if each of the options in the options array are valid options for this annotation type. Options is an array of objects with keys: value and checked.
validOptions(options) { return options.reduce((memo, option) => memo && this.options.includes(option), true); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function isOptions(){\n for (var key in options)\n if (options.hasOwnProperty(key)) return true;\n return false;\n }", "function validateOptions(options) {\n const validateInt = (name) => {\n const val = toInt(options[name]);\n if (val === undefined) {...
[ "0.60108817", "0.56587464", "0.5567893", "0.5441195", "0.53729427", "0.53729427", "0.5292512", "0.5292512", "0.52333707", "0.5221375", "0.5221375", "0.5221056", "0.5196151", "0.5188089", "0.5187421", "0.5185178", "0.5128911", "0.5128026", "0.5093299", "0.5093299", "0.5055166"...
0.65866643
0
Gets the first (latest) token from a cookie: THIS__ONE>>NOT__THIS__ONE>>AND__NOT__THIS__ONE
function getFirstTokenFromCookie(cookie){ var result = ""; var firstSeparatorIndex = cookie.indexOf(traffic_source_COOKIE_TOKEN_SEPARATOR); result = firstSeparatorIndex !== -1 ? cookie.substring(0, firstSeparatorIndex) : cookie; //if there is a separator, provide the newest value no the cookie return result; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getToken() {\n var token = document.cookie.replace(/(?:(?:^|.*;\\s*)token\\s*\\=\\s*([^;]*).*$)|^.*$/, \"$1\");\n return token;\n}", "function getToken() {\n if (!document.cookie) {\n return null;\n }\n const cookies = document.cookie.split(';')\n .map((i...
[ "0.733249", "0.68202746", "0.681249", "0.6801257", "0.6770747", "0.6666369", "0.65973717", "0.65405947", "0.64683044", "0.6361763", "0.6337599", "0.6225791", "0.6212634", "0.6188346", "0.6156331", "0.61473703", "0.6135041", "0.6135041", "0.6132989", "0.61210614", "0.6070494",...
0.7724577
1
Set the cookie if it doesn't exist.
function setCookie(cookie, value){ var expires = new Date(); expires.setTime(expires.getTime() + 62208000000); //1000*60*60*24*30*24 (2 years) document.cookie = cookie + "=" + value + "; expires=" + expires.toGMTString() + "; domain=" + domain + "; path=/"; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function setCookie(key, value) {\n var expires = new Date();\n expires.setTime(expires.getTime() + (365 * 24 * 60 * 60 * 1000));\n document.cookie = key + '=' + value + ';expires=' + expires.toUTCString();\n // document.cookie = key + '=' + value + ';expires=0';\n // document.coo...
[ "0.6851243", "0.66550976", "0.6633512", "0.6616234", "0.6610721", "0.65851104", "0.6561471", "0.6560454", "0.65502065", "0.6545622", "0.65428525", "0.65244514", "0.6514682", "0.64981914", "0.64835", "0.6480705", "0.6472522", "0.6410211", "0.64082265", "0.6393946", "0.63927644...
0.6369702
27
Boolean, whether or not it's not NULL or Empty
function isNotNullOrEmpty(string){ return string !== null && string !== ""; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "isEmpty() {\n if (this.type === undefined) return true;\n return false;\n }", "function isEmpty() {\n return this.toString().length === 0;\n }", "isEmpty() {\n\t\treturn this._length === 0;\n\t}", "function ISNullorEmpty(obj) {\n if (typeof (obj) == 'undefined' || obj ==...
[ "0.7672194", "0.7252421", "0.71273136", "0.7116996", "0.70661485", "0.7051642", "0.7050091", "0.7041111", "0.7041111", "0.7030639", "0.7014427", "0.7003101", "0.7003101", "0.6994741", "0.69885373", "0.69715047", "0.69570434", "0.69570434", "0.6952664", "0.6924352", "0.6923536...
0.0
-1
Remove the protocol for the referral token
function removeProtocol(href) { return href.replace(/.*?:\/\//g, ""); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function urlWithoutProtocol(url) {\n return url.replace(protocolReg, '');\n }", "function removeStoredToken(){\n var url = 'https://accounts.google.com/o/oauth2/revoke?token=' + tokenStored;\n window.fetch(url);\n chrome.identity.removeCachedAuthToken({token: tokenStored}, function (){});\n}", "function...
[ "0.6180391", "0.5867053", "0.5826833", "0.55653465", "0.55465436", "0.5531629", "0.55298555", "0.5409788", "0.5377281", "0.5373203", "0.5362341", "0.5348067", "0.52953166", "0.5282851", "0.524859", "0.5232394", "0.52268034", "0.5217557", "0.5215772", "0.5181174", "0.51475173"...
0.64212996
1
Codewars > JavaScript > 8 kyu Sum without highest and lowest number Solution 1
function sumArray(array) { if(array == null || array.length <= 1) { return 0; } var lowAndHigh = Math.min(...array) + Math.max(...array); var addArray = array.reduce((acc, currentVal) => acc + currentVal); return addArray - lowAndHigh; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function kadaneAlgo(nums) {\n let currSum = nums[0], maxSum = nums[0];\n\n for (let i = 1; i < nums.length; i++) {\n if (currSum < 0) currSum = 0;\n currSum = currSum + nums[i];\n maxSum = Math.max(currSum, maxSum);\n }\n return maxSum;\n }", "funct...
[ "0.7265383", "0.7051192", "0.689755", "0.6874433", "0.6862968", "0.68546087", "0.67448235", "0.670791", "0.6659165", "0.6642324", "0.66335034", "0.6632944", "0.66263014", "0.6615637", "0.6612116", "0.6596708", "0.6587458", "0.65815467", "0.65629756", "0.6562272", "0.65521866"...
0.0
-1
Return the best size for the requested avatar size
function getBestSizeFor(size) { for (var i = 0; i < KNOWN_AVATAR_SIZES.length; i++) { var currentSize = KNOWN_AVATAR_SIZES[i]; if (size <= currentSize) return currentSize; } return null; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "getBestImageSize(sizes) {\n let bestSize = false;\n\n for (let size in sizes) {\n if (sizes[size][1] >= this.windowWidth) {\n bestSize = size;\n break;\n }\n }\n\n if (!bestSize) {\n // Get last key in sizes object\n bestSize = Object.keys(sizes)[Object.keys(sizes).len...
[ "0.64878374", "0.6473315", "0.618326", "0.60618657", "0.5899504", "0.58367985", "0.5785582", "0.5780182", "0.57740504", "0.576017", "0.5734904", "0.570705", "0.56564313", "0.5644715", "0.55765253", "0.556347", "0.55545896", "0.5499402", "0.54921895", "0.5485978", "0.54574734"...
0.8122676
0
Returns the optimal avatar url to return for the given size
function getGroupAvatarUrlForSize(group, size) { const avatarUrl = group.avatarUrl; const parsed = url.parse(avatarUrl, true); // Tack on a version param otherwise the S3 url is always the same and // you always get the cached avatar from nginx's cache. parsed.query = parsed.query || {}; if (group.avatarVersion) { parsed.query.v = group.avatarVersion; } if (isGitterInternalAvatarUrl(avatarUrl)) { const bestSize = getBestSizeFor(size); // Just use the original if (!bestSize) return avatarUrl; var pathParts = parsed.pathname.split('/'); pathParts.pop(); pathParts.push(bestSize); parsed.pathname = pathParts.join('/'); return url.format(parsed); } else if (isGitlabSecurityDescriptorType(group.sd && group.sd.type)) { if (size) { // This doesn't actually work but these parameters are added in the GitLab UI parsed.query.width = size; } return url.format(parsed); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function _usfGetOriginImgWithSize(url, size = '50x50') {\r\n var n = url.lastIndexOf(\".\");\r\n if (n != -1)\r\n return url.substring(0, n) + '_' + size + url.substring(n);\r\n else\r\n return url\r\n}", "function getUserPhotoUrl(accountName, size) {\n var userPhotoBaseUrl = tryGetAlte...
[ "0.69802517", "0.6954084", "0.69303304", "0.69303304", "0.6868553", "0.68492115", "0.6655605", "0.6637753", "0.6630408", "0.66101694", "0.66101694", "0.66101694", "0.66101694", "0.66101694", "0.65870404", "0.6555746", "0.6551981", "0.6540415", "0.64227694", "0.6413774", "0.63...
0.75917065
0
Rely on the secondary, but if that doesn't find a recently created group, fallback to querying the primary
function findOnSecondaryOrPrimary(groupId) { return Group.findById(groupId, SELECT_FIELDS, { lean: true }) .read(mongoReadPrefs.secondaryPreferred) .then(function(group) { if (group) return group; // Chance that it's not on the secondary yet... return Group.findById(groupId, SELECT_FIELDS, { lean: true }).exec(); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getSingleGroup(db, ObjectID, groupdoc, issuper, curruserid){\n\n var getGroupArray = async () => {\n var userdoc = await (global.lookupUserName(db, groupdoc.groupadminid));\n var adminname = userdoc.username;\n var adminimage = userdoc.imagepath;\n\n var newgroup = new Group.Group_CS(\n ...
[ "0.6087339", "0.56494653", "0.5526681", "0.55133677", "0.5358821", "0.5290795", "0.5276548", "0.526237", "0.5246025", "0.51711124", "0.51671284", "0.51584417", "0.5131122", "0.5131122", "0.5131122", "0.5131122", "0.5131122", "0.5131122", "0.5131122", "0.51241094", "0.51191163...
0.7356845
0
Use the custom group avatar URL if we have one
function _getAvatarFromGroup(group, size) { if (group.avatarUrl) { return getGroupAvatarUrlForSize(group, size); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getGroupAvatarUrlForSize(group, size) {\n const avatarUrl = group.avatarUrl;\n\n const parsed = url.parse(avatarUrl, true);\n\n // Tack on a version param otherwise the S3 url is always the same and\n // you always get the cached avatar from nginx's cache.\n parsed.query = parsed.query || {};\n if (...
[ "0.6959928", "0.6775977", "0.6768385", "0.6631696", "0.65791017", "0.6502219", "0.6493715", "0.6490361", "0.6450367", "0.6434274", "0.6331503", "0.63183075", "0.6306597", "0.6305018", "0.62483144", "0.6240524", "0.6221686", "0.61915576", "0.6189803", "0.61801225", "0.61769724...
0.72789663
0
Helper function to return an object containing evenly spaced x and y coordinates:
generateRandomCoords () { const randomX = Math.floor(Math.random() * 5) * 90 + 25 const randomY = Math.floor(Math.random() * 5) * 100 + 25 return { x: randomX, y: randomY } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function get_coords(x,y)\n{\n return {\n \"x\": 30 + 40*x +(y % 2 == 1 ? 20:0),\n \"y\": 35 + 35*y\n };\n}", "function point2D(x, y) {\n\n return {x: x, y: y};\n\n }", "function makePnt( x, y ) {\n return { x: x, y: y }\n}", "convertCoordinates( x, y ) {\r\n let loc_x ...
[ "0.7159345", "0.70056117", "0.67666143", "0.66311187", "0.6466807", "0.6444893", "0.6393538", "0.63854593", "0.6383024", "0.6376565", "0.6358117", "0.6323815", "0.63176215", "0.6306477", "0.63028586", "0.6248631", "0.62382925", "0.62299156", "0.6228796", "0.62133276", "0.6203...
0.57247347
67
Helper function that returns one set of coordinates not in gameState.numCoordinates
assignCoords () { let assignedCoord = this.generateRandomCoords(); // If the coordinates is already in gameState.numCoordinates, then other set of coordinates are generated until there is one not in use while (gameState.numCoordinates[`x${assignedCoord.x}y${assignedCoord.y}`]) { assignedCoord = this.generateRandomCoords() } gameState.numCoordinates[`x${assignedCoord.x}y${assignedCoord.y}`] = true return assignedCoord }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "getUnassignedLocation(grid) {\n for (let row = 0; row < HEIGHT; row++) {\n for (let col = 0; col < WIDTH; col++) {\n if (grid[row][col] === 0) {\n return [row, col];\n }\n }\n }\n return [10, 10];\n }", "function check_for_isolated_squares(squares_pos) {\r\n\t//console....
[ "0.65544957", "0.60162234", "0.59923327", "0.59546393", "0.5875627", "0.585743", "0.58175874", "0.57606083", "0.57232463", "0.5709606", "0.5709047", "0.5688058", "0.56572926", "0.5641257", "0.56150156", "0.56028277", "0.55878955", "0.5579842", "0.5579842", "0.5579842", "0.557...
0.56699514
12