query stringlengths 9 34k | document stringlengths 8 5.39M | negatives listlengths 19 20 | metadata dict |
|---|---|---|---|
Utility function to consolidate the entries into a single note | function consolidate(entries) {
var note = {};
entries.forEach(function(entry) {
if(!note[entry.note_id])
note[entry.note_id] = {};
note[entry.note_id]['note_id'] = entry.note_id;
note[entry.note_id]['user'] = entry.user;
note[entry.note_id]['subject'] = entry.subject;
if(!note... | [
"function simplifyEntry(entry) {\n\tconst simpleEntry = [];\n\tfor (const rider of entry) {\n\t\tsimpleEntry.push(simplifyRiderName(rider));\n\t}\n\treturn simpleEntry;\n}",
"function formatNotes(data){\n\treturn data.map(commit =>\n\t\t`- [:information_source:](${commit.html_url}) - ${commit.commit.message} ${co... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Verify FTDC is already running if there was a path set at startup. | function verifyFTDCStartsWithPath() {
jsTestLog("Running verifyFTDCStartsWithPath");
verifyCommonFTDCParameters(admin2, true);
// 1. Set path fail
assert.commandFailed(setParam(admin2, {"diagnosticDataCollectionDirectoryPath": testPath2}));
// 2. Enable successfully
assert.commandWorked(setPar... | [
"function verifyFTDCDisabledOnStartup() {\n jsTestLog(\"Running verifyFTDCDisabledOnStartup\");\n verifyCommonFTDCParameters(admin1, false);\n\n // 1. Try to enable and fail\n assert.commandFailed(setParam(admin1, {\"diagnosticDataCollectionEnabled\": 1}));\n\n // 2. Set path and succeed\n assert.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Pushing a new task to the queue will attempt to run it unless the concurrency limit has been reached. The returned promise will resolve or reject when the task has succeeded or thrown an error. | push(task) {
return new Promise((resolve, reject) => {
_classPrivateFieldGet(this, _queue).push({
task,
resolve,
reject
});
this._dequeue();
});
} | [
"push(task, name) {\n return __awaiter(this, void 0, void 0, function* () {\n if (this.closed)\n throw new this.ClosedErrorClass('AwaitQueue closed');\n if (typeof task !== 'function')\n throw new TypeError('given task is not a function');\n if (... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
NHC Storm Archive Links //////////////////////////////////// return Best Track KMZ link for season (year) and storm_number | function getNHCBestTrackLink(nhc_season, nhc_number)
{
var results = [];
results.push( 'http://www.nhc.noaa.gov/gis/best_track/al' + nhc_number + nhc_season + '_best_track.kmz');
return results;
} | [
"function getNHCForecastsLinks(nhc_season, nhc_number, nhc_adv)\n{ \n var results = [];\n var nhc_kml = 'http://www.nhc.noaa.gov/storm_graphics/api/AL' + nhc_number + nhc_season + '_' + nhc_adv + 'adv_';\n // Forecast Track\n results.push(nhc_kml + 'TRACK.kmz');\n // Forecast Cone\n results.push(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Fetch payment centers with request to QueryBuilder, calculate a rough distance using haversine great circle calculation, sort by rough distance, weed out centers further than MAX_DISTANCE, then calculate an accurate distance with DistanceMatrix service, and, finally, append resulting centers to the DOM. | function getPaymentCenters(zip) {
var queryURI = "/bin/services/paymentcenters." + zip + ".json";
//console.log("Fetching locations from: ", queryURI);
$.getJSON(queryURI, function(data) {
$.each(data.locations, function(idx, pc) {
// Store unique... | [
"function getVisitorCenters(p, s, query) {\n\tvar txt = httpGet(\"https://developer.nps.gov/api/v1/visitorcenters?limit=200&parkCode=\" + p + \"&stateCode=\" + s + \"&q=\" + query + \"&api_key=qiwIVkT9FagdsHyhO3umyrCWj247FXAatbK65E7g\");\n\tvar obj = JSON.parse(txt);\n\tvar i;\n\tvar info = \"\";\n\n\t//Adds collap... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Store value in memory if not already there, then return location address | function getSetMem(node, sTable) {
if (/^[0-9]$/.test(node.name)) {
//Load single digit into Acc, then store
let addr = memManager.allocateStatic();
byteCode.push("A9", "0" + node.name, "8D", addr[0], addr[1]);
return addr;
}
else if (node.name ===... | [
"alloc(value) {\n if (value != undefined && value.address != undefined) {\n this.references[value.address]++;\n return value.address;\n }\n\n let address;\n // If there are free spaces in the array, fill them first\n if (this.freeAddresses.length > 0) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
create `errorhandler.js` file in middlewares folder | createErrorFile() {
// check if `errorhandler.js` file exists
if (!fs.existsSync(`${this.middleware}/errorhandler.js`)) {
const file = path.join(__dirname, '../files/errorhandler.js');
fs.readFile(file, "utf-8", (err, data) => {
if (err) {
console.log(err);
}
// w... | [
"enableErrorHandler() {\n /* Create an error handler */\n this.app.use( ErrorHandler );\n }",
"_setupMiddlewaresForErrorHandler() {\n\n this._app.use((req, res, next) => {\n\n logger.warn('URL: ' + req.originalUrl +\n ' Requester IP: ' + req.headers[\"x-forwarded-for\"] + ' hitting port: ' +... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Append a list item containing information about a job's runs. | function addBuildListItem(jobList, job, buildNumbers, hits, test) {
var jobEl = addElement(jobList, 'li', null, [sparkLineSVG(hits), ` ${buildNumbers.length} ${job} ${rightArrow}`,
createElement('p', {
style: {display: 'none'},
dataset: {job: job, test: test || '', buildNumbers: JSON.stringify(buildNu... | [
"_appendEndedJob() {\n this.recentJobs = this._cleanRecentJobs().concat([ new Date() ]);\n }",
"function onAddToList(job) {\n if (myStorage.getItem(job.id) == null) {\n myStorage.setItem(job.id, JSON.stringify(job));\n console.log(\"Added \" + job.id);\n }\n else {\n console.log(\"Error: Already a... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Uses the files table to do a findAll query | findAll(query) {
query = $.extend(query, { include: this.db.fileIncludes });
return this.sync.then((db) => db.File.findAll(query));
} | [
"static async getAllFiles() {\n try {\n return await database.File.findAll();\n } catch (error) {\n throw error;\n }\n }",
"getFiles() {\n return Resource.find({})\n }",
"async function getFiles() {\n return await File.find({}, { path: 0, owner: 0 });\n}",
"function getFiles(limit... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Open Cost Index transaction details | function showCostIndexTransDetails(context){
var costIndexTransId = context.row.getFieldValue("cost_tran_recur.cost_index_trans_id");
if (valueExistsNotEmpty(costIndexTransId)) {
var restriction = new Ab.view.Restriction();
restriction.addClause("cost_index_trans.cost_index_trans_id", costIndexTransId, "=");
Vi... | [
"getCurrentTransactionIndex() {\n return this.currentTransactionIndex;\n }",
"async getTransaction(indexOrHash) {\n // Find the internal value by its index or hash\n let tx = undefined;\n if (typeof (indexOrHash) === \"number\") {\n tx = this.#transactions[indexOrHash];\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
counts the number of answers that are skipped or has no answer | static countAnswered(items = [TestAnswer.structure]){
const filtered = items.filter((answer = {}) => (
(!answer.userAnswer ) ||
( answer.label === EXAM_LABELS.SKIPPPED)
));
return filtered.length;
} | [
"function countCorrectAnswers() {\n correctAnswers++;\n}",
"getNumberOfCorrectAnswers() {\n const answerArray = this.getCheckedAnswers();\n let numberOfCorrectAnswers = 0;\n\n answerArray.forEach(element => {\n if (element.correct) {\n numberOfCorrectAnswers++;\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get a list of hasmany relationships for this model | get hasMany() {
return this._hasMany;
} | [
"get manyToManyRelations() {\n return this.relations.filter(relation => relation.relationType === RelationTypes.MANY_TO_MANY);\n }",
"get manyToOneRelations() {\n return this.relations.filter(relation => relation.relationType === RelationTypes.MANY_TO_ONE);\n }",
"async getAllRelations() {\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Parse arguments and options from message and pass the resulting object into the specified handleMessage function. | handleMessage(message = '', ...args) {
const parsed = parseArgs(message, this.parseOptions);
parsed.text = message;
return super.handleMessage(parsed, ...args);
} | [
"function handleMessage(message) {\n //Check if the message is in the expected format\n if (!message.tool && !message._children) {\n console.error(\n \"Received a badly formatted message (no tool). \",\n message\n );\n }\n if (message.tool) messageForTool(message)... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
ALGO PONDERE SELECT , COUNT(`tmp`.`id`), (6371 ACOS(COS(RADIANS(48.792001)) COS(RADIANS(`latitude`)) COS(RADIANS(`longitude`) RADIANS(2.3985099999999875)) + SIN(RADIANS(48.792001)) SIN(RADIANS(`latitude`)))) AS `loc`, (1000 / LN((6371 ACOS(COS(RADIANS(48.792001)) COS(RADIANS(`latitude`)) COS(RADIANS(`longitude`) RADIAN... | async getAllUsers(orientation, filter, sort, tags, user_tags, user_position, reports){
try {
return new Promise((resolve, reject) => {
var location = "";
location = "(6371 * ACOS(COS(RADIANS(" + user_position[0].latitude + ")) * COS(RADIANS(`latitude`)) * COS(RADIANS(... | [
"function search(users, location) {\r\n\r\n var restaurants = getRestaurants(location);\r\n\r\n var likes = [];\r\n var dislikes = [];\r\n var allergies = [];\r\n\r\n //combine user criteria\r\n for (var j = 0; j < users.length; j++) {\r\n u = users[j];\r\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Have the function StockPicker(arr) take the array of numbers stored in arr which will contain integers that represent the amount in dollars that a single stock is worth, and return the maximum profit that could have been made by buying stock on day x and selling stock on day y where y > x. For example: if arr is [44, 3... | function StockPicker(arr) {
let maxProf = 0;
let profits = arr.map(function (currPrice, index) {
return arr.slice(index, arr.length)
.sort(function(a, b) { return b - a ;})[0] - currPrice;
});
maxProf = profits.sort( function(a,b) { return b - a ;})[0];
return (maxProf > 0) ? maxProf : -1;
} | [
"function maxProfit(arr){\r\n // Create a variable to store the values we want to return\r\n // Initialize the variable with the data from the first two days. We cannot\r\n // just set values to 0 because if a stock just decreases in value without\r\n // increasing, we will have values that don't reflect the da... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
updateMainlineLockGroup() Animates opacity of the mainlineLockGroup objects to a sine wave function, between 50 and 100% opacity | function updateMainlineLockGroup()
{
var mainlineLockGroup = svgDocument.getElementById("mainlineLockedGroup");
if(mainlineLockGroup.getAttribute("visibility") == "visible")
{
// if visible, animate opacity of the lock group
mainLockCounter = (mainLockCounter + 1) % mainLockMod;
mainlineLockGroup.setAtt... | [
"function updateMainlineStatus()\n{\n\tvar mainlineLockGroup = svgDocument.getElementById(\"mainlineLockedGroup\");\n\tvar mainlineTrackLayer = svgDocument.getElementById(\"mainlineTrackLayer\");\n\t\n\tif(mainlineLocked)\n\t{\n\t\tmainlineTrackLayer.setAttribute(\"style\", \"opacity:0.5\");\n\t\tmainlineTrackLayer... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
get_elems() requests stored input and form info from the extension if null is returned, calls find_elems to define inp and form and sends to extension to store in persistent memory if extensions returns legitimate inp and form start fuzzing loop | function get_elems(){
chrome.runtime.sendMessage({ask: "ask"}, function(response) {
inp = response.inp;
form = response.form;
//console.log(response, inp, form)
if(typeof inp === 'undefined'){
find_elems()
console.log('sending')
inp.val('sss')
chrome.runtime.sendMessage({recv: "store", in... | [
"function BOT_grepRequestComponents() {\r\n\tvar x,rel;\r\n\t\r\n\tBOT_theReqPerformative\t= null;\r\n\tBOT_theReqTopic\t\t\t= null;\r\n\tBOT_theReqAttribute\t\t= null;\r\n\tBOT_theReqAction\t\t= null;\r\n\tBOT_theReqValue\t\t\t= null;\r\n\tBOT_theReqStresser\t\t= null;\r\n\tBOT_theReqText\t\t\t= null; \r\n\tBOT_th... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
sends to the api the reservation details | function makeReservation() {
if (!isReadytoReserve(orderInfo)) {
return;
}
const promise = sendReservationRequest(orderInfo);
promise.then((response) => {
history.push(`/success/${id}`);
});
promise.catch((response) => {
alert("Algo deu errado. Tente novamente mais tarde.");... | [
"function AddReservation(info, reservations, tempObj) {\n console.log(\"AddReservation\");\n if (info.originalRequest.data.Body.toLowerCase() === \"no\") { return \"Reservation canceled.\"; }\n let clientNumber = utilities.CheckPhone(info.originalRequest.data.From.slice(1)); // This is where the clients ph... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
firstAction action undertaken on the first day | firstAction() {
return new Action.End(this.time);
} | [
"function startNewAction(){\n actionDate = Date.now();\n resetLocationWatch();\n resetWeatherQuery();\n return actionDate;\n }",
"actOnFirst(key, firstAction, nonFirstAction) {\n const numRefs = this.incRefCount(key);\n const isFirstRef = numRefs === 1;\n return isFirstRef ? firs... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns a grouping of data based on a data set's attribute. If groupBy is not defined returns the data nested as a single group. | function groupData(data, groupBy) {
return _.isUndefined(groupBy) ? { 'data': data } : _.groupBy(data, groupBy);
} | [
"function groupBy(data, group_by_field) {\n unique_group_by_field_values = [...new Set(data.map(result_row_response => {\n return result_row_response[group_by_field];\n }))];\n return unique_group_by_field_values.map(unique_group_by_field_value => {\n let filtered_data_results = data.filter(result_row_resp... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
create ProjectDef object for test all locales nlsDir folder containing locale source files | function projectCreateTestLocalesDef(nlsDir)
{
nlsDir = ReplaceMacros(nlsDir, cmnMacros);
if (typeof(this.arrLocales) == "undefined")
ProjectDef.prototype.arrLocales = initLocalesList(nlsDir);
var bindir = "$(SolutionDir)%CONFIG%\\bin";
var test = "sanity_test";
// creat... | [
"function projectCreateLocaleDefs(nlsDir)\r\n{\r\n nlsDir = ReplaceMacros(nlsDir, cmnMacros);\r\n\r\n if (typeof(this.arrLocales) == \"undefined\")\r\n ProjectDef.prototype.arrLocales = initLocalesList(nlsDir);\r\n \r\n var projectDefs = new Array();\r\n\r\n for (var i = 0; i < this.arrLoc... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Nombre : genera_tabla Descripcion : Genera tabla HTML dinamicamente Parametros : Parametro | Descripcion ===================================================== nombrecontenedor | Indica el nombre del contenedor donde sera mostrada la tabla | puede ser un DIV u otra TABLA nombretabla | Indica el id que se le asignara a l... | function genera_tabla(nombrecontenedor, nombretabla) {
//// Obtener la referencia del elemento body
//var body = document.getElementsByTagName("body")[0];
//// Crea un elemento <table> y un elemento <tbody>
//var tabla = document.createElement("table");
//var tblBody = document.createElement("tbody... | [
"function generarTablaEj (){\r\n buscarEjXNivDocEntrega();\r\n document.querySelector(\"#divEjalumnos\").innerHTML = `<table id=\"tabEjAlumno\" border='2px' style='background-color: #FA047F; position: relative;'>\r\n <th>Título</th><th>Docente</th><th>Nivel</th>`;\r\n for(let iterador = 0; iterador<= ej... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates a log driver configuration that sends log information to CloudWatch Logs. | static awsLogs(props) {
return new aws_log_driver_1.AwsLogDriver(props);
} | [
"function configureCloudwatchLogger(context) {\n logger.add(\n new WinstonCloudWatch({\n logGroupName: context.logGroupName,\n logStreamName: context.logStreamName,\n level: process.env.LOG_LEVEL,\n }),\n );\n}",
"static awsLogs(props) {\n try {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
FUNCTIONS ROOM JOIN / LEAVE / DISCONNECT / Join socket to an existing room, update user object & send room data which already exists. Sends the roomId, existing drawing data, and the users in the room. | function joinExisitingRoom({ roomId }) {
//Join room
socket.join(roomId);
// Update corressponding object in usersArray
updateUserRoom(socket, roomId);
// Send room data to socket
const drawingDataByRoom = getDrawingData().filter(
(dataObj) => dataObj.room === roomId
);
... | [
"function _joinRoom() {\n roomId = rooms[0].id;\n // Join the room\n socketInstance.post('/room/' + roomId + '/onlineUsers', { id: myChatId });\n }",
"function joinRoom(data,gServer,gClient){\n\t/*\n\t\tinput message json format\n\t\t[//remember rid start from 0 while frank... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Set up state for widgets on the form. This will ensure that widgets are set up correctly on the form, or on a part of the form. This will take care to reinitialize widgets if they've already been initialized before (useful when dynamically adding new sections of a form). This supports only a few known types of widgets ... | setupFormWidgets($el) {
if ($el === undefined) {
$el = this.$el;
}
/*
* Update some state for Django widgets. We've quite possibly made use
* of widgets in the form that need to be initialized, and Django
* doesn't have much fine-grained support for doing ... | [
"initializeWidgets(element) {\n if (element) {\n this.element = element;\n widgetInitializer({\n config: config.getConfig(\"widgets\"),\n breakpoints: config.getConfig(\"breakpoints\"),\n }, element);\n }\n }",
... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
getpixelcolour(x, y) returns the rgba value of the pixel at position x and y | function getpixelcolour(x, y) {
var pixels = ctx.getImageData(0, 0, canvas.width, canvas.height);
var index = ((y * (pixels.width * 4)) + (x * 4));
return {
r: pixels.data[index],
g: pixels.data[index + 1],
b: pixels.data[index + 2],
a: pixels.data[index + 3]
};
} | [
"function getPixelColor(x, y) {\n\tvar canvas = document.getElementById('World');\n\tvar ctx = canvas.getContext('2d');\n\t// get color of pixel\n\tdata = ctx.getImageData(x, y, 1, 1).data;\n\t// build hex string from extracted data\n\treturn data[0].toString(16).padStart(2, '0') + data[1].toString(16).padStart(2, ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
renders image as background for image_node, enables cycling opacity on mouse clicks width and height used for console output, to help developer change window size to specified size | function render_image(path, width, height) {
if ( image_node_appended === false ) {
parent.appendChild(image_node);
image_node_appended = true;
}
style_properties['padding'] = '0';
style_properties['opacity'] = opacity;
if ( height ) style_properties['min-height'] = height + 'px';
... | [
"showImage() {\n\n image(this.screm, this.x, this.y, this.r, this.r);\n\n }",
"showBackgroundImage( )\n\t\t{\n\n\t\t}",
"display() {\n push();\n imageMode(CENTER);\n image(this.image, this.x, this.y);\n pop();\n }",
"display(){\n image(alienImage, this.x, this.y, this.size, this.size);\n\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
exported FunctionNumberLineAxis / global explorableGroup / global d3 | function FunctionNumberLineAxis(options) {
let axis,
axisDefinition,
axisLocation,
axisType,
coordinates,
parent,
tickCount;
axis = this;
init(options);
return axis;
/* INITIALIZER */
function init(options) {
_required(options);
_defaults(options);
axis.group = addG... | [
"function ExplorableNumberlineAxis(options) {\n let axis,\n axisDefinition,\n axisType,\n color,\n coordinates,\n fontFamily,\n fontSize,\n fontWeight,\n scale,\n tickOffset,\n tickSize,\n where;\n\n axis = this;\n\n init(options);\n\n return axis;\n\n function init(options) {\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
draws all graphic elements of the ListElement instance, cycles the items, draw them and computes positions | drawElements() {
super.drawElements();
this.settings.path('items', []).each((item, i) => {
const listItem = new ListItemElement(this.settings.item.inherit(true, {
indicator: this.settings.indicator,
events: this.settings.itemEvents,
}, item, {
parent: this,
align: 'l... | [
"draw() {\n this.context.clearRect(0, 0, this.width, this.height);\n this.drawGridlines();\n for (let i = 0; i < this.items.length; i += 1) {\n const item = this.items[i];\n this.context.save();\n this.context.translate(item.location.x, item.location.y)\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
2 POST long hand: /one | function postToOne(){
var url = "http://localhost:3000/test/one";
fetch(url, {
method: 'POST',
headers: new Headers({ //1--fetch the url. the route in the server handles a POST request, so our method is POST
'Content-Type': 'application/json'
})
}).then(
... | [
"function postToOne(){\n var url = 'http://localhost:3000/test/one';\n\n fetch(url, {\n method: 'POST', //fetching the url, route handles a post request so our method type is post - two must match\n headers: new Headers({\n 'Content-Type': 'application/json'\n })\n }).then(\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
returns whether site is blocked by user | function isBlockedSite(url){
var domain = url.replace(/^(ht|f)tps?:\/\/(www\.)?/, ""),
arr = Data.blockedSites, regex;
for(var i = 0, len = arr.length; i < len; i++){
regex = new RegExp("^" + escapeRegExp(arr[i]));
if(regex.test(domain)) return true;
}
return false;
} | [
"function _isBlocked() {\r\n var isblock = $.blockUI.IsPageBlocked();\r\n return isblock == null ? false : true;\r\n }",
"async isBlockable() {\n if (!this.url.includes('.')) {\n return false\n }\n\n return new Promise((resolve) => {\n chrome.storage.loc... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Removes all whitespace characters from s. Global variable whitespace defines which characters are considered whitespace. | function stripWhitespace(s){
return stripCharsInBag(s, whitespace);
} | [
"function stripWhitespace (s)\r\n{\r\n\treturn stripCharsInBag(s, whitespace);\r\n}",
"function stripWhitespace(s) {\r\n return stripCharsInBag(s, whitespace);\r\n}",
"function stripWhitespace (s)\r\n\r\n{ return stripCharsInBag (s, whitespace)\r\n}",
"function stripWhitespace (s)\n\n{ return stripCharsI... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Serves a static directory at a baseurl and resolves when listening. | async serve(staticDir, baseUrl) {
let http = require('http');
let serve = require('serve-handler');
return new Promise(resolve => {
this.server = http.createServer((req, res) => {
serve(req, res, {
public: staticDir
});
}).listen(() => {
let {
port
... | [
"async serve(staticDir, baseUrl) {\n let http = require('http');\n let serve = require('serve-handler');\n\n return new Promise(resolve => {\n this.server = http.createServer((req, res) => {\n serve(req, res, { public: staticDir });\n }).listen(() => {\n let { port } = this.server.a... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates a Pageview tag with the default value for Page ID. Format of Page ID is "x/y/z/MyPage.asp" returns nothing, causes a document.write of an image request for this tag. | function cmCreateDefaultPageviewTag(categoryID) {
cmCreatePageviewTag(cmGetDefaultPageID(), categoryID, null);
} | [
"function cmCreateDefaultPageviewTag() {\n\tcmCreatePageviewTag(getDefaultPageID(), null, null);\n}",
"function cmCreateDefaultPageviewTag(categoryID) {\r\n\tcmCreatePageviewTag(cmGetDefaultPageID(), categoryID);\r\n}",
"function cmCreateManualPageviewTag(pageID, categoryID,DestinationURL,ReferringURL) {\r\n\tc... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Spawns all the timers needed for the bot | function spawn_timers(client) {
// reminders
function reminders() {
(async () => {
var reminders = await getReminders();
var writeToFile = false;
for (var msgId in reminders) {
var reminder = reminders[msgId];
await new Promise(next => {
if (Date.now() >= reminder.tick) { // reminder ... | [
"start() {\n\t\t// use this to give the functions the parameter of this tamagotchi\n\t\thungerTimer(this);\n\t\tsickTimer(this);\n\t\tyawnTimer(this);\n\t}",
"function setTimers() {\n // Setting Timer\n console.log(\"Setting timers....\");\n timeoutLaunch = setTimeout(clearLaunch, timeOut);\n timeoutL... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sort by 2nd value | function sortBySecondVal(a, b) {
if (a[1] < b[1]) return -1;
if (a[1] > b[1]) return 1;
return 0;
} | [
"function sortByNumberTwoDescending(first, second){\n\treturn second.numberTwo - first.numberTwo;\n}",
"sorting(value1, value2) {\r\n if (value1.price < value2.price) {\r\n return -1;\r\n } else if (value1.price > value2.price) {\r\n return 1;\r\n } else {\r\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Just a saved unassociated parent. | savedParent() {
let insertedParent = this.db.users.insert({ name: "Bob" });
return this.schema.users.find(insertedParent.id);
} | [
"setParent(parent) {\n this.parent = parent;\n }",
"setParent(parent) {\n this._parent = parent;\n }",
"setParent(parent) {\n this.parent = parent;\n }",
"setParent(node) {\r\n parent = node\r\n }",
"setParent(parent) {\n this.parent = parent;\n this.parent.addChild(t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Computes all variables needed to draw on the canvas (for example, the positions of each derivation) | computeVariables() {
let variables = {};
// Compute the width and height of a derivation
variables.derivation = {
width: parseInt( (this.canvas.width - 4 * this.state().ecgDisplay.horizontalMargin)/2 ),
height: parseInt( (this.canvas.height - 2 * this.state().ecgDisplay.verticalMargin)/6)
};
// Define ... | [
"calcParams() {\n this.avgX = this.avgxs();\n this.avgY = this.avgys();\n\n let sumXY = 0, sumXsq = 0;\n for (let i = 0; i < this.numPts; i++) {\n sumXY += this.Xs[i] * this.Ys[i];\n sumXsq += this.Xs[i] * this.Xs[i];\n }\n this.beta = (sumXY - this.nu... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Determining a random spawn location on the grid. | function randomSpawnLocation(width, height, tileSize) {
let xPos;
let yPos;
// Breaking the entire canvas into a grid of tiles.
let rows = width / tileSize;
let cols = height / tileSize;
xPos = Math.floor(Math.random() * rows) * tileSize;
yPos = Math.floor(Math.random() * 0.5*cols) * ... | [
"function spawnLocation() {\n //Breaking the entire canvas into a grid of tiles\n let rows = width / tileSize;\n let cols = height / tileSize;\n\n let xPos, yPos;\n\n xPos = Math.floor(Math.random() * rows) * tileSize;\n yPos = Math.floor(Math.random() * cols) * tileSize;\n return { x: xPos, y:... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get the last saved song from local storage. The callback will only be called if one exists. | function getLastSong(cb) {
if (!settings.saveLastPosition) return false;
chromeLocalStorage.get(null, function(items) {
if (items.lastSong) {
var lastSong = {
info: items.lastSong,
position: items.lastPosition,
positionSec: parseSeconds(items.lastPosition),
... | [
"async getlasttrack() {\n const recent = await this.getrecenttracks();\n const current = await this.getcurrenttrack();\n\n if (current) {\n return recent.track[1];\n } else {\n return recent.track[0];\n }\n }",
"function fetchLastStation() {\n\tlastStation = localStorage['lastStation'];\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
getIgnoreKeywords_spaces() Get spaces to ignore. For example: (weird UTF8 spaces) | function getIgnoreKeywords_spaces() {
return [
'',
'',
];
} | [
"function getIgnoreKeywords_dashReplaceSpaces(args) {\n\t\tvar symbols = args.symbols;\n\t\t\n\t\tvar dashreplacedsymbols = [];\n\t\t\n\t\tfor(var i = 0; i < symbols.length; i++) {\n\t\t\tvar symbol = symbols[i];\n\t\t\tvar newsymbol = symbol.replace(/ /g, '-');\n\t\t\t\n\t\t\tif(symbol !== newsymbol) {\n\t\t\t\tda... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
getFormContent Return form label content | getFormLabelContent() {
if (this.props.textDictionary.labelText && this.props.textDictionary.labelText.length !== 0) {
return (
<label className={ClassNameUtil.getClassNames(['fbra_passwordFormInput_label', 'fbra_test_passwordFormInput_label'])}>{this.props.textDictionary.labelText}</label>
);
}
return ... | [
"render() {\n const labelElement = document.createElement(\"label\");\n labelElement.setAttribute(\"for\", this.forField);\n labelElement.textContent = this.content;\n\n return labelElement;\n }",
"function cformGetLabel(elem) {\n\tvar retVal = '';\n\tvar labelid = elem.name + ':label';\n\t\n\tlabelO... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
translate Arrayed buffer to text string | function ab2t_(buffer /* ArrayBuffer */) {
var arr = new Int8Array(buffer);
var str = "";
for(var i = 0, l = arr.length; i < l; i++) {
str += String.fromCharCode.call(this, arr[i]);
}
console.log(str);
return str;
} | [
"function arrayBuffer2Text(buffer /* ArrayBuffer */ ) {\n var dataView = new DataView(buffer);\n var decoder = new TextDecoder('utf-8');\n return decoder.decode(dataView);\n}",
"function arrayBufferToString(buf) {\n return String.fromCharCode.apply(null, new Uint16Array(buf));\n }",
"function... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
returns the columnName appending with the schema name. | getColumnName(store, fieldName) {
if (store.fieldToColumnMapping[fieldName]) {
const columnName = this.escapeName(store.fieldToColumnMapping[fieldName]);
if (columnName.indexOf('.') < 0) {
return this.escapeName(store.entitySchema.name) + '.' + columnName;
}
... | [
"function generateColumnName(name) {\n name = name || 'Column ';\n var headers = getColumns();\n var columnName = name + '(' + columnNameCounter + ')';\n columnNameCounter = columnNameCounter + 1;\n return headers.indexOf(columnName) > -1\n ? generateColumnName()\n : columnName;\n }",
"funct... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
create and display logo (topright) | function createLogo() {
logo = new createjs.Bitmap("logo.png");
//logo.y = 1;
stage.addChild(logo);
} | [
"function logo() {\n \t\tSDLogo = new image(DEMO_ROOT + \"/def/resources/logo.gif\");\t\t\t// Get logo\n \t\tSDLogoScreen = SeniorDads.ScreenHandler.Codef(\t\t\t\t\t\t// Set up canvas for logo\n \t\t\t\tSDLogo.img.width,\n \t\t\t\tSDLogo.img.height,\n \t\t\t\tname, zIndex++, \n \t\t\t\t320 - (SDLo... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
managing the datatable in a popup window for better experience | function openDataTableInOtherWindow() {
//close the panel if already existing
if (panel) { panel.close(); }
panel = window.open("Scripts/Spreadsheet/propertyTable.html");
//panel.addEventListener('load', onPanelLoad, false);
panel[panel.addEventListener ? 'addEventListener' : 'attachEvent'](
... | [
"function showData() {\n /* create the table for the data */\n var sData = '<table border=1>';\n sData += '<thead>';\n sData += '<tr>';\n sData += '<th>E</th><th>Data</th><th>Value</th>';\n sData += '</tr>';\n sData += '</thead><tbody>';\n for (sdCur = sdList; sdCur != null; sdCur = sdCur.ne... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
i really hope this is fine update the copy of the board after the first action | update_board(copy_board, action) {
if (action.type == 'c') {
copy_board[action.y1][action.x1].no_soldiers++;
// If move action
} else {
copy_board[action.y1][action.x1].no_soldiers--;
if(copy_board[action.y2][action.x2].faction != this.faction ) {
... | [
"function saveBoard() {\n tempBoard = ctrl.board.map(function(arr) { return arr.slice(); });\n }",
"logMove (thisMove) {\n \n let col = thisMove.column;\n let row = thisMove.row;\n \n //copy the current board\n let newBoard = JSON.parse(JSON.stringify(this.state.board)); \n \n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Print arguments to stdout. Like Python's print, separates arguments with spaces. No trailing newline. | function print () {
var msg = _.toArray(arguments).join(' ')
process.stdout.write(msg)
} | [
"function print() {\n for( var i = 0; i < arguments.length; i++ ) {\n shell.print( arguments[i] );\n shell.print( ' ' );\n }\n shell.println();\n}",
"function println () {\n var msg = _.toArray(arguments).join(' ') + '\\n'\n process.stdout.write(msg)\n}",
"function printer() {\n for (v... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Handles the end of the undo animation by removing the extraneous end tile. | function undoAnimationDone() {
isUndoing = false;
tiles.splice(tiles.length - 1, 1);
removeNode(tilesContainer.lastElementChild);
updateTileVisibility(numTilesShown);
lastBlacklistedTile.elem.removeEventListener(
'webkitTransitionEnd', undoAnimationDone);
} | [
"undo() {\n if (this.canUndo()) {\n this.shouldSaveHistory = false;\n const { index, state } = this.stack[(this.position -= 1)];\n this.onUpdate();\n\n this.editor.blocks.render({ blocks: state }).then(() => this.editor.caret.setToBlock(index, \"end\"));\n }\n }",
"function undo() {\n\t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
copies pixel info from origin(x,y) > dest(x,y) | function copyPix(originX,originY,destX,destY) {
var origin = (originY * img.width + originX) * 4; //convert to 1D pixels index
var dest = (destY * img.width + destX) * 4;//convert to 1D pixels index
pixels[dest] = pixels[origin];
pixels[dest+1] = pixels[origin+1];
pixels[dest+2] = pixels[origin+2];
pixels[d... | [
"function copyPix(originX, originY, destX, destY) {\n var origin = (originY * canvas.width + originX) * 4; //convert to 1D pixels index\n var dest = (destY * width + destX) * 4; //convert to 1D pixels index\n pixels[dest] = pixels[origin];\n pixels[dest + 1] = pixels[origin + 1];\n pixels[dest + 2] =... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Capture the state of the user interface (UI) // and send it to the database // | function captureUIState(){
console.log('********************************');
console.log('* clientAp: capturing UI state *');
console.log('********************************');
console.log('clientAp: curSisbot: ',vm.curSisbot);
// update the state object from UI inputs
... | [
"function updateUI()\n{\n\tvar stateSend = getDifferent(homeStateNew, homeState);\n\tif (stateSend !== undefined) {\n\t\tawsClient.send(stateSend);\n\t\twebSocket.send(stateSend);\n\t}\t\n}",
"function UIState() {}",
"function displayUIdata(){\r\n console.log('clientApp: displaying state on UI');\r\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
filter and get only first 10 cards if allLowestCard is enabled, return the card with lowest bidding value | function getFilteredCards(allCards) {
if (!allCards || allCards === null)
return [];
var topTenCards = [];
var count = 0;
var min = allHealthCards.hasMin('default_bid');
for (count = 0; count < allCards.length; count++)... | [
"getMinPrice(val){\n const sizeDetails = this.props.details.sizes[val];\n const min = sizeDetails.sources.reduce((prev, current) => (Number(prev.discounted_price) > Number(current.discounted_price)) ? current : prev);\n return min;\n }",
"function best_lowest_card(player_cards, ai_cards)\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
canvasarray is the array that holds the canvases is the canvas that is to zoomed on currentscale is an int that gives the current scale: ie a 1, 1.1 | function zoom(canvasarray, zoomlevel, currentscale) {
for(i = 0; i < canvasarray.layers.length; i++) {
var zoom = document.getElementById(canvasarray.layers[i].id); //to make it work with all browsers
zoom.style.transform = "scale(" currentscale+zoomlevel + ")";
zoom.style.["-o-transform"] = "scale(" curren... | [
"function scaleCanvas() {\r\n\t\tvar ctx = $['mapsettings'].ctx;\r\n\t\tvar scalevalue = new Point(1,1);\r\n\t\tvar scale = getRelativeScale($['mapsettings'].zoom);\t\r\n\t\tscale.x = scale.x * scalevalue.x;\r\n\t\tscale.y = scale.y * scalevalue.y;\r\n\t\t$['mapsettings'].scale = scale;\r\n\t}",
"function scaleCa... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
[createWorkflow] init node status disconnect nodes which connected | function createWorkflow() {
reinitNodeCache();
} | [
"function callbackCreateNode(result) {\n console.log(\"callbackCreateNode\");\n console.log(result);\n console.log(result.ticketsCount);\n //$(\".item\").last().attr(\"id\", result.id);\n getWorkflowForArray(projectId);\n\n // Add new node to Workflow\n $('.bgRaster').append('<div id=\"' + resu... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This is a function for snippetsGet / Returns all snippets. Like pull requests, repositories and teams, the full set of snippets is defined by what the current user has access to. This includes all snippets owned by the current user, but also all snippets owned by any of the teams the user is a member of, or snippets by... | snippetsGet(incomingOptions, cb) {
const Bitbucket = require('./dist');
let defaultClient = Bitbucket.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications['api_key'];
api_key.apiKey = incomingOptions.apiKey;
// Uncomment the following line t... | [
"function listSnippets() {\n\t\t$http.get('rest/snippets').success(function(snippets) {\n\t\t\t$scope.snippets = snippets;\n\t\t}).error(function(result) {\n\t\t\tconsole.log(result);\n\t\t\talert('Could not get snippets');\n\t\t});\n\t}",
"function getSnippets() {\n\t\t$http.get('rest/snippets').success(function... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
listen for when user enters input to search for artist | function listen(){
$(`#search-btn`).click(event =>{
event.preventDefault();
const searchArtist = $('.search').val();
const userText = $(`.search-form`).find(`.search`);
if($('.search').val() == ''){
alert('You did not enter an artist');
return false;
} else {
document.getElementById('container')... | [
"handleSearchChange(e) {\n SearchArtistActions.searchArtists(e.target.value);\n }",
"function artistSearch() {\n let userInput = id(\"artist-query\").value;\n if (userInput.includes(\" \")) {\n userInput = userInput.replace(\" \", \"_\");\n }\n let apiURL = BASE_URL + \"artist.search?q_artist... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
get week period Ajax calling | function getWeeks()
{
var yearListObj = document.getElementById('yearLB');
var yearListval = yearListObj.options[ yearListObj.selectedIndex ].value;
var year = yearListval.split( "-" )[0] ;
var yearList = "" ;
var yearLB = document.getElementById("yearLB");
for(k = 0; k < yearLB.options.length; k++)
{
... | [
"function requestWeek() {\n\tvar calendarIds = [];\n\t$.each($('input[name=\"calendar\"]:checked'), function() {\n\t\tcalendarIds.push($(this).val());\n\t});\n\tvar weekOf = $(\"#controls\").children('input[name=\"viewingWeek\"]').val();\n\tweekOf = moment(weekOf).format(\"M/D/YYYY\");\n\n\tstompClient.send(\"/app/... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Walk nodes (depthfirst, preorder) searching for accessible text. Children hidden from accessibility tree are ignored. For each node the current conditions satisfies as accessible text: Nonempty or dynamic `arialabel` Nonempty or dynamic `arialabelledby` (reference not validated, use [[nomissingreferences]] Image with n... | function haveAccessibleText(node) {
if (!inAccessibilityTree(node)) {
return false;
}
/* check direct descendants for non-empty or dynamic text */
const haveText = node.childNodes.some((child) => isNonEmptyText(child));
if (haveText) {
return true;
}
if (hasNonEmptyAttribute(... | [
"function haveAccessibleText(node) {\n if (!a17y_1.inAccessibilityTree(node)) {\n return false;\n }\n /* check direct descendants for non-empty or dynamic text */\n const haveText = node.childNodes.some((child) => isNonEmptyText(child));\n if (haveText) {\n return true;\n }\n if (... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
function:activeSearchBtn(btnObj) purpose:Active search button parameters :Object of button return value : | function activeSearchBtn(btnObj)
{
btnObj.children(0).className = "";
btnObj.disabled = false;
return false;
} | [
"function inactiveSearchBtn(btnObj)\r\n{\r\n\tbtnObj.children(0).className = \"Inactive\";\r\n\tbtnObj.disabled = true;\r\n\treturn false;\r\n}",
"searchButtonClicked() {}",
"function btnSearch(){\n\n var btnName = $(this).attr(\"data-name\");\n\n getGiphy(btnName);\n }",
"get searchBtn() {\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Prepare URL for [url] and [img] bbcodes | function prepare_url(url)
{
if (!url) return '';
url = url.replace('[', '%5B').replace(']', '%5D');
if (url.charAt(0) == '/' && url.charAt(1) == '/') return 'http:' + url;
if (url.match(/^[\w\d]+(\.php|\/|$)/i)) return './' + url;
if (!url.match(/^[\w\d]+:/i) && !url.match(/^[.]?\//i)) return 'http://' + url;
ret... | [
"function immatureUrl() {\n\t\t\tif(this.nodeType==3) {\n\t\t\t\tvar text = $(this).text();\n\t\t\t\ttext = text.replace(regex_part_url, function(match, p1, p2, p3) {\n\t\t\t\t\tvar url = 'ht'+p1+p2+p3;\n\t\t\t\t\treturn '<a href=\"'+url+'\" title=\"'+url+'\">'+match+'</a>';\n\t\t\t\t});\n\t\t\t\t$(this).before(tex... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
/ Helper method for just handling dynamicstatic collider contact pairs. | ProcessContacts()
{
for(let contact of this.#Contacts)
{
let depen = this.Depenetrate(contact);
let trans = contact.ColA.GetComponent(WorldPos);
trans.Translate(depen);
let body = contact.ColA.GetComponent(Rigidbody);
if(body != null)
body.NegateVelocity(contact.Normal.Mul(-1));
//else throw ... | [
"static get showColliderContacts() {}",
"static set showColliderContacts(value) {}",
"static get colliderContactColor() {}",
"onPreSolve(contact, selfCollider, otherCollider) {\n }",
"static set colliderContactColor(value) {}",
"createCollider(_scale, _colliderType) {\n let shapeConf = new OIM... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
CONCATENATED MODULE: ./src/typedjson/jsonmapmember.ts Specifies that the property is part of the object when serializing. Use this decorator on properties of type Map. | function jsonMapMember(keyConstructor, valueConstructor, options) {
if (options === void 0) { options = {}; }
return function (target, propKey) {
var decoratorName = "@jsonMapMember on " + nameof(target.constructor) + "." + String(propKey); // For error messages.
if (typeof keyConstructor !== "f... | [
"get map() {\n return this._json\n }",
"function hasProperty(map,key){return hasOwnProperty.call(map,key);}",
"function ObjectWithMap(){\r\n\t\r\n\tthis.map = (func) => {\r\n\t\t\r\n\t\tfor (let i in this){\r\n\t\t\tif(i != 'map') this[i] = func(this[i]);\r\n\t\t}\r\n\t\t\r\n\t}\r\n}",
"function hasProper... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Update High Priority tasks when opened | function updateHighP(){
let hPrior = [];
/* Keeps a track of high prior tasks in sync with server to allow changes or etc */
let hTracker = [];
/* Loop through all tasks to find tasks with high priority */
for(let i = 1; i < rData.length; i++){
if(rData[i].taskPriority === "hp"){
... | [
"function updateLowP(){\n let lPrior = [];\n\n /* Keeps a track of low prior tasks in sync with server to allow changes or etc */\n let lTracker = [];\n \n /* Loop through all tasks to find all tasks with low priority */\n for(let i = 1; i < rData.length; i++){\n if(rData[i].taskPriority ==... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Preview Slide Processes the Preview Slide deck. This function loads the elements of the slide deck into an object. It then iterates through them to find the one the user clicked. Once found it sets the slide preview to that specific slide and then buffers it in the hidden iFrame. It will check whether the next slide is... | function previewSlide(clicked_id)
{
var index = 0; //Tracks the position of the next slide in the slide deck
var nextFileValidity = "valid"; //Tracks the whether or not a file is safe to load
var delay = 200; //The delay, in MS, before buffering the next slide
var filePosition = 0; //T... | [
"function startPresentation()\r\n{\r\n\tvar delay = 200;\t\t\t\t\t\t\t\t//The delay, in MS, before buffering the next slide\r\n\tvar index = 0;\t\t\t\t\t\t\t\t\t//Tracks the position of the next slide in the slide deck\r\n\r\n\t//Show elements\r\n\t$(\"#transitionDiv\").show();\r\n\t$(\"#currentSlideHeading\").show... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
getting temperature data from api | function getTemperature(tempUnits){
$.getJSON(api, function(data){
if (tempUnits =="celsius"){
var tempSulfix = "C";
var temp = (data.current.temp_c);
var feelslike = (data.current.feelslike_c);
}
else if (tempUnits == "farenhei... | [
"function getTemperatureData() {\n retrieveTemperatureDataV2();\n temperatureDataTimer = $interval(retrieveTemperatureDataV2, C.INTERVAL.TEMPERATURE_DATA * 1000);\n }",
"function getTemp(lat, lon) {\n //local variables\n let apiKey = `f655251e7aa74c3031f8eb126912bec6`;\n let apiUrl... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
generate earthquate layer add earthquake data | function create_Earthquake_Layer(eq_data){
var earthquakeLayer = L.geoJson(eq_data.features, {
pointToLayer: function (feature, latlng) {
return L.circleMarker(latlng,
{
radius: markerSize(+feature.properties.mag),
fillColor: markerCol... | [
"function addEarthquakeData(pMap, pEarthquakeLayer, pEarthquakeData) {\n \n // Add a GeoJSON layer for earthquakes to the map once\n \n // List of earthquakes and style for adding to map\n var earthquakes = L.geoJson(pEarthquakeData, { \n // Add circle marker for each feature in the data\n pointToLa... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Write the transmit payload The size of data written is the fixed payload size, see getPayloadSize() | function write_payload(bufIn, writeType, callback) {
var data_len = Math.min(bufIn.length, payload_size);
//printf("[Writing %u bytes %u blanks]",data_len,blank_len);
var buf = new Buffer(1 + data_len);
buf[0] = writeType;
for (var i = 0; i < bufIn.length; i++) {
... | [
"function write_payload(buf, len, writeType) {\n //TODO\n\n }",
"function writeHeaderAndPayload() {\n if (header.length) {\n buffer.writeUInt16BE(header.length, position);\n position = position + SIZE.INT16;\n position = position + header.copy(buff... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Renders the MFS parse tree to the canvas. Note that only a subset of MFS is currently supported: text, symbol, style (except overbar), superscript, subscript, and horizontal nodes. | function renderMFSParseTree(ctx, node, iFontSpec) {
var visitMap = {},
renderBounds = { left: x, top: y, right: x, bottom: y };
function visit(node, iFontSpec) {
var fn;
fn = visitMap[node.type];
if (fn) {
... | [
"render() {\n /*Renders the canvas along with Nodes and edges*/\n var html = `<table style='height:100%; width: 100%'>\n <tr>\n <td style='width: 95%'>`;\n //An outer div for SVG canvas\n html +=\n \"<div id='\" + this.id + \"' style... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create a new channel by sending a POST request to the API After a new channel is created, the server will emit channel_update to all clients, causing an channel list update | function createChannel(channelName) {
const request = new XMLHttpRequest();
request.open('POST', `/channels`);
request.onreadystatechange = () => {
if (request.readyState === 4) {
if (request.status === 200) {
selectors.channelAlreadyExistsAlert.hide();
s... | [
"function post_new_channel() {\n const request = new XMLHttpRequest();\n const channel_name = document.querySelector('#channel_entry').value;\n request.open('POST', '/create-channel');\n\n request.onload = () => {\n location.reload();\n };\n const data = new FormData();\n data.append('channel_name', cha... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create Cesium primitives for the OpenLayers vector layer. | createLayerPrimitives_() {
asserts.assertInstanceof(this.layer, OLVectorLayer);
asserts.assert(this.view !== null);
this.csContext = this.createVectorContext(this.layer, this.view);
this.onLayerVisibility_();
if (this.csContext) {
this.initializePrimitives_(this.source.getFeatures());
... | [
"addVectorLayer() {\n const vectorSource = this.getVectorSource();\n const layer = new VectorLayer({\n source: vectorSource\n });\n this.props.objInput.map.addLayer(layer);\n }",
"_vector (name, source) {\n let layer = new openlayers.layer.Vector()\n layer.set('name', name)\n layer.setS... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Upon starting the App, 3 prompts are generated asking for the name of each of the 3 teams. If no name is input the default name Team 1, Team 2 or Team 3 is used. | function getTeamNames(){
let teamNames = []
let team1Name = prompt("Please enter team 1 name", "Team 1");
if (team1Name === null){
team1Name = "Team 1"
}
teamNames.push(team1Name)
let team2Name = prompt("Please enter team 2 name", "Team 2");
if (team2Name === null){
team2Name = "... | [
"function Team() {\n return inquirer.prompt([\n {\n type: \"list\",\n name: \"team\",\n message: \"Which type of team member would you like to add?\",\n choices: [\n \"Engineer\",\n \"Intern\",\n \"No more. I'm all se... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns checksum of directory(Ex. "bot/a/b/"" > checksum("bot/a/b/"")) | function checksumP(directory){
return checksum(directory);
} | [
"function checksumC(filepath){\n\treturn checksum(fs.readFileSync(filepath).toString());\n}",
"async get_checksum() {\n const tempDir = tmp.dirSync({\n unsafeCleanup: true,\n });\n\n let localFilePath = path.join(tempDir.name, await this.get_name());\n\n await this.download_to(localFilePath);\n\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Fetching custom font by hooks | function fetchFonts() {
return Font.loadAsync({
"Roboto-Black": require("./assets/fonts/Roboto-Black.ttf"),
"Roboto-Bold": require("./assets/fonts/Roboto-Bold.ttf"),
"Roboto-Regular": require("./assets/fonts/Roboto-Regular.ttf"),
});
} | [
"get font() {}",
"function getFont(i, f=false) {\n var target;\n var eltgt;\n var tfont;\n var url;\n\n if (!i) {\n target = 'body'\n eltgt = ':not(code):not(kbd)'\n } else {\n target = 'mono'\n eltgt = 'code, kbd'\n }\n\n if (f) {\n tfont = f\n setFont(target, tfont, eltgt, `https://fon... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
CONCATENATED MODULE: ./src/helpers/sett_proxy.js Sends all dc.sett changes to the webworker / harmony default export | function sett_proxy(sett, ww) {
var h = {
get: function get(sett, k) {
return sett[k];
},
set: function set(sett, k, v) {
sett[k] = v;
ww.just('update-dc-settings', sett);
return true;
}
};
ww.just('update-dc-settings', sett);
return new Proxy(sett, h);
} | [
"SetProxy(short, bool, int, string, string) {\n\n }",
"setProxy() {\n let _this = this;\n Object.keys(this.data).forEach(key => {\n Object.defineProperty(this, key, {\n configurable: false,\n enumerable: true,\n get() {\n return _this.data[key];\n },\n set... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
keyup event listener for when user presses any key to start the game | function keyStart() {
document.addEventListener("keyup", gameStart);
} | [
"function startGame() {\n modal_begin.style.display = 'none'; // Hide the start modal\n document.addEventListener('keyup', function(e) {\n var allowedKeys = {\n 37: 'left',\n 38: 'up',\n 39: 'right',\n 40: 'down'\n };\n\n player.handleInput(allowedKeys[e.keyCode]... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Navigate based on the provided url. This navigation is always absolute. Returns a promise that: is resolved with 'true' when navigation succeeds is resolved with 'false' when navigation fails is rejected when an error happens Usage ``` router.navigateByUrl("/team/33/user/11"); ``` | navigateByUrl(url) {
if (url instanceof UrlTree) {
return this.scheduleNavigation(url, false);
}
else {
const urlTree = this.urlSerializer.parse(url);
return this.scheduleNavigation(urlTree, false);
}
} | [
"navigateByUrl (url) {\n return this._navigate (this._urlSerializer.parse (url));\n }",
"async navigate(url, {expectedDestinationUrl} = {}) {\n await this.execute_script((url) => {\n window.executor.suspend(() => {\n location.href = url;\n });\n }, [url]);\n if (!expectedDestin... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Grabs an array of starred users from local Meteor Stars collection | function getStarred() {
var starredArray = [];
if (Stars.findOne({owner: Meteor.userId()}) != null)
{
starredArray = Stars.findOne({owner: Meteor.userId()}).starred;
}
return starredArray;
} | [
"async function fetchStarredRepos() {\n setLoading(true);\n const user = navigation.getParam('user');\n\n const response = await api.get(`/users/${user.login}/starred`, {\n params: { page, per_page: 10 },\n });\n setStars(response.data);\n\n setLoading(false);\n }",
"function getStarredRep... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
toggles an element created by a button, updating the button's string to reflect visibilty change if the button's value is update then the changes are applied instead of toggling visibility | function toggle_view_element_button(button_id,element_id,hide_str,show_str) {
//
// checking value of button, if update returning with no changes
if (document.getElementById(button_id).value == 'update') {
document.getElementById(button_id).value = 'view';
if (!!(document.getElementById(ele... | [
"function toggleHideElements() {\r\n //get string of button clicked\r\n var button = document.getElementById(this.id);\r\n var val = button.value;\r\n //get classname of button clicked and find all elements in that class\r\n var className = getHideableClassName(this.id);\r\n var hideList = documen... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Deactivate element, alter animation name based on the index. | deactivate(newIndex) {
this.transitionName = newIndex < this.index ? this.parent.vertical ? 'slide-down' : 'slide-next' : this.parent.vertical ? 'slide-up' : 'slide-prev';
} | [
"deactivate(newIndex) {\n this.transitionName = newIndex < this.index\n ? this.parent.vertical ? 'slide-down' : 'slide-next'\n : this.parent.vertical ? 'slide-up' : 'slide-prev'\n }",
"function deactivateElement(uiName, elemName){\n\t\tuiElements.find(uiName).subEle... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
============================================= Funcion que se ejecuta cuando se presiona el boton (+) de la lista de inspeccion Se verifica si el boton tiene la clase de girar y dependiendo se activa la clase 'animacionVer' la cual permite mostrar los btns flotantes y se muestra el 'fbback_1' que es el div verde clarito... | function clickBtnF1() {
$('.botonF1').click(function(){
if ($('.botonF1').hasClass('botonF1_girar')){
$('.botonF1').removeClass('botonF1_girar');
$('.btn_flotante').removeClass('animacionVer');
$('.fbback_1').hide();
}else{
$('.botonF1').addClass('botonF1_girar');
$('.btn_flotant... | [
"function botAntSig(){\n\n\t//Si es alguno de los botones de el medio , se muestran ambos\n\tif(pagina>0 && pagina< arrayPaginas.length){\n\t\t$(\"#butAnt\").show();\n\t\t$(\"#butSig\").show();\n\t}\n\n\t//Si es la primer pagina , se oculta el boton anterior y se muestra el siguiente\n\tif(pagina==0){\n\t \t\t$(\"#... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function to log out user after reseting password | function resetPasswordLogOut() {
sessionStorage.removeItem('token')
sessionStorage.removeItem('isLogined')
sessionStorage.removeItem('userType')
sessionStorage.removeItem('email')
toggleLoginVisible(true)
getKanjiFromDatabase()
document.getElementById('greetMsg').innerText = `Hi, User`
document.getEl... | [
"function at_loggedout() {\r\n SetPwd(0);\r\n}",
"function logoff() {\n authService.logout().then(function (response) {\n $state.go('home');\n }, function (err) {\n vm.signupErrorMsg = \"Sorry, there was an error loging you out. Try again\";\n });\n }",
"function logoutUser() {\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Hail Mary // Should maybe return bool on success or failure depending on canHailMary. | function startHailMary(){
if(canHailMary){
hailMary = true;
}
} | [
"function isHelmsman(role) {\n return role === \"helmsman\"\n}",
"function canDrive(age){\n return (age >= 18) ? true : false;\n}",
"function check(who) {\n if (who.appearence == 'feathers' && (typeof who.quack == 'function')) {\n who.quack(\"i can quak like Duck\");\n return true;\n }\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Generate a truth test helper | function truthTest(name, test) {
return function(chunk, context, bodies, params) {
return filter(chunk, context, bodies, params, name, test);
};
} | [
"function test_ok() {\n return true;\n}",
"function mustBeTrue(boo){\n\nif(boo===true) {\n return true;\n}else{\n return false;\n}\n}",
"function generateBoolval(node) {\n // Puts result in both ACC and Z\n if (node.value.value === 'true') {\n Ops.lda('01');\n Ops.sta();\n Ops.ld... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
setupSFX() set volumes for all the sounds | function setupSFX() {
SOUND_LOW_PIANO_KEY.setVolume(0.3);
SOUND_HIGH_PIANO_KEY.setVolume(0.15);
SOUND_DRAWER.setVolume(0.5);
SOUND_PANEL.setVolume(0.15);
SOUND_MOVE.setVolume(0.25);
SOUND_POSTER.setVolume(0.1);
SOUND_BEEP.setVolume(0.05);
SOUND_ERROR.setVolume(0.05);
SOUND_COMBO_LOCK.setVolume(0.25);
... | [
"function setAllVolume() {\n\tfor(var sound in g_audio) {\n\t\t\n\t\tconsole.log(\"thrust1 ?: \" + String(sound));\n\t\tvar volume = g_audio[sound].volume;\n\t\tif( sound.indexOf(\"theme\") >= 0 ||\n\t\t\tsound.indexOf(\"rust\") >= 0) {\n\t\t\tconsole.log(\"thrust2 ?: \" + String(sound));\n\t\t\tvolume = g_audio[so... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
returns the right node for a connection helper for above | function getNodeToConnect(node, whichNode) {
if (node) {
var rawNode = node.getNativeNode();
if (__.isArr(rawNode)) {
//in a macro connections are made with the first and last node in the macro.
//tbd - support a way to designate connection nodes
... | [
"static getNode() {\n\n return database.ref(nodeName);\n\n }",
"function getNode( ) {\n\n\t\t\treturn _widget[ \"content\" ][ \"impl\" ];\n\t\t}",
"connection() { return 'connection-name' }",
"get connection () {}",
"getNativeNode() {}",
"_getConnImpl() {\n return this._parentObj;\n }",
"functio... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets all the squares in the data store | function getSquares(next, errFunc) {
console.log('getting squares');
var db = new Db(dbName, new Server(host, port));
db.open(function(err, db){
if(err){
errFunc(err);
}else{
var cursor = db.collection(collectionName).find().sort({char:1});
var arr = new A... | [
"getAllSquares() {\n return this.squares.flat();\n }",
"_availableSquares() {\n let available = new Array();\n\n this.squares.forEach( col => {\n col.forEach( square => {\n if (square.available) {\n available.push(square)\n }\n });\n });\n\n return available;... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sets the searchBar value equal to the URL string query if there is a match. | function getSearchQuery() {
// Parse search pattern from URL
var query = location.search.substr(1).replace(/%20/g, ' ');
if (query) {
search(query); // Check for matches
if (focusFirstOccurence())
document.getElementById('searchBar').value = query;
else
resetTabIndex();
}
} | [
"function urlQuery() {\n if (!searchQueryParams()) {\n return;\n }\n\n launchSearchModal();\n }",
"function fill_search_bar(){\n let params = window.location.search.substr(1);\n let params_s = params.split(\"=\")\n if(params_s[0] === \"search\"){\n $(\"#search_product\").val(decodeU... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sets a tile to be not moveable. | function unsetMoveable(tile){
tile.disp.classList.remove("moveable");
tile.disp.onclick = null;
} | [
"setAllNotMoveable() {\n let tiles = document.getElementsByClassName(\"a-tile-inner\");\n for (let i = 0; i < tiles.length; i++) {\n tiles[i].classList.remove(\"a-tile-inner-moveable\");\n tiles[i].classList.add(\"a-tile-inner-notmoveable\");\n }\n }",
"setEmptyTile()... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Hides the Select groups element and hide the select | function hideGroupSelect()
{
$('#'+sToRefresh).empty();
$('#'+sToRefresh).parent().parent('.fieldNamegroupfk').hide();
$('#'+sToRefresh).parent().parent('.fieldNameemptygroup').css('display', 'inline-block');
return true;
} | [
"hideSelect()\n\t{\n\t\t$(this.el).hide();\n\t\t$(this.el).attr('multiple', true);\n\t}",
"function hideGroupSelectionTable() {\n groupSelectHidden = !groupSelectHidden;\n if (groupSelectHidden) {\n $groupSelectTable.hide();\n }\n else {\n $groupSelectTable.show();\n }\n}",
"hideSel... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
NOTE: this function can trigger an exception / NOTE2: the returned address is not exactly the physical address: it is the offset relative to phys_ram_base | function get_phys_addr_code(/* CPUARMState * */ env, /* target_ulong */ addr)
{
/* XXX mmu
int mmu_idx, index, pd;
index = (addr >> 10) & ((1 << 8) - 1);
mmu_idx = cpu_mmu_index(env);
if (__builtin_expect(env.tlb_table[mmu_idx][index].addr_code !=
(addr & ~((1 << 10) - 1)),... | [
"function memAddress(memBase, idaBase, idaAddr) {\n var offset = ptr(idaAddr).sub(idaBase);\n var result = ptr(memBase).add(offset);\n return result;\n}",
"indirect (cpu) {\n let start = this.loadWord(cpu.pc);\n let address = this.loadIndirect(start);\n return address;\n }",
"function mapVirt... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Check pool is valid and continue otherwise pause then retry establishing a Pool | function processPool( err, pool ) {
if ( err ) {
log.e( 'Failed to create an Oracle DB Connection Pool will retry shortly' );
setTimeout( establishPool, poolRetryInterval );
} else {
log.v( 'Oracle DB connection pool established' );
dbp = pool;
performPolledProcess();
}
} | [
"function processPool( err, pool ) {\n\n if ( err ) {\n\n log.e( 'Failed to create an Oracle DB Connection Pool will retry shortly' );\n \n setTimeout( establishPool, poolRetryInterval ); \n \n } else {\n\n log.v( 'Oracle DB connection pool established' );\n dbp = pool;\n\n calculateTimeOffse... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sorts children by zIndex. Previous order is mantained for 2 children with the same zIndex. | sortChildren() {
var sortRequired = false;
for (var i = 0, j = this.children.length; i < j; ++i) {
var child = this.children[i];
child._lastSortedIndex = i;
if (!sortRequired && child.zIndex !== 0) {
sortRequired = true;
}
}
... | [
"sortChildren() {\n let sortRequired = !1;\n for (let i2 = 0, j2 = this.children.length; i2 < j2; ++i2) {\n const child = this.children[i2];\n child._lastSortedIndex = i2, !sortRequired && child.zIndex !== 0 && (sortRequired = !0);\n }\n sortRequired && this.children.length > 1 && this.childre... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function returns given closing HTML tag, every 3 elements. | function getEach3ColumnsClosingHtmlTag(htmlTag, index, currentColumnIndex) {
if ((index+1) % 3 === 0 && currentColumnIndex == 2) {
return htmlTag;
}
return "";
} | [
"function getEach3ColumnsOpeningHtmlTag(htmlTag, index, currentColumnIndex) {\n if (index % 3 === 0 && currentColumnIndex == 0) {\n return htmlTag;\n }\n return \"\";\n}",
"function getNextInnerHTML() {\n \n var rInnerHTML = \"\";\n \n switch(gDisplayInnerHTML) {\n case 0:\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Add unique identifier for each chart | function addIdentifier() {
$scope.dataAttributeChartID = 'chartid' + Math.floor(Math.random() * 1000000001);
angular.element($element).attr('id', $scope.dataAttributeChartID);
configuration.bindto = '#' + $scope.dataAttributeChartID;
} | [
"update_ids() {\n this.data.chart.id = `chart.${this.data.chart.type}`\n var count = {}\n for (var ov of this.data.onchart) {\n if (count[ov.type] === undefined) {\n count[ov.type] = 0\n }\n let i = count[ov.type]++\n ov.id = `onchart.$... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Applies all of the open transactions to a clone of the current db | applyTransactions() {
const newDb = Object.assign({}, this.db);
for (let i = 0; i < this.transactions.length; i++) {
let transaction = this.transactions[i];
for (let j = 0; j < transaction.length; j++) {
if (debug) {
console.log('Executing command ', this.transactions[j]);
... | [
"undo() {\n this.db._write(this.capture);\n return this.db;\n }",
"function resetAll() { \n var db = window.openDatabase(\"bonowayDB\", \"1.0\", \"Bonoway Local Database\", 1000000);\n db.transaction(createSites, onError, onSuccess);\n db.transaction(createParki... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Extract regions separated by silence. | function extractRegions(peaks, duration) {
// Silence params
var minValue = 0.0015;
var minSeconds = 0.25;
var length = peaks.length;
var coef = duration / length;
var minLen = minSeconds / coef;
// Gather silence indeces
var silences = [];
Array.prototype.forEach.call(peaks, funct... | [
"function extractRegions(peaks, duration) {\n // Silence params\n var minValue = 0.0015;\n var minSeconds = 0.25;\n\n var length = peaks.length;\n var coef = duration / length;\n var minLen = minSeconds / coef;\n\n // Gather silence indeces\n var silences = [];\n Array.prototype.forEach.c... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
log the result of an assertion | function log(pass, actual, expected, text) {
total++; pass && passed++;
pass ? !silent && console.log(`PASSED: ${text}`) : console.error(`NOT PASSED: ${text}\nexpected: ${expected}\nactual: ${actual}`);
} | [
"logAssertion (details) {\n runLoggingCallbacks('log', details);\n\n const assertion = {\n passed: details.result,\n actual: details.actual,\n expected: details.expected,\n message: details.message,\n stack: details.source,\n todo: details.todo\n };\n this.testReport.pushAs... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
candlesPrice() finds the candles price based on a check box selection | function candlesPrice()
{
var candlePrice=0;
//Get a reference to the form id="cakeform"
var theForm = document.forms["pipeform"];
//Get a reference to the checkbox id="includecandles"
var includeCandles = theForm.elements["includecandles"];
//If they checked the box set candlePrice to ... | [
"function getCandlesPrice() {\r\n\tvar cakeCandles = document.getElementById('includecandles');\r\n\r\n\tif(cakeCandles.checked) {\r\n\t\treturn(20);\r\n\t} else {\r\n\t\treturn(0);\r\n\t}\r\n}",
"function candlesPrice()\n{\n var candlePrice=0;\n //Get a reference to the form id=\"cakeform\"\n //var theF... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Product Table Mobile layout | function productMobileLayout() {
let section = document.querySelector('.product-section');
if (window.innerWidth <= 991 && !section.classList.contains('mob-active')) {
section.classList.add('mob-active');
let rowContainer = section.querySelectorAll('.row-container'),
heading = section.q... | [
"function resizeTable() {\n size = shoppingContent.getBoundingClientRect()['width'] * 0.7;\n amountOfProductsInRow = Math.floor(size / 204);\n\n amountOfProductsInRow = Math.max(1, amountOfProductsInRow)\n productsPerRow = amountOfProductsInRow;\n if(!cacheHandler.isCacheEmpty())\n showProduct... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
LIGHTBOX FEATURES / watches for YouTube video image click, displaying the lightbox and the video player | function watchVideoImageClick() {
$('.videos-section').on('click', '.video-box', function() {
$('.light-box-area').prop('hidden', false);
let number = $(this).attr('id');
let link = 'https://www.youtube.com/embed/' + number;
if ($('#light-box').length <= 0) {
$('.light-box-area').append(`
... | [
"function startLightBox() {\n $('img').click(function(event){\n \n //grab videoID of video\n var theVideoIDcurrent = $(this).attr('value');\n console.log(theVideoIDcurrent);\n \n //cue up lightbox container and background\n var lbBg = document.getElementById(\"lig... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |