query stringlengths 9 34k | document stringlengths 8 5.39M | negatives listlengths 19 20 | metadata dict |
|---|---|---|---|
remove the cloning timer | stopCloning() {
if (this.trailInterval) {
clearInterval(this.trailInterval);
}
} | [
"function TimerRemove() {\n va.$timer[ is.timerOutside ? 'empty' : 'remove' ]();\n is.$timer = false;\n }",
"function removeCloneDiv() {\n $('.h2o .banner-hero .slider.p-clone-active').remove();\n $('.h2o .banner-hero .slider.n-clone-active').remove();\n $('.h2o .... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
atom and item create | async create({ atomClass, roleIdOwner, item, user }) {
// atomClass
atomClass = await ctx.bean.atomClass.get(atomClass);
// item
item = item || {};
item.roleIdOwner = roleIdOwner;
// atom bean
const _moduleInfo = mparse.parseInfo(atomClass.module);
const _atomClass = awai... | [
"function createItem(item, position) {}",
"function createItem(item) {\n return itemModel.create(item);\n}",
"function createItem() {\n const args = Array.prototype.slice.call(arguments);\n const name = args.shift();\n args.unshift(DEFAULT_ITEM);\n return createObject(name, args);\n}",
"static create()... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
popup layer with helpbox iframe | function helpbox(url) {
resetPopups();
jQuery('.RNhelpbox').remove();
if ((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPad/i)) || (navigator.userAgent.match(/Android/i))) {
window.open(url);
} else {
var x = document.body.clientHeight < 500;
var backgrou... | [
"function helpbox(url) {\n\n if((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPad/i)) || (navigator.userAgent.match(/Android/i))) {\n window.open(url);\n } else {\n\n resetPopups();\n\n var popup = jQuery(document.createElement('div'));\n var button_close =... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Section: Intent and Actions / Translate intent into action. | processIntent () {
// Failsafe
if (!this.action) this.goIdle()
const action = this.action
const intent = this.intent
if (!intent) { // Go idle
if (action?.name === 'move') this.goIdle()
} else { // Perform a new action
// Note: every 'move' action is considered a new acti... | [
"use(action) {\n \"use strict\";\n this.plugins[action.intent] = action\n\n // this.associate(action.intent, action.sentences, action)\n for(var sentence in action.extractedPair){\n Log.debug('Learning the association of ' + action.extractedPair[sentence].subIntent + ' and ' +... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates a new SourceMapGenerator based on a SourceMapConsumer | static fromSourceMap(aSourceMapConsumer) {
const sourceRoot = aSourceMapConsumer.sourceRoot;
const generator = new SourceMapGenerator({
file: aSourceMapConsumer.file,
sourceRoot
});
aSourceMapConsumer.eachMapping(function(mapping) {
const newMapping = {
generated: {
l... | [
"static fromSourceMap(aSourceMapConsumer) {\n const sourceRoot = aSourceMapConsumer.sourceRoot;\n const generator = new SourceMapGenerator({\n file: aSourceMapConsumer.file,\n sourceRoot\n });\n aSourceMapConsumer.eachMapping(function (mapping) {\n const newMapping = {\n generated:... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
kycFatca Controller for kyc fatca Form | function kycFatca($scope, $http, toaster, $state, formEditService, Scopes) {
//Scopes.store('kycFatca', $scope);
$scope.formStatus = false;
$scope.formEditStatus = false;
$scope.submitText = "Save";
$scope.init = function () {
if (!IsAdmin()) fourmStatus();
$scope.occupationList = []... | [
"function FormController() {\n\t}",
"function srvConcForm(cntx) {\n\t\tvar dataRequest = {\n\t\t\tiden: cntx.form.get('iden').data,\n\t\t\tcate: cntx.form.get('cate').data,\n\t\t\ttipo: cntx.form.get('tipo').data,\n\t\t\tdesl: cntx.form.get('desl').data,\n\t\t\tdesc: cntx.form.get('desc').data\n\t\t};\n\t\tsetBas... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
remove active class from all img | function removeActive(){
for(var i=0;i<lgImg.length;i++){
lgImg[i].classList.remove('active');
}
} | [
"function removeActiveImg(){\n slider.forEach( function (img){\n img.classList.remove('active');\n })\n }",
"function removeActiveClass() {\n images.forEach(image => {\n image.classList.remove('active');\n })\n}",
"function removeactive()\n {\n slidimg.forEach(functi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
update electric use for the day on one device | function updateElectricUseDay($scope,http,device) {
// Dates:
var nowDate = new Date();
var dayBeginDate = new Date(nowDate.getFullYear(),nowDate.getMonth(),
nowDate.getDate());
// seconds:
var nowSeconds = Math.round(nowDate.valueOf() / 1000);
var d... | [
"function updateElectricInputDay($scope,http,device) {\n // Dates:\n var nowDate = new Date();\n var dayBeginDate = new Date(nowDate.getFullYear(),nowDate.getMonth(),\n nowDate.getDate());\n // seconds:\n var nowSeconds = Math.round(nowDate.valueOf() / 1000)... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
check, whether the functiondescription "desc" allows datatype "subdatatype" | function functionApplicable( subdatatype, desc ) {
// it is applicable to the elements data type
if( desc.datatype.includes( subdatatype ) ) {
return true;
}
// it is applicable to any datatype
if( desc.datatype.includes( 'all' ) ) {
return true;
}
// applicable to bagged type... | [
"datatypeInData() {\n return this.subHeaderIndex !== -1;\n }",
"function isValidSubType () {\n\treturn TYPE_ARR.includes(SUB_TYPE)\n}",
"function type_isSuper(sup, sub) {\n //console.log (sup + ' <- ' + sub +'?');\n if (sup=='*') return true;\n var supl= sup.split('|');\n var subl= sub.spl... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates renderer for Entity custom fields. | function entityRenderer() {
return function(value) {
if (value) {
var url = "";
var entityId = "";
var entityType = "";
var label = "";
var icon = "";
var s = value.split("\n");
if (s.length == 3) {
entityId = s[1];
entityType = s[2];
url = Application.getViewUrl(entityId, entityType... | [
"function createCustomFields() {\r\n var infoFields = artwork.Metadata.InfoFields;\r\n infoFields = infoFields || {};\r\n $.each(infoFields, function (key, val) {\r\n createMetadataTextArea({ field: key, entry: val, animate: true, isAdditionalField: true });\r\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Crear cuerpo calendario con tablas | function calendario() {
for (let i = 0; i <= 11; i++) {
//Div Mes
let meses = document.createElement("div");
meses.className = "mes";
document.body.appendChild(meses);
//Tabla Mes
let tabla_mes = document.createElement("table");
tabla_mes.className = "ta... | [
"function crearTablaDiasCalendario()\n{\n\ttablaDiasCalendario.id = 'tablaDiasCalendario';\n\ttablaDiasCalendario.className = 'tablaDiasCalendario'; \n\tfor (let i = 0; i < 7; i++) \n\t{\t\n\t\ttrm = document.createElement('tr');\n\t\ttrm.classList.add('filasemana');\n\t\ttablaDiasCalendario.appendChild(trm); \n\t\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Determines what page an item is on. Zero based indexes This method should return 1 for itemIndex values that are out of range | pageIndex(itemIndex) {
return this.pages.findIndex(page =>
page.element.find(element => element.originalIndex === itemIndex)
)
} | [
"pageIndex(itemIndex) {\n if (itemIndex < 0 || this.itemCount() - 1 < itemIndex) return -1;\n return Math.floor(itemIndex / this.ipp);\n }",
"pageIndex(itemIndex) {\n const page = Math.floor(itemIndex / this._itemsPerPage);\n if (page >= this.pageCount() || page < 0)\n return -1;\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
/ useAlpha / / Use a rejection criterion (alpha) to establish if a given pvalue is / "statistically significant" or not. If checked, the pvalues will be / displayed in bold and emphasized font whenever they are lower than / the criterion defined below | function useAlpha() {
if ( alpha === false ) alpha = true;
else alpha = false;
displayANOVA();
} | [
"function setAlpha() {\n rejection_level = parseFloat(document.getElementById('anova_alpha').value);\n if(rejection_level > 1) rejection_level = 0.9999999;\n if(rejection_level < 0) rejection_level = 0.0000001;\n \n // We should redisplay the ANOVA table as some of the\n // terms may now be statis... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Getter for movie comments | @computed get getMovieComments() {
return this.movieComments;
} | [
"function getMovieComments() {\n requestService.getMovieCommentsByID($routeParams.movieId).then(\n\n // success function\n function(data) {\n $log.debug('movieCommentsController -> getCommentsByID success', data.comments);\n $scope.movie... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
ex. fixedCharCodeAt('\uD800\uDC00', 0); // 65536 ex. fixedCharCodeAt('\uD800\uDC00', 1); // false | function fixedCharCodeAt(str, idx) {
idx = idx || 0;
var code = str.charCodeAt(idx);
var hi, low;
// High surrogate (could change last hex to 0xDB7F to treat high
// private surrogates as single characters)
if (0xD800 <= code && code <= 0xDBFF) {
hi = code;
low = str.charCodeAt(idx + 1);
if (isN... | [
"function codepointFromChar(s){var hi,lo\n if(/[\\uD800-\\uDBFF][\\uDC00-\\uDFFF]/.test(s)){\n hi=s.charCodeAt(0)\n lo=s.charCodeAt(1)\n return 0x10000+(((hi&0x3FF) << 10) | (lo&0x3FF))}\n return s.charCodeAt(0)}",
"function fromCharCode( x ) {\n return root[ \"String\" ][ \"fromCharCode\" ]( x );\n}",
"f... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Iterates through the product list and calls the renderTile method to create the ProductTile object | render() {
let tiles = [];
for (let i = 0; i < this.props.products.length; i++) {
const current_item = this.props.products[i];
tiles.push(this.renderTile(current_item));
}
return tiles;
} | [
"function renderProductsOnPage() {\n for (var i = 0; i < products.length; i++) {\n var product = products[i];\n\n $('ul.rig.columns-4').append(\n '<li>' +\n '<img src=\"' + product.img + '\" alt=\"Product\" />' +\n '<h3>' + product.name + '</... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Where the engine is being loaded from: will return the URI's spec if the engine is being downloaded and does not yet have a file. This is only used for logging and error messages. | get _location() {
if (this._file)
return this._file.path;
if (this._uri)
return this._uri.spec;
return "";
} | [
"get uri() {\n let { bufnr } = this;\n if (bufnr) {\n let document = this.getDocument(bufnr);\n if (document && document.schema == 'file') {\n return document.uri;\n }\n }\n return null;\n }",
"function getDocUri() {\n return docume... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Equality test for settings objects | function settingsEqual(s1, s2) {
return s1.powers == s2.powers && s1.negs == s2.negs &&
s1.bonuses == s2.bonuses && s1.playersPerTeam == s2.playersPerTeam;
} | [
"function settingAllEquals(settingName, value) {\n let fail = false;\n for (key in pSettings[settingName]) {\n if (pSettings[settingName][key] !== value) {\n fail = true;\n break;\n }\n }\n return !fail;\n}",
"function assertSettingsEquals(testSet) {\n var mSetti... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
ensure it passes all the test inputs and matches their results. Modify magic_multiply until all the tests pass. Do not create a new magic_multiply for each test! | function magic_multiply(x, y){
// For test 4 we need to check that we're not trying to multiple strings.
if (typeof y === 'string'){
console.log('Error: Cannot multiple by string');
return undefined; // Should we return null or undefined.
}
// For test 5 we want to return a string, repeate... | [
"function multiplytest(v1, v2, expected) {\n results.total++;\n var r = calculator.multiplication(v1, v2);\n if (r !== expected) {\n results.bad++;\n console.log(\"Expected \" + expected +\n \", but was \" + r);\n }\n }",
"function reliableMultiply(a, b) {\n for (; ;) {\n t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Load data from server/url with data as params, if successful load page by id | function loadData(url, data, id) {
url=document.sg.server+'/'+url;
$.ajax(url, {
dataType: 'jsonp',
data: data,
success: function(data, textStatus, jqXHR) {
if (data.alert) {
console.log('Got alert: '+data.alert);
alert(data.alert);
}
if (data.goto) {
console.log('Goto '+data.goto);
pag... | [
"function load_from_url() {\n\tid = window.location.href.split('?')[1];\n\n\tif (id) {\n\t\tdata_id = id;\n\t\tload_json(id);\n\t}\n}",
"function loadPage(url,areaId) {\n $.get(url,\n function(data) {\n setPage(data,areaId);\n \t updateLinks(url);\n });\n}",
"function load(url,id){\n if(ur... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Generate nested data from nested paths and pageFileCache Input paths, pageFileCache generated by getNestedPathList() | function nestData(paths, pageFileCache, start = ['']) {
// output = {
// type: 'folder',
// id: '',
// path: 'fullpath',
// matter: {frontmatter YAML}
// files: [
// {
// type: 'file',
// path: 'fullpath'
// id: 'slug/id'
// matter: ...
// },
// {
... | [
"_getNestedData(data, path) {\n if (!this._reg.path.test(path)) { return null; }\n const paths = path.split('.');\n if (!paths.length) { return null; }\n let res = data;\n for (let i = 0; i < paths.length; i += 1) {\n if (res === undefined) { return null; }\n res = res?.[paths[i]];\n }\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
keydown on main svg | function svgKeyDown() {
var thisGraph = this,
state = thisGraph.state,
consts = thisGraph.consts;
state.lastKeyDown = d3.event.keyCode;
var selectedNode = state.selectedNode,
selectedEdge = state.selectedEdge;
switch(d3.event.keyCode) {
c... | [
"svgKeyDown() {\n\t\tlet {internalFlags, constants} = this;\n\t\t// make sure repeated key presses don't register for each keydown\n\t\tif (internalFlags.lastKeyDown !== -1) return;\n\n\t\tinternalFlags.lastKeyDown = d3.event.keyCode;\n\t\tvar selectedEdge = internalFlags.selectedEdge;\n\t\t// var selectedNode = in... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Init create entity endpoint POST '/' | initCreateEndpoint() {
this.router.post('/', (req, res) =>
this.getDAO().create(req.body).then(user => res.status(200).send(user))
.catch(err => {
debug('[create]', err.message);
return this.sendErr(res, 400, err.message);
}));
... | [
"create(request, response) {\n console.log('insde create', request.body);\n RestfulTask.create(request.body)\n .then(task => response.json(task))\n .catch(error => response.json(error));\n }",
"create(req, res) {\n Post.create(req.body)\n .then(function (newPost) {\n res.status... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
START Generic work queue functions. | function _buildWorkQueue() {
// Add work to the queue.
_addWorkQueueItems();
} | [
"work() {}",
"_startQueue() {\n if (!this._queue) {\n this._queue = this._ironium.queue('$schedule');\n this._queue.eachJob((job)=> this._runQueuedJob(job));\n }\n }",
"function startQueue() {\n if(running)\n return;\n running = true;\n setTimeout(doNext,queue[0].d... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
emits rule to generate version info for a SAPI or extension. Returns the name of the .res file that will be generated | function generate_version_info_resource(makefiletarget, creditspath)
{
var resname = makefiletarget + ".res";
var res_desc = "PHP " + makefiletarget;
var res_prod_name = res_desc;
var credits;
var thanks = "";
var logo = "";
if (FSO.FileExists(creditspath + '/CREDITS')) {
credits = FSO.OpenTextFile(creditspat... | [
"getResourceExtension(){\n let fileName = (this.isComplex() ? this.data.source: this.data);\n return fileName.split(\".\").reverse()[0];\n }",
"function generateVersionSpecifier() {\n return `// Version [${cred.resourceVersion}] //`;\n }",
"function generateFileName(t) {\r\n\treturn t.link.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
counting lessons from database | function countLessonsFromDatabase(tID){
var lessonNum;
console.log(lessonNum);
} | [
"function count_viewers(){\n // reset counter\n for (let i = 0; i < news_sites.length; i++) {\n let source = news_sites[i];\n viewers_counter[source] = 0;\n }\n for (let i = 0; i < viewers.length; i++) {\n // see from which site it is\n for (let j = 0; j < news_sites.length; j++) {\n let site =... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Send strategy of current bot to server. | function sendStrategy(data) {
$.ajax({
url : strategyUrl,
data : JSON.stringify(data),
dataType : 'json',
type : 'put',
contentType: "application/json",
success : function(strategy) {
console.log('Success to send strategy da... | [
"setStrategy(strategy) {\r\n this.strategy = strategy;\r\n }",
"setStrategy(strategy) {\n this._strategy = strategy;\n }",
"management() {\n\t\tthis.m.getBots().forEach(agent => agent.strategy.executeTurn(agent, this.m.agentManager, this.m.cardManager) );\n\t}",
"doSend(bot, destination, content... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Send PIN to server and retrieve data if right | function sendPIN(calledByUser) {
// Send JSONP request
$.getJSON(scriptURL+"?prefix=getData&pin="+enterCode+"&callback=?")
.done(function(data) { // If response from server
if (data==""){
// Wrong PIN
$("section#pinput").fadeIn(500);
$("#numbers").removeClass("loa... | [
"function sendToServer(){\n\tconsole.log(\"Sending.\");\n\tvar newPin = getPin();\n\tnewPin.xhr = true;\n\t$.ajax('/pin/' + newPin.id,\n\t\t\t{\n\t\tdata: newPin,\n\t\ttype: \"POST\",\n\t\tsuccess: function(data){\n\t\t\tthePin = newPin;\n\t\t\tconsole.log(\"Done.\");\n\t\t},\n\t\terror: function(jqxhr, status){\n\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
get top risky controllers | async getTopRiskyControllers(ts, te) {
let token = localStorage.getItem("interset_token");
axios.defaults.headers.common['Authorization'] = token;
// console.log(ts);
let url = `${API_URL}/api/search/0/controllers/topRisky?sort=maximum&markup=false&tz=UTC%2B8&count=10&keepAlive=300000`
if((ts!==0) &... | [
"_getController() {\r\n const _this = this;\r\n\r\n const controllers = Object.keys(this._nodes)\r\n .filter(function(address) {\r\n return _this._nodes[address].controller;\r\n })\r\n .map(function(address) {\r\n return _this._nodes[address];\r\n });\r\n\r\n if (controllers.length >=... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Compare A with Memory Direct Page Indirect Long Indexed Y 0xD7 | function _cmpADPIndirectLongY() {
this.name = "Compare A with Memory Direct Page Indirect Long Indexed Y"
this.argCount = 0;
this.size = Size.MEMORY_A;
this.addrMode = AddressingMode.DIRECT_PAGE_INDEXED_INDIRECT_LONG_Y;
this.mnemonic = 'CMP'
} | [
"function _cmpADPIndirectLong() {\n\tthis.name = \"Compare A with Memory Direct Page Indirect Long\"\n\tthis.argCount = 0;\n\tthis.size = Size.MEMORY_A;\n\tthis.addrMode = AddressingMode.DIRECT_PAGE_INDIRECT_LONG;\n\tthis.mnemonic = 'CMP'\n}",
"function _cmpASRIndirectY() {\n\tthis.name = \"Compare A with Memory ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
overload with two options for hydrateToString one that returns a promise, and one that takes a callback as the last arg | function hydrateToString(hydrateOpts) {
// validate the hydrate options and add any missing info
normalizeHydrateOptions(config, hydrateOpts);
// kick off hydrated, which is an async opertion
return hydrateHtml(config, ctx, registry, hydrateOpts).catch(function (err) {
var hy... | [
"function hydrateToString(hydrateOpts) {\n // validate the hydrate options and add any missing info\n normalizeHydrateOptions(config, hydrateOpts);\n // kick off hydrated, which is an async opertion\n return hydrateHtml(config, ctx, registry, hydrateOpts).catch(err => {\n cons... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
related to: eventList makeEventList() > eventList Creates an event list: a list for managing an event. | function makeEventList() {
var list = {};
var events = [];
/**
* eventList.each(func)
* - func (Function): Function to execute on each entry in the list.
*
* Loops over each of the entries in the list and executes the given
* `func` on them.
... | [
"createEventList() {\n let list = document.getElementById('list');\n let events = this.eventlist.Items.map(item => {\n let event = new EventItem(item.Day, item.Date, item.Time, item.EventName, item.VenueName, item.VenueCity, item.MinPrice, item.IsSoldOut, item.DateVal);\n list.ap... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
spyce.serveApp() Serve an app with a given template. Registers an express middleware function. | function serveApp(appName, tpl) {
return function (req, res, next) {
var app = req.app.locals.buildInfo.apps[appName];
if (!app) next(new ReferenceError('Spyce Error: App "' + appName + '" not found.'));
var scripts = defaultScripts() + scriptify(app.libs) + scriptify(app.files, true);
var context = {
app:... | [
"function serveApp(appName, tpl) {\n\treturn (req, res, next) => {\n\t\tlet app = req.app.locals.buildInfo.apps[appName]\n\t\tif (!app) next(new ReferenceError('Spyce Error: App \"' + appName + '\" not found.'))\n\n\t\tlet scripts = defaultScripts() + scriptify(app.libs) + scriptify(app.files, true)\n\t\tlet contex... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
The code shown here creates a file in your app's cache (in sandboxed storage) named tempFile.jpeg. With the new FileEntry object, you can copy the image to the file or do something else like upload it. | function createNewFileEntry(imgUri) {
window.resolveLocalFileSystemURL(cordova.file.cacheDirectory, function success(dirEntry) {
// JPEG file
dirEntry.getFile("tempFile.jpeg", { create: true, exclusive: false }, function (fileEntry) {
// Do something with it, like write to it, upload i... | [
"function storeProfileImageInFileSystem(script_info, image) {\n var img_petition = new XMLHttpRequest();\n console.log(\"Storing profile image of \" + script_info.name);\n img_petition.open('GET', script_info.dir_route + \"/\" + image);\n img_petition.responseType = 'arraybuffer';\n img_petition.time... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
rotate the planet of phi and theta angles | function rotateXY(phi, theta) {
var earth = models.earth,
cities = models.cities,
xVec = [1, 0, 0],
yVec = [0, 1, 0],
yVec2 =[0, -1, 0];
earth.matrix = geom.matEarth.clone();
cities.matrix = geom.matCities.clone();
var m1 = new Mat4(),
m2 = new Mat4();
m1.$rotateAxis(phi, xVec... | [
"function rotate(p, phi) {\n return new Point( p.x*Math.cos(phi) + p.y*Math.sin(phi), - p.x*Math.sin(phi) + p.y*Math.cos(phi) );\n}",
"function generateMoonRotation(planet, angle){\n // Rotation\n for(var i in planet.children){\n planet.children[i].children[0].rotation.y += angle * 10;\n }\n}",
... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Handle request to create/use a new selCrit. | handleNewSelCrit() {
const p = this.props;
// start an edit session with a new selCrit of specified itemType
const selCrit = SelCrit.new(this.meta().itemType);
p.dispatch( actions.selCrit.edit(selCrit,
true, // isNew
SelCrit.Syn... | [
"handleDuplicateSelCrit() {\n const p = this.props;\n\n // start an edit session with a duplicated (new) selCrit\n const dupSelCrit = SelCrit.duplicate(p.selCrit);\n p.dispatch( actions.selCrit.edit(dupSelCrit, \n true, // isNew\n S... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
_ESAbstract.HasProperty 7.3.10. HasProperty ( O, P ) | function HasProperty(O, P) { // eslint-disable-line no-unused-vars
// Assert: Type(O) is Object.
// Assert: IsPropertyKey(P) is true.
// Return ? O.[[HasProperty]](P).
return P in O;
} | [
"HasProceduralProperty() {}",
"function HasProperty (O, P) {\n /** 1. Let desc be the result of calling the [[GetProperty]] internal method of O with property name P. */\n desc := GetProperty(O, P);\n\n /** 2. If desc is undefined, then return false. */\n if (desc = undefined) {\n return false\n }\n /** ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
reduce buffer size, avoiding mem copy | function shrinkBuf(buf, size) {
if (buf.length === size) { return buf; }
if (buf.subarray) { return buf.subarray(0, size); }
buf.length = size;
return buf;
} | [
"shrink() {\n\t\t// noinspection ConditionalExpressionJS\n\t\tconst currentLength = (this.bitsCount >> 3) + (this.bitsCount % 8 ? 1 : 0);\n\t\tif (currentLength < this.buffer.byteLength) {\n\t\t\t//region Change size of buffer\n\t\t\tconst buffer = new ArrayBuffer(currentLength);\n\t\t\tconst view = new Uint8Array(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
end ParticleSSE ParticlePublish node base module for submitting events to Particle Cloud | function ParticlePublish(n) {
// note:
// the node-RED 'n' object refers to a node's instance configuration and so is unique between ParticlePublish nodes
var that = this;
RED.nodes.createNode(this, n);
// Get all properties from node instance settings
this.pcloud = RED.nodes.getNode(n.pcloud);
this.ev... | [
"function ParticleSSE(n) {\n\t\t// note: code in here runs whenever flow is re-deployed.\n\t\t// the node-RED 'n' object refers to a node's instance configuration and so is unique between ParticleSSE nodes\n\n\t\tvar that = this;\n\n\t\tRED.nodes.createNode(this, n);\n\n\t\t// Get all properties from node instance ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Obtenemos los valores de los datasets y labels para la grafica para cualquier JSON | function generaDatasLabels(json) {
let label = [],
labels = [],
data = [],
datas = [],
datasets = [],
datasYlabels = [];
let DatosJson = json;
//Obtenemos los nombres de cada campo del JSON
for (let key in DatosJson.data[0]) {
label.push(key)
}
/... | [
"getDatasets() {\n for (let i = 0; i < this.countries.length; i++) {\n this.datasets[i] = { label: this.countries[i], data: this.crimesByYear[i] };\n }\n console.log(this.datasets);\n }",
"getDatasets() {\n for (let i = 0; i < this.countries.length; i++) {\n this.datasets[i] = { l... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function Object Swap Text | function objectSwapText(obj, text1, text2)
{
obj.html() == text1 ? obj.html(text2) : obj.html(text1);
} | [
"function swapText(){\n var textSwap = $(\"#textSwap\");\n var newText = new Array();\n newText[0] = 'captivating';\n newText[1] = 'astonishing';\n newText[2] = 'awe-inspiring';\n newText[3] = 'memorable';\n\n setTimeout(function(){\n textSwa... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Display and then store record in the remote datastore of each time a fire alarm condition has been triggered | function notify() {
console.log("fire alarm");
notifySMS();
var payload = { value: "fire alarm", datetime: new Date().toISOString() };
datastore.log(config, payload);
mqtt.log(config, payload);
} | [
"function addAlarm() {\n var hours = $(\"#hours option:selected\").text();\n var mins = $(\"#mins option:selected\").text();\n var ampm = $(\"#ampm option:selected\").text();\n var alarmName = $(\"#alarmName\").val();\n var time = hours + \":\" + mins + \" \" + ampm;\n\n ga('send', 'event', 'Alarm', 'Ad... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Define user is sender or receiver | explainSender(message) {
if (message.sender == this.AuthorizationService.user.id) {
return {
"me": true
};
} else if (message.sender != this.AuthorizationService.user.id) {
return {
"recipient": true
};
}
} | [
"function sender_is_bot(message) {\n return message['sender_type'] == \"bot\"\n}",
"function checkOrigin(message, user) {\n\tif(!user && !message.sender) return true;\n\tif(!message.sender) message.sender = user\n\treturn message.sender == user\n}",
"function userIsReceiver(receiverID){\n \t\t\tif ( isLogge... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Centers lightbox on screen and positions close icon in upper right of box | function positionLightbox(lightbox){
//position lightbox content
lightbox.css('max-height','100%');
lightbox.css('overflow-y','auto');
if(lightbox.attr('id') == 'sampleStatsMore'){
lightbox.css('height', '100%');
}
else{
lightbox.css('height', lightbox.naturalHeight);
}
var boxHeight = lightbox.oute... | [
"function closeLightboxByIcon(xIcon){\n var lightbox = $(xIcon).parent();\n lightbox.css('display', 'none');\n $('#darkBack').css('display', 'none');\n $('body').removeClass('noScroll'); //re-enable scroll for content behind lightbox\n}",
"function recenterOverlay (){\n window.scrollTo(0,-2);\n var cwid... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Overloads so we can call resolvedSyncPromise without arguments and generic argument Creates a resolved sync promise. | function resolvedSyncPromise(value) {
return new SyncPromise(resolve => {
resolve(value);
});
} | [
"function resolvedSyncPromise(value) {\n return new SyncPromise(resolve => {\n resolve(value);\n });\n }",
"function wrap_sync (fn) {\n return function (params) {\n var val = fn(params)\n if (val && !isPromise(val)) throw val\n return val\n }\n}",
"function perform(value, async, sync){\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Alert base on browser's inner size: | function AlertInnerSize(pwidth) {
var myWidth = 0, myHeight = 0;
var alerted = false;
if ( typeof (window.innerWidth) == 'number') {
// Non-IE
myWidth = window.innerWidth;
myHeight = window.innerHeight;
} else if (document.documentElement && (document.documentElement.clientWidth || document.document... | [
"function alertSize() {\r\n // initialise local variables.\r\n var myWidth = 0,\r\n myHeight = 0;\r\n\r\n if (typeof window.innerWidth == \"number\") {\r\n //Non-IE\r\n myWidth = window.innerWidth;\r\n myHeight = window.innerHeight;\r\n } else if (\r\n document.documentElement &&\r\n (document... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
draws the twitter bird image | function drawBird(canvas, context) {
var twitterBird = new Image();
twitterBird.src = "images/twitterBird.png";
// images don't always load immediatly, so we make sure the image is fully loaded before we draw it:
twitterBird.onload = function() {
context.drawImage(twitterBird, 20, 120, 70, 70);
};
} | [
"function drawBird(canvas, context) {\n\tvar twitterBird = new Image();\n\ttwitterBird.src = \"images/twitterBird.png\";\n\t// images don't always load immediatly, so we make sure the image is fully loaded before we draw it:\n\ttwitterBird.onload = function () {\n\t\tcontext.drawImage(twitterBird, 20, 120, 70, 70);... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Redirect to web page for more games | function MoreGames(){
window.location="https://www.247games.com/";
} | [
"function goToGame() {\n window.location = 'game.html';\n}",
"function returnToGame() {\n window.location.href = PATH_TO_INDEX;\n}",
"function playAGameRedirect() {\n document.location = \"GameRules\";\n}",
"function continueToGameRedirect() {\n initializeGame();\n document.location = \"GamePlay\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function: pickIcon Purpose: select which svg to display based on the category of the item Parameters: item.category from groceries.json | function pickIcon(category) {
switch (category) {
case "fruit":
return "<img src='img/fruit.svg' alt='Fruit Category Icon' class='listView'>";
break;
case "beverage":
return "<img src='img/beverage.svg' alt='Beverage Category Icon' class='listView'>";
break;
case "pasta":
ret... | [
"function selectIconPath() {\n\t\tif (_title === 'Feed & Care') {\n\t\t\treturn imagePath.feed;\n\t\t} else if (_title === 'Training') {\n\t\t\treturn imagePath.train;\n\t\t} else if (_title === 'Health') {\n\t\t\treturn imagePath.health;\n\t\t} else if (_title === 'Gestation') {\n\t\t\treturn imagePath.gestation;\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sync time fields if exist. Sync times in duration mode for now. | function syncTimeFields(parentTimesElt) {
$(parentTimesElt).each(function () {
var holder = $(this);
//Times are displayed in duration mode (cocorico.times_display_mode: duration)
if (holder.find("#time_range_nb_minutes").length) {
var $fromHour = holder.find("#time_range_start_... | [
"timeUpdated(field, new_time) {\n let new_timestamps = {\n start_time: this.order.start_time,\n end_time: this.order.end_time,\n }\n\n const current_hour = DateTime.local().hour\n const chosen_hour = new_time.hour\n\n // Chose a time before this past midnight?\n if(current_hour < 12 && c... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates static context object | function fCreateStaticContext(vResolver, sBaseURI) {
return new cStaticContext(vResolver, sBaseURI);
} | [
"function contextCreate()\n\t\t{\n\t\t\tvar context = Context.create();\n\t\t\ttrace(context);\n\t\t}",
"function createContext() {\n const context = Object.assign({}, baseGlobals);\n context.global = context;\n return context;\n}",
"function InstantiationContext() {\n}",
"createContext() {\n\t\treturn new... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
_att This function is intended to be an object member method. As such it operates on the implicit this object. _att returns the value of the this object's HTML attribute a, if any. If the optional v argument is supplied, attribute a is set before being returned. Prototype: string _att(string a[, string v]) Arguments: a... | function _att(a, v) {
return objAtt(this, a, v);
} | [
"function att(f,a,errok) {\n\ttry {return document.form1.elements[f].getAttribute(a);}\n\tcatch(e) {logjserror('att('+f+','+a+')',errok,e); return '';}\n}",
"function attr(name,value){\n\t\tvar args=arguments,l=args.length;\n\t\tif(l==1){\n\t\t\tif(typeof name==\"string\"){\n\t\t\t\tvar first=this[0];\n\t\t\t\tre... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Selected a new mean/median option | function meanMedianSelected(item) {
lineChart.selectedMode = $(item).attr("name");
updateLineChartVisualisation();
} | [
"function setupLineChartMeanMedianButtons() {\n d3.select(\"#mean\")\n .attr(\"onchange\", \"meanMedianSelected(this)\");\n\n d3.select(\"#median\")\n .attr(\"onchange\", \"meanMedianSelected(this)\");\n}",
"@api changeAverage() {\n if (this.showAverage) {\n this.showAverage ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
deletes post from secrets and updates location posts | async function deletePost(secretID, locationID){
try{
const result = await axios({
method: 'delete',
url: `http://localhost:3003/secret/${secretID}`,
withCredentials: true
});
console.log(result);
}catch(err){
console.log(err);
}
try{
let location = await axios({
... | [
"function deletePost() {\n\tvar snippet = {\n\t\tquery : {\n\t\t\t// published: false,\n\t\t\tid: \"-K_WonIe_j7iSm-WeyC8\"\n\t\t}\n\t}\n\n\trimer.post.delete(snippet, function(error, value) {\n\t\tif(error) {\n\t\t\tconsole.log(error)\n\t\t}\n\t\telse {\n\t\t\tconsole.log(value)\n\t\t}\n\t})\n}",
"async function ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
in case that the data for the update doesn't have the mongo $set special key (which means override everything inside the object in the db for the given query) we want to add it in order to only update the given fields only and leave everything else as is. | function fixUpdatedData(data) {
if (!data['$set']) {
return { $set: { ...data } };
}
return data;
} | [
"static toUpdate(update) {\n const hasSpecial = Object.keys(update).reduce((a, c) => {\n if (a === true)\n return a;\n a = c.charAt(0) === '$';\n return a;\n }, false);\n if (!hasSpecial)\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns the `route.outlet` or PRIMARY_OUTLET if none exists. | function getOutlet(route) {
return route.outlet || PRIMARY_OUTLET;
} | [
"function getOutlet(route) {\n return route.outlet || PRIMARY_OUTLET;\n }",
"function getOutlet(route) {\n return route.outlet || PRIMARY_OUTLET;\n}",
"function getOutlet(route) {\n return route.outlet || PRIMARY_OUTLET;\n}",
"get outlet() {\n return this.resolveOutlet();\n }",
"get ou... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
if no unlinked issues, return msg. Otherwise continue promise chain, creating agm user stories and posting github comments containing agm info for respective user story | function createAgmItems(unlinkedIssues){
if (unlinkedIssues.length === 0) {
res.reply('All Issues Linked.')
} else {
return Q.all(unlinkedIssues.map(i => {
let match = matchIssueObject(i, allIssueObjects);
return createAgmItem(match);
})).then(result => {
... | [
"async function fetchIssues () {\r\n const result = await ghrepo.issuesAsync({ state: 'open' }) // Fetch open issues\r\n const issues = result[0].map(issue => ({\r\n id: issue.id,\r\n number: issue.number,\r\n user: issue.user.login,\r\n title: issue.title,\r\n body: issue.body,\r\n link: issue.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Fetch network nodes from OpenDaylight Populate Network Device section Show Network Devices | function populateNetworkNodes() {
var nodes = null;
$
.ajax({
url : sdnControllerURL
// + "/controller/nb/v2/switchmanager/default/nodes",
+ "/restconf/operational/opendaylight-inventory:nodes",
type : "GET",
async : false,
contentType : "application/json",
success : function(data, ... | [
"function getgNodeBs()\n{\n const url = 'http://150.140.195.214:3000/devices/getgNodeBs';\n fetch(url,)\n .then((resp) => resp.json())\n .then(function(resp) {\n my_gNodeBs=resp\n \n })\n .catch(function(error) {\n console.log(error);\n });\n}",
"async getDevices(netId) {\n return... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
The client sends the webRTC answer to the board's owner | function onWebRTCAnswer(con, data) {
var targetConnection = users[data.board_owner];
sendTo(targetConnection, {
type: "webRTCAnswer",
answer: data.answer,
clientUsername: con.name
});
console.log(con.name + " sends webrtc answer to " + data.sender);
} | [
"function onOfferReceived(data) {\n console.log(\"Receive WebRTC offer from the board owner: \" + data.board_owner);\n\n goToPage3();//go to drawing board.\n\n boardOwnerUsername = data.board_owner;\n\n preparePeerConnection();\n peerConnection.setRemoteDescription(new RTCSessionDescription(data.offe... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Less important things beyond this point! You can change this if you have things that can be messed up by long tick lengths | function maxTickLength() {
return(1) // Default is 1 hour which is just arbitrarily large
} | [
"function maxTickLength() {\n\treturn(0.2) // Default is 1 hour which is just arbitrarily large\n}",
"function maxTickLength() {\n\treturn(1.79e308) // Default is 1 hour which is just arbitrarily large\n}",
"function maxTickLength() {\r\n\treturn(3600) // Default is 1 hour which is just arbitrarily large\r\n}",... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns the index following the given one, with respect to this manager''s ambient frame sequence cycling back to zero if the given index is the maximum for that sequence. | nextAmbientIndex(ix) {
var nextix;
//---------------
nextix = ix + 1;
if (nextix === this.N_FRAMES) {
nextix = 0;
}
return nextix;
} | [
"function GetLastPosition(index) {\n\n if(index == 0) {\n return 0;\n } else {\n index--;\n if (Sequence[\"Steps\"][index+1][\"Type\"] == 1) {\n return Sequence[\"Steps\"][index+1][\"Params\"][\"Position\"];\n } else {\n return GetLastPosition(index);\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
used in updateHuddles to select huddle for patient on the given selected date | selectedPatientHuddle(selectedDate, patientHuddles) {
if (patientHuddles == null) { return null; }
return patientHuddles.find((huddle) => moment(selectedDate).isSame(huddle.datetime, 'day'));
} | [
"updateHuddles(patient, huddles, selectedDate) {\n let patientHuddles = getPatientHuddles(patient, huddles);\n\n let selectedPatientHuddle;\n if (patientHuddles != null) {\n selectedPatientHuddle = this.selectedPatientHuddle(selectedDate, patientHuddles);\n }\n\n let selectedPatientHuddlePatient... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
For the subtab1 in the info window | function openSub(evt, cityName, j) {
// Declare all variables
var i, tabcontent, tablinks;
// Get all elements with class="tabcontent" and hide them
tabcontent = document.getElementsByClassName("subcontent" + j);
for (i = 0; i < tabcontent.length; i++) {
tabcontent[i].style.display = "none... | [
"function sub_tab1(tab) {\n\tdocument.getElementById('mini_tab1').style.display = 'none';\n\tdocument.getElementById('mini_tab2').style.display = 'none';\n\tdocument.getElementById('mini_tab3').style.display = 'none';\n\t\n\t\n\tdocument.getElementById('li_mini_tab1').setAttribute(\"class\", \"\");\n\tdocument.getE... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
FUNCTION: findSSrec DESCRIPTION: Given a node and a type, locates and returns a matching SSRecord ARGUMENTS: node the node to located the SSRec for type the type of SSRec to search within RETURNS: an SSRecord object | function findSSrec(node,type)
{
ssRecs = dw.serverBehaviorInspector.getServerBehaviors();
ssMatchRec = null;
for (var j=0; j<ssRecs.length; j++) { //search all ssRecs
ssRec = ssRecs[j];
if ((ssRec.participants) && (ssRec.type == type)) {
for (var k=0; k<ssRec.participants.length; k++) { //scan... | [
"function findRecord(recs, tm, src) {\n // TODO: improvement, use binary search!\n return recs.find(rec => rec.tm.ms === tm.ms && rec.src === src);\n}",
"function si_findSi(type) {\n // use a loop here, better RN support (which doesn't have [].find)\n for (let i = 0; i < si_SI.length; i++) {\n if (si_SI[i]... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
B1 Day Todo B1 Week Generate 2 series with complementary data points | function getB1DataSeriesForWeek(miny, maxy, resolution) {
var dy = maxy - miny;
var now = moment(),
t0 = moment().startOf('isoweek');
var n = 7;
var choices1 = $.map(new Array(n), function () {
return Math.random() < 0.4;
});
var genSample = function genSample(i, t) {
return ... | [
"oneDaySyntheticActivityData() {\n let data = [\n this.generateActivityData(MiBand2ServiceModel.DATA_NOT_WEARING_SAMPLE, 1),\n this.generateActivityData(MiBand2ServiceModel.DATA_DEEP_SLEEP_SAMPLE, 4),\n this.generateActivityData(MiBand2ServiceModel.DATA_LIGHT_SLEEP_SAMPLE, 4)... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
When host binding is executing this points to the directive index. `TView.data[getCurrentDirectiveIndex()]` is `DirectiveDef` `LView[getCurrentDirectiveIndex()]` is directive instance. | function getCurrentDirectiveIndex() {
return instructionState.lFrame.currentDirectiveIndex;
} | [
"function getCurrentDirectiveIndex() {\n return instructionState.lFrame.currentDirectiveIndex;\n }",
"function getCurrentDirectiveIndex() {\n return instructionState.lFrame.currentDirectiveIndex;\n}",
"function getHostDirectiveDef(tData) {\n var currentDirectiveIndex = getCurrentDirectiveIndex();\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Rotates the vector towards the specified vector/point with multiplicate % and returns this; | RotateTowardsMult(percent, x, y) {
let Mag = this.Magnitude();
let B = new Vec2(x, y).Normalize();
this.Normalize();
let VecLine = Vec2.Subtract(B, this).Multiply(percent);
this.Add(VecLine);
this.Normalize().Multiply(Mag);
return this;
} | [
"function rotate(v){\n\t\treturn $M([[0, -1],[1, 0]]).x(v)\n\t}",
"rotationTo(a, b) {\n const dot = a.dot(b);\n if (dot < -0.999999) {\n const tmpvec3 = vec3_1.Vec3.right().cross(a);\n if (tmpvec3.length < common_1.EPSILON) {\n const axis = vec3_1.Vec3.up()\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Helper function to get the 'classname' of an object. | function getClassName(obj)
{
if (obj === null) {
return 'null';
}
if (obj === undefined) {
return 'undefined';
}
var c = obj.constructor.toString();
return c.substring(9, c.indexOf('(', 10));
} | [
"static getClassName(object) {\r\n if (object === null || object === undefined) {\r\n return undefined;\r\n }\r\n const constructor = typeof object === \"function\" ? object.toString() : object.constructor.toString();\r\n const results = constructor.match(/\\w+/g);\r\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
CN Generate new tile in random valid location | function generateNewTile(){
var openLocations = checkOpenLocations();
if(openLocations.length > 0){
// CN get random location string and format into valid coordinates
var randomIndex = Math.floor(Math.random() * openLocations.length);
var newCol = parseInt(openLocations[randomIndex].split('(')[1]);
var ... | [
"spawnRandomTile() {\n const position = this.getRandomUnoccupiedPositon();\n if (!position) return;\n const { row, column } = position;\n this.createTile(row, column, 2);\n }",
"function spawnTile() {\n\tvar newPos = findEmptyPos(),\n\t\ttile = { val: Math.random() < 0.9 ? 2 : 4, isMerged: false };\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
update the personality barchart and scores | function updatePersonality(personality, role){
$("#"+ role + "-container").find(".personality.persona").append(
'<h3 class="category" data-toggle="tooltip" data-placement="top" \
title="Big Five personality characteristics represent the most widely used model for generally describing \
how... | [
"function updateBarchart() {\n updateBarchartDomains();\n updateBarchartAxes();\n updateBarchartBar();\n updateBarchartUncertainty();\n updateBarchartLegend();\n }",
"function updateBarchart() {\n\n var barchart = d3.select(\".barchart\");\n\n // Update bars with new data.\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
toma los valores de total columna, total fila y total suma y les aplica la formula de calculo de frecuiencia esperada => FE = (TOTAL_FILA TOTAL_COLUMNA) / TOTAL_SUMA | function calcular_frecuencia_esperada(totalColumna, totalFila, totalSuma) {
return (totalColumna * totalFila) / totalSuma;
} | [
"function calcular() {\n var importeCompra = compraTotal();\n var tasaDto = calculaDto();\n var importeTasa = importeCompra * tasaDto/100;\n var importeIva = (importeCompra-importeTasa) * 0.21;\n var importeTotal = importeCompra - importeTasa + importeIva;\n document.getElementById(\"precioCompra\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Patch Node fs methods. process.env.EPSAGON_FS_INSTRUMENTATION=true is requird. | init() {
if ((process.env.EPSAGON_FS_INSTRUMENTATION || '').toUpperCase() === 'TRUE') {
module_utils.patchSingle(fs, 'writeFile', () => wrapFsWriteFileFunction(fs.writeFile, 'writeFile'));
module_utils.patchSingle(fs, 'writeFileSync', () => wrapFsWriteFileFunction(fs.writeFileSync, 'writ... | [
"function swizzleRequestFileSystem() {\n console.log(\"Swizzling RFS...\");\n swizzles[\"RequestFileSystem\"] = window.RequestFileSystem;\n swizzles[\"webkitRequestFileSystem\"] = window.webkitRequestFileSystem;\n var RFSSwizzle = function (type, duration, callbackSuccess, callbackErr) {... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get the song cover to a blob | async getSongCoverToBlob(title, options = {}) {
return this.getSongToBlob(title, 'cover', options);
} | [
"async getSongCoverToBuffer(title, options = {}) {\n return this.getSongToBuffer(title, 'cover', options);\n }",
"async getAlbumCover() {\n var albumInfo = await resource.albumInfo();\n return albumInfo;\n }",
"async getCoverArt() {\n var coverArt = await resource.getAlbumImage()... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
makeHiddenWorld() Purpose: returns an Object3D containing the hidden world model, including: a large box that encompasses the user's view (giving the illusion of being surrounded by a forest) several forests, each containing several trees (one including a river) a group of three hills a mountain two tents an archeryMar... | function makeHiddenWorld (boxSize) {
initGlobals(boxSize);
var frame = new THREE.Object3D();
//containing box
var box = makeBox(boxSize, "sky.jpg", "forest.jpg", "forest_floor.jpg");
box.position.set(0, 0.5*boxSize, 0);
frame.add(box);
//Upper left forest
var ulForestWidth = 0.4*boxSize;
var ulForestHeight =... | [
"function createWorld() {\n if (debug)\n console.log(\"createWorld() called\")\n\n renderer.setClearColor(0x23157d); // Set background color\n scene = new THREE.Scene(); // Create a new scene which we can add objects to.\n \n // creates camera\n camera = new THREE.PerspectiveCam... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Updates a single project on beckend | function updateProject(project) {
return NuclioProjectsDataService.updateProject(project);
} | [
"onProjectUpdate(project) {}",
"async updateProject (context) {\n try {\n const project = await this.joinProject(context)\n return project\n } catch (err) {\n throw err\n }\n }",
"updateProject() {\n this.errorMessage = null;\n\n this.ProjectResource.update(this.project)\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
The function called when the theme button in the sample HTML is clicked. Parameter Values: simple cyber modern lovely pastel default default: Applies the default theme which is the basic design of KoolChart. | function KoolChartChangeTheme(theme){
document.getElementById("chart1").setTheme(theme);
} | [
"function defaultsClick() {\n Common.defaultSettings();\n setControlValues();\n Common.setTheme(document.getElementById('theme').value);\n}",
"function chooseTheme(){\n $('#color1').click(function(){\n themeTemplate(themeData, 0);\n });\n $('#color2').click(function(){\n themeTemplate(themeD... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Parse a Class Definition Table in a GSUB, GPOS or GDEF table. Returns a function that gets a class value from a glyph ID. | function parseClassDefTable(data, start) {
var p = new parse.Parser(data, start);
var format = p.parseUShort();
if (format === 1) {
// Format 1 specifies a range of consecutive glyph indices, one class per glyph ID.
var startGlyph = p.parseUShort();
var glyphCount = p.parseUShort();
... | [
"function parseClassDefTable(data, start) {\n var p = new parse.Parser(data, start);\n var format = p.parseUShort();\n if (format === 1) {\n // Format 1 specifies a range of consecutive glyph indices, one class per glyph ID.\n var startGlyph = p.parseUShort();\n var glyphCount = p.pars... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Updates Dataindex attributes of book divs. This function is meant to be called after deletion of a book which may cause books in library array to have new indexes. | function updateIndexAttributes(idx) {
let nodes = document.querySelectorAll('.bookCard')
if (nodes.length === 0 || idx === library.length - 1) {
return
}
for (let node of nodes) {
if (node.dataset.index > idx) {
node.dataset.index -= 1
}
}
} | [
"function updateBookNumbers ( book, index ) {\r\n book[bookNumberProperty] = index;\r\n}",
"function removeBook(e) {\n let i = document.getElementById('selected-book').dataset.index\n let div = document.querySelector(`div[data-index='${i}']`)\n\n div.remove();\n updateIndexAttributes(i)\n librar... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Set the assignment group information in chrome.storage.local | function updateAssignmentGroups() {
let names = document.querySelectorAll('div[data-fields=assignmentGroups] input[data-for=name]')
let sys = document.querySelectorAll('div[data-fields=assignmentGroups] input[data-for=sys]')
let groups = {}
for (let assignmentGroup in names) {
if (names[assignme... | [
"function saveGroupsLocally() {\n chrome.storage.local.set({groupList: groupList}, () => {\n console.log('[STORAGE] Saved group data to local storage');\n console.log({groupList: groupList});\n });\n}",
"function saveChromeData(){\n // Save it using the Chrome extension storage API.\n chr... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Update time remaining in game. change is subtracted from current time remaining. | function updateTimeRemaining(change) {
var timeRemainingElement = document.querySelector(".timer-count");
remainingTimeSeconds -= change;
timeRemainingElement.textContent = remainingTimeSeconds;
// if timerCount gets to 0, it will clear the timer and call function 'loseGame'
if (remainingTimeSecon... | [
"_updateRemainingTime() {\n if (this._remainingTime > 0) {\n this._remainingTime--;\n }\n }",
"_updateRemainingPauseTime() {\n if (this._remainingPauseTime > 0) {\n this._remainingPauseTime--;\n }\n }",
"function countDown() {\n if (_timeRemaining >... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function that takes the value from the input field and stores it in to the ranking list variable. If the value is null or empty string, an alert is triggered and the user is asked to enter a valid name. | function submitInfo() {
// Input
var name = divs.input_field.value;
// Check for empty name
if(name == '' || name == null) {
// Alert warning
alert("Please enter a valid name!");
}
else {
// Create a key-value pair and store it in the array
var tmp = {key: divs.input_field.value, value: info... | [
"function enterName() {\n let nameInput = $(\".nameInput\").val();\n if (nameInput == \"\") { \n $(\".alert\").show(); \n } else {\n $(\".enterScore\").hide();\n $(\".highScoreBox\").show();\n setScore();\n appendScore(); \... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Welcome. In this warmup you are required to, given a string, replace every letter with its position in the alphabet. If anything in the text isn't a letter, ignore it and don't return it. a being 1, b being 2, etc. As an example: alphabet_position("The sunset sets at twelve o' clock.") Should return "20 8 5 19 21 14 19... | function alphabetPosition(text) {
var alphabet = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'];
var position = '';
for(var i=0; i< text.length; i++) {
if(alphabet.includes(text[i].toLowerCase())) {
replace(alphabet.inde... | [
"function alphabetPosition(text) {\n text = text.toLowerCase().replace(/ /g, '').split('').join(' ')\n\n var position = [];\n var alphabet = \"abcdefghijklmnopqrstuvwxyz\".split('');\n var numbers = \"1234567890\".split('')\n\n numbers.forEach((element, index) => {\n text = text.replace(new RegExp(element, ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Unapplies a validation option filter. | function unapply() {
status.applied = false;
validationOptionElement.classList.remove("gallery-filter-button-selected");
} | [
"removeCustomValidationRule(){\n\nValidatorForm.removeValidationRule(\"onlyAlpha\");\nValidatorForm.removeValidationRule(\"gender\");\nValidatorForm.removeValidationRule(\"onlyAlphaAndSpace\");\nValidatorForm.removeValidationRule(\"onlyAlphaNumeric\");\nValidatorForm.removeValidationRule(\"dateFormat\");\nValidator... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns formatted cell value. | _formatCellValue(row, column, cell, value) {
if (value === undefined) {
value = row.data[column.dataField];
}
if (column.formatFunction) {
const settings = {
value: value,
row: row && row.data ? row.data.$.id : row,
... | [
"getFormattedCell(cellRef) {\n const val = this._getCellValue(cellRef);\n const cell = this.sheet.getCell(cellRef);\n const format = cell && cell.get('format');\n\n return format ? format.format(val) : val;\n }",
"function cellText(key, format, val) {\n if (isTimeColumn(key)) {\n let value = ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Copies sku to clipboard | function copyClipboard() {
const text = document.getElementById("copyThis").innerText.replace('SKU -', '').trim();
const textArea = document.createElement("textarea");
textArea.value = text;
// Avoid scrolling to bottom
textArea.style.top = "0";
textArea.style.left = "0";
textArea.style.pos... | [
"function copyToClipBoard(){\n navigator.clipboard.writeText(document.querySelector('#isbn_code').innerText);\n console.log(\"copy to clipboard\");\n}",
"function copyToClipboard() {\n // Lift the item's id to LinkForm\n onLinkCopy(itemObj.id);\n\n // Create temporary input field to cop... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Populate the mapping from paperID to the title from the specified input files and delimeter | function populateTitleToIdMap(paperIDFile, idToTitleFile, delimeter) {
var paperIDSubset = fs.readFileSync(paperIDFile, 'utf8').split('\n');
var paperIDAndTitle = fs.readFileSync(idToTitleFile, 'utf8').split('\n');
for (var i = 0; i < paperIDAndTitle.length; i++) {
var tokens = paperIDAndTitle[i].split(delime... | [
"interpretFile() {\n let value = '';\n let record = 1;\n\n do {\n value = this.getCellData('a',record);\n value = (typeof value === 'string') ? value.trim() : value;\n\n // maak een array met alle titel keys\n const titleKeys = Object.keys(this.fileTi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
save the current schedule to schedule.json :3 | function saveSchedule() {
fs.writeFile(__dirname + '/schedule.json', JSON.stringify(schedule), function (err) {
if (err) throw err;
console.log('Saved!');
});
} | [
"saveTodaysSchedule() {\n localStorage.setItem(\"SavedSchedule\", JSON.stringify(this.schedule));\n }",
"function saveSchedule(){\nlocalStorage.schedule = JSON.stringify(calArray);\n}",
"function saveSchedule() {\n clearStatusMessages();\n if (vm.schedule) {\n ScheduleS... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
InitScreen2: Initializes Screen 2 | function InitScreen2()
{
//
// Hide all the divs, except the one that displays connection status
//
RemoteControlLayer.style.visibility = "hidden";
RemoteControlObject.style.visibility = "visible";
ChatServerLayer.style.visibility = "hidden";
ConnectionProgressLayer.style.visibility = "visible";
Laye... | [
"function InitScreen2() \n{\t\n\tTraceFunctEnter(\"InitScreen2\");\n\t\n\t//\n\t// Decrypt RCTicket if necessary\n\t//\n\tif(true == g_oCurrentIncident.RCTicketEncrypted)\n\t{\n\t\t//\n\t\t// Decrypt RCTicket\n\t\t//\n\t\tif(false == DecryptRCTicket())\n\t\t{\n\t\t\t//\n\t\t\t// Invalid password. Re-enter\n\t\t\t//... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Layers to keep plot types in the right order. from back to front: 1. heatmaps, 2D histos and contour maps 2. bars / 1D histos 3. errorbars for bars and scatter 4. scatter 5. box plots | function plotLayers(svg) {
svg.append('g').classed('imagelayer', true);
svg.append('g').classed('maplayer', true);
svg.append('g').classed('barlayer', true);
svg.append('g').classed('boxlayer', true);
svg.append('g').classed('scatterlayer', true);
} | [
"function plotLayers(svg) {\n\t svg.append('g').classed('imagelayer', true);\n\t svg.append('g').classed('maplayer', true);\n\t svg.append('g').classed('barlayer', true);\n\t svg.append('g').classed('errorlayer', true);\n\t svg.append('g').classed('boxlayer', true);\n\t svg... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
TODO: Damping, or some other treatment for going past the ends. / A wheel event has been generated. This could be a real wheel event, or it could be fake (see notes in the header). This handler uses several strategies to try to approximate native trackpad swipe navigation. If the user has dragged enough to cause a navi... | function wheel(element, event) {
// Since we have a new wheel event, reset our timer waiting for the last
// wheel event to pass.
if (element._lastWheelTimeout) {
clearTimeout(element._lastWheelTimeout);
}
element._lastWheelTimeout = setTimeout(function () {
wheelTimedOut(element);
}, WHEEL_TIME);
... | [
"function handleWheel(component, event) {\n\n // Since we have a new wheel event, reset our timer waiting for the last\n // wheel event to pass.\n if (component[lastWheelTimeoutSymbol]) {\n clearTimeout(component[lastWheelTimeoutSymbol]);\n }\n component[lastWheelTimeoutSymbol] = setTimeout(() => {\n whe... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get rand user agent of array of user agents | randUserAgent() {
return USER_AGENTS[Math.floor(Math.random() * USER_AGENTS.length)];
} | [
"function getUserAgent () {\n return _userAgents[Math.ceil(Math.random()*_userAgents.length)-1];\n}",
"userAgent() {\n return _.sample(NETWORK.USER_AGENTS);\n }",
"getAgent() {\n return random_useragent_1.default.getRandom();\n }",
"function randomIndexForUA() {\n return Math.floor(Math.rand... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
specToggle function: run when button is clicked// | function specToggle() {
var spec = makeObject();
vert = spec.vertex;
flatNormz = spec.flatN;
smoothNormz = spec.smoothN;
ind = spec.index;
var tempF = spec.fcolor;
var tempS = spec.scolor;
if (specular === true) {
specular = false;
flatColor = tempF;
... | [
"handleToggle() {\n this.doToggle(false);\n }",
"clickRaceRunnerToggleOFF(){\n this.raceRunnerToggleOFF.waitForExist();\n this.raceRunnerToggleOFF.click();\n }",
"didToggle() {}",
"clickRaceRunnerToggleOFF(){\n this.raceRunnerToggleOFF.waitForExist();\n this.raceRunnerToggl... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
splits the private key into three seqments (almost) equal in size. For 32 byte Ethereum private keys, this will return 3 buffers containing 11, 11 and 10 bytes. | splitInto3Segments(key) {
const bytes = hexToBytes(key);
// we're going to split in 3 parts
let start = 0, end = 0;
let bufpart = [];
let partLen = Math.round(bytes.length / 3);
for (let i = 0; i < 3; i++) {
if (i === 2) {
// last element stor... | [
"splitPrivateKey(key) {\n let {keySegments, keyLength} = this.splitInto3Segments(key);\n\n // generate 3 random One Time Pad keys, at the length of one third of the private key length\n let pads = this.createOTPKeys(keyLength);\n\n keys = [\n this.makeSplitKey(PART_COMBINATION... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Testing for intersection between: 2D circle and 2D circle | function intersect_Circle_Circle (pSphereA, pSphereB) {
var rx = pSphereA.v2fCenter.X - pSphereB.v2fCenter.X;
var ry = pSphereA.v2fCenter.Y - pSphereB.v2fCenter.Y;
return (rx * rx + ry * ry) < (pSphereA.fRadius + pSphereB.fRadius);
} | [
"function collideCircle(a, b)\n{\n let x = a.x - b.x;\n let y = a.y - b.y;\n let r = (a.w / 2) + (b.w / 2)\n return (x * x) + (y * y) < (r * r);\n}",
"function twoCirclesIntersect(c1, c2){\n\tvar distance = Math.sqrt( Math.pow(c1.x - c2.x, 2) + Math.pow(c1.y - c2.y,2) );\n\t//console.log(\"comparing\"... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
returns selected week number in drop down | function getWeekNumFromDropdown() {
var dropdown = document.getElementById("dropdown");
return dropdown.options[dropdown.selectedIndex].value;
} | [
"function WDateChooser_selectWeek( week, dismiss, aDoc ) {\n var era = parseInt( this.getElementById( this.makeId(\"hideEra\") ).value );\n var year = parseInt( this.getElementById( this.makeId(\"hideYear\") ).value );\n var month = parseInt( this.getElementById( this.makeId(\"hideMonth\") ).value );\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
If autohide is enabled, start timer and prepare cancel function | function startAutoHide() {
var autoHideTimer, cancelAutoHide = angular.noop;
if (options.hideDelay) {
autoHideTimer = $timeout(service.hide, options.hideDelay) ;
cancelAutoHide = function() {
... | [
"function startAutoHide() {\r\n var autoHideTimer, cancelAutoHide = angular.noop;\r\n\r\n if (options.hideDelay) {\r\n autoHideTimer = $timeout(service.hide, options.hideDelay) ;\r\n cancelAutoHide = function() {\r\n $timeout.cancel(autoHideTimer);\r\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns the visible size of an element as a [ width, height ] tuple | getVisibleSize(_id) {
let _elem = this._elements[_id];
let [w, h] = [_elem.offsetWidth, _elem.offsetHeight];
let _parent = _elem.parentNode;
while (_parent && _parent.nodeName.toLowerCase() !== 'body') {
if (this._getComputedStyle(_parent, 'overflow') === 'visible') {
if (w > _parent.clien... | [
"function getElementSize(element) {\n return new Dimension(element.offsetWidth, element.offsetHeight);\n}",
"getElementSize() {\n const that = this;\n return { width: that.elementWidth, height: that.elementHeight };\n }",
"async getDimensions() {\n await this._stabilize();\n con... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Initialize client (technically a host) at port 0 (any free port that the OS feels like giving us). Max peers 128 Channels 1 Max up/down 256 Kbps Interval 17 ms | function initClient() {
client = new enet.Host(new enet.Address('localhost', 0), 128, 1, 256000, 256000, "client");
client.start(17); //17ms intervals
client.enableCompression(); //YES!! YES!!! COMPRESSION!!
console.log("ENet client initialized.");
} | [
"init() {\n // Setup event handlers for the socket\n this._setListeners(() => {\n // Check that connection limit is not exceeded\n if (this._server.options.maxClients && this._server.connections.size > this._server.options.maxClients) {\n return this.send(421, this... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns a boolean indicating if all calendars are readonly. | get all_readonly() {
let calMgr = cal.getCalendarManager();
return calMgr.readOnlyCalendarCount == calMgr.calendarCount;
} | [
"get all_local_calendars_readonly() {\n // We might want to speed this part up by keeping track of this in the\n // calendar manager.\n let calendars = cal.getCalendarManager().getCalendars();\n let count = calendars.length;\n for (let calendar of calendars) {\n if (!cal.acl.isCalendarWritable(c... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Helpers find an ldap user for a given device | function findLdapUser(device, fn) {
ldap.findUserForDevice(device, function(err, ldapUser) {
if (err) {
ldapUser = undefined;
//return fn(err, device, undefined);
}
fn(undefined, device, ldapUser);
});
} | [
"function findCascadeUser(device, ldapUser, fn) {\n var uid = ldapUser ? ldapUser.uid : undefined;\n User.find({\n where: ['uid=? OR nfcID=? OR usbSerial=?', uid, device, device],\n attributes: ['username', 'balance']\n })\n .error(function(err) {\n throw err;\n })\n .success(function(user) {\n re... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |