query stringlengths 9 34k | document stringlengths 8 5.39M | negatives listlengths 19 20 | metadata dict |
|---|---|---|---|
ucs or astar available data structures: new BetterSet(); > set (all elements are unique) > use this for your list of visited states! new PriorityQueue available functions: getStartState(); > the start coordinates isGoalState(coords); > have we reached the end of the maze (coords is an array [x, y]) getNeighbors(coords)... | function ucs() {
let toVisit = new PriorityQueue();
// our start state, and the path to get there (which is go to start state)
toVisit.add({
coords: getStartState(),
path: [getStartState()],
cost: 0,
heuristic_cost: 0 // the priority queue sorts by this
})
let v... | [
"function minimax(state, limit, player) {\n var moves = [];\n if(limit > 0) {\n //Loop over the state matrix checking if the squares are undefined (empty).\n //Values set to the gameboard columns, 7x6.\n for(var idx1 = 0; idx1 < 7; idx1++) {\n for(var idx2 = 0; idx2 < 6; idx2++) {\n //If the ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get player's distance from our home | playerHomeDist() {
return this.playerDistTo(this.getBlackboard().home);
} | [
"function distFromHome()\n{\n distanceFromHome = math.floor(math.sqrt(math.pow(x,2)+math.pow(y,2)));\n return distanceFromHome;\n}",
"playerDist() {\n return this.playerDistTo(this.getPos());\n }",
"playerDistTo(location) {\n return location.distTo(this.getPlayerPos());\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Reset a box to the provided origin box. This is a mutative operation. | function resetBox(box, originBox) {
resetAxis(box.x, originBox.x);
resetAxis(box.y, originBox.y);
} | [
"reset() {\r\n\t\tthis.changeState(this.initial);\r\n\t}",
"_resetPosition() {\n this._monitor = this._getMonitor();\n\n this._updateSize();\n\n this._updateAppearancePreferences();\n this._updateBarrier();\n }",
"function clearBox(number) {\n return document.getElementById... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sets the given value for the given key by replacing any other values associated with that key. Normalizes the key. | set(key, value) {
key = normalizeKey(key);
validate(key, value);
this.internalRepr.set(key, [value]);
} | [
"function field_set_old_value(key)\n{\n\tthis.old_values[key] = this.getValue(key);\n}",
"set(key, value = null) {\n // If only argument is an Object, merge Object with internal data\n if (key instanceof Object && value == null) {\n const updateObj = key;\n Object.assign(this.__data, updateObj);\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
500 ms makes it effectively instant. Starts the Chameleon HTTP server and file watcher on the given path. | function start(watchPath) {
/**
* Load a file from disk and pipe it down.
*/
function onServeFile(request, response, pathname) {
var localFile = path.join(watchPath, pathname);
if (!path.existsSync(localFile)) {
response.writeHead(404);
response.end();
return;
}
fs.readFil... | [
"function serve() {\n const express = require('express');\n const helmet = require('helmet');\n const compression = require('compression');\n\n const app = express();\n app.use(helmet());\n app.use(compression());\n app.use(express.static(config.PUBLIC_PATH));\n\n // Redirect 404s\n app.get('*', (request, ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Puzzle Chunk represents a group of pieces that can be dragged together | function PuzzleChunk(){
this.MinX = 0;
this.MinY = 0;
this.MaxX = 0;
this.MaxY = 0;
this.Pieces = [];
this.DestX = -1;
this.DestY = -1;
this.Speed = 0.3;
this.X = 0;
this.Y = 0;
} | [
"movePiece(p_index, t_index) {\n // Pull variables out of loop to expand scope\n let piece = null;\n let o_tile = null;\n let t_tile = null;\n\n // Look for old and new tiles by index\n for (let line of this.board) {\n for (let tile of line) {\n if (tile.index === p_index) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
clear team grading reducer data | function clearTeamGradingReducerDataAction(key) {
const action = {
type: ApiConstants.OWN_COMP_TEAM_GRADING_CLEARING_PARTICULAR_REDUCER_DATA,
key,
};
return action;
} | [
"function clearOrgunitAssignment() {\n\tfor (var i = 0; metaData.dataSets && i < metaData.dataSets.length; i++) {\n\t\tmetaData.dataSets[i].organisationUnits = [];\n\t}\n\n\tfor (var i = 0; metaData.programs && i < metaData.programs.length; i++) {\n\t\tmetaData.programs[i].organisationUnits = [];\n\t}\n\n\tfor (var... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
List of request types 0 doctor hour 1 procedures 2 medical tests 3 doctor on call Shows list of procedures, doctor hour, doctor on call, medical tests, | selectRequestType(type) {
// if this is 'doctor on call' or 'doctor hour' show specialities list
if (type.id == 0 || type.id == 3) {
this.selectedRequestData = this.CalendarService.dataSource.specialities;
this.selectedRequestType = "specialities";
} else {
// if type is 2 filter by 'procedures' if type... | [
"function typeofrptinfo()\n\t{\n\t\tvar type = $(\"#rptwebusage_type option:selected\").attr('value');\n\t\tvar iscustom = $(\"#rptsearch_time option:selected\").attr('value');\n\t\t\n\t\tif (type == 'topusersbyhost')\n\t\t{\n\t\t\t$(\"#rptwebusage_user_row\").hide();\n\t\t\t$(\"#rptwebusage_host_row\").show();\n\t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
give toast index to pop off all toasts past that index (so the index is NOT removed) | modifyToast(index)
{
this.setState({toasts:this.state.toasts.slice(0,index+1)});
} | [
"function getValidIndex () {\n return $toasts.get().findIndex(toast => toast.key === toastId)\n }",
"function addToast (toast) {\n var type = toast.type; \n\n toast.type = mergedConfig['alert-classes'][type];\n toast.icon = mergedConfig['icon-classes'][... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Updates used words in the HTML | function updateUsedWords(){
$('.js-used-words').html("");
$.each(usedLetters, function(i, val){
$('.js-used-words').append(val + " ");
});
} | [
"function refreshSavedWords(words) {\n document.getElementById(\"copyStatus\").style.opacity = 1;\n let wordLines = document.getElementById(\"wordLines\");\n ULTemplate(words, wordLines);\n generateString(words);\n }",
"function updatetags(){\n\tvar e=document.getElementsByTagName(\"body\").item(0).i... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Actually calls the API to send a request to save the answer to all categories. | async process({ getState, action }, dispatch, done) {
const userId = action.userId
const state = getState().scenes.codingValidation.coding
const allCategoryObjects = Object.values(state.userAnswers[action.questionId])
try {
for (let category of allCategoryObjects) {
let respCodedQuest... | [
"sendCategoriesToServer() {\n let objToSend = [];\n let tempCategoryName = true;\n let catName = '';\n \n _.forEach(this.factorsCopy, (category) => {\n let tempFactor = {};\n let tempSubcategory = [];\n _.forEach(category.subClasses, (subcategory) => {\n if (subcategory.isToggle... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Deprecated replaced by visualizeTopicNeighborMatrix | function visualizeTopicTermMatrix(topics) {
var params = {
width: 1000,
height: 1000,
margin: {
left: 100,
top: 50
},
termNum: 50
};
var canvas = d3.select('#topic-term-matrix')
.style('width', params.width)
.style('height', ... | [
"function updateColumns() {\r\n activeTopics = [];\r\n for (let i = 1; i < 5; i++) {\r\n if (d3.select(\"#topic-toggle-\" + i).attr('checked','true')) {\r\n activeTopics.push(i);\r\n }\r\n }\r\n\r\n for (let i = 0; i < activeTopics.length; i++) {\r\n\r\n }\r\n\r\n}",
"function WordView(topicLabels... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
First letter in deal denotes the "starting" hand So if it is "S", hands are S, W, N, E, if it is "N" hands are N, E, S, W This function translates to "N"format... | function normalizeDeal(dealString) {
var a = dealString.split(':');
if (a[0] === 'N') return a[1];
var c = a[1].split(' ');
switch (a[0]) {
case 'E':
return c[3] + ' ' + c[0] + ' ' + c[1] + ' ' + c[2];
case 'S':
return c[2] ... | [
"function constructSenteHand(sfen, i) {\n const n = sfen.length;\n\n editor.senteHand = [];\n\n while (i < n) {\n var p = sfen.charAt(i);\n\n if(p === '-' || p === ' ')\n break;\n\n if (!Piece[p.toLowerCase()]) {\n // Not a piece nor a number -> neglect\n console.log('Error: this is not a... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
FUNCTION: getCodeViewDropCode DESCRIPTION: returns the code snippet to drop after a drag operation. ARGUMENTS: component Rec. RETURNS: code to drop into code view. | function getCodeViewDropCode(componentRec)
{
var codeToDrop="";
if (componentRec && componentRec.objectType == METHOD_OBJECT_TYPE)
{
var aMethod = getMethodObjFromComponentRec(componentRec);
var aCFC = getParsedCFCinfo(componentRec.parent);
// Form a decent name for a return variable. This isn't entirely c... | [
"function run_code() {\n // if (document.getElementById(\"panel_output\").attributes.getNamedItem('data-status').nodeValue == 'closed'){\n // t = document.getElementsByClassName(\"toggler\");\n // for (i = 0; i < t.length; i++) {\n // if (t[i].attributes.getNamedItem('order').nodeValue =... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Setter of the topic attribute. | set topic(aValue) {
this._logService.debug("gsDiggEvent.topic[set]");
this._topic = aValue;
} | [
"setTopicID( id ) {\n return 'topic-' + parseInt( id );\n }",
"handleTopicChange(event) {\n this.setState({\n topic: event.target.value\n });\n }",
"function Topic(props) {\n return __assign({ Type: 'AWS::SNS::Topic' }, props);\n }",
"function setActiveSubTopi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
triggered when this player accepts someone else's order | _order_accepted(event) {
const order = event.detail;
if (order.pcode == this.pcode)
return;
this.$.modal.modal_text = `Do you want to ${order.is_bid ? 'sell' : 'buy'} for ${order.price}?`
this.$.modal.on_close_callback = (accepted) => {
if (!accepted)
... | [
"function newOrder(){\n\t\tinquirer.prompt([{\n\t\t\tname: \"choice\",\n\t\t\ttype: \"confirm\",\n\t\t\tmessage: \"Would you like to place another order?\"\n\t\t}]).then(function(answer){\n\t\t\tif(answer.choice){\n\t\t\t\tuserRequest();\n\t\t\t}\n\t\t\telse{\n\t\t\t\tconsole.log('Thank you for shopping at BAMazon!... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Add filters to a query | addFilterToQuery(filter) {
const query = {};
if (filter.mode === 'exactly' && !filter.value) {
query[this.paths.first] = query[this.paths.last] = filter.inverted ? { $nin: ['', null] } : { $in: ['', null] };
return query;
}
let value = utils.escapeRegExp(filter.va... | [
"createFilterQuery() {\n const filterType = this.state.filterType;\n const acceptedFilters = ['dropped', 'stale', 'live'];\n\n if (acceptedFilters.includes(filterType)) {\n const liveIDs = this.state.liveIDs;\n if (filterType === 'dropped') return {'events.id': {$nin: liveIDs}};\n if (filter... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
this function adds initialised canvases from m3daudio to this class so that it could update dimension of canvases in updateSize() reasons 1. one wrapper can have multiple canvases 2. canvas' job is to clear and draw lines nothing to do with wrapper's updating size. 3. wrapper updates size followed by canvases 4. most p... | addCanvases(waveCanvas) {
this.wave_canvas = waveCanvas;
this.miniWave_wrapper.appendChild(waveCanvas.mainWave_canvas);
this.setCanvasStyles()
} | [
"setupCanvas(width, height, rectMargin, rulerSize) {\n\t\tthis.canvas.width = width\n\t\tthis.canvas.height = height\n\t\tthis.rectMargin = rectMargin\n\t\tthis.rulerSize = rulerSize\n\t\tthis.rectArea = {\n\t\t\t'width':this.canvas.width - rulerSize - rectMargin,\n\t\t\t'height':this.canvas.height - rulerSize - re... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Compare result1 with result2: higher scores compare lower; if scores are equal, then lexicographically earlier names compare lower. | function compareResults(result1, result2) {
return (result2.score - result1.score) ||
result1.name.localeCompare(result2.name);
} | [
"function compareResults(result1, result2) {\n return(result2.score - result1.score) ||\n result1.name.localeCompare(result2.name); \n}",
"function compareByScore(a, b) {\n \"use strict\";\n if ((a.seize && b.seize) || (!a.seize && !b.seize)) {\n i = b.totalScore - a.totalScore;\n return i... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
SearchForm so we don't have to include google.search every time. | function SearchForm(enableClear, parentEl, options){
options = this.options = mergeObjs(options,{
'buttonText' : 'Search',
'hintString' : 'Search the map!'
});
var z=this,
input,
form=z.form=createEl('form','gsc-search-box',[
... | [
"function do_search() {\n var $form = $('#search-form');\n var option = $form.find('select[name=action] option[selected]').val();\n if (!option) return false;\n var search_terms = $form.find('input[name=q]').val();\n var url = str_concat(option , '?q=' , search_terms);\n ad... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Finds a circle given a label | function findCircle(label){
for (var i = 0; i < circles.length; i++){
if (label == circles[i].label){
return circles[i];
}
}
} | [
"function insideCircles(node){\n\tvar strCircles = node.region.label;\n\tvar result = [];\n\t//console.log(circles);\n\n\tfor (var i = 0; i < circles.length; i++){\n\t\tvar circle = circles[i];\n\t\tvar distance = Math.sqrt( Math.pow(node.x - circle.x, 2) + Math.pow(node.y - circle.y, 2) );\n\t\t//does this node's ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Determine if namespace is contained in the string. | function containsNamespace (str, namespace) {
var val = str.split(/[ ,]+/)
namespace = String(namespace).toLowerCase()
for (var i = 0; i < val.length; i++) {
if (!(str = val[i])) continue
// namespace contained
if (str === '*' || str.toLowerCase() === namespace) {
return true
}
}
ret... | [
"function isPrefix(sub,str) {\n return str.lastIndexOf(sub,0)===0;\n}",
"function isPrefix(word, prefix) {\n\treturn word.startsWith(prefix.slice(0, -1));\n}",
"function hasWord(string, word) {\n //console.log(string, word);\n let arr = string.split(' ');\nreturn (arr.includes(word)) ? true : false;\n}... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Hack to bring a layer to the front...this should be a part of prototope! | function bringLayerToFront(layer) {
var parent = layer.parent
layer.parent = undefined
layer.parent = parent
} | [
"bringToFront() {\n let zIndex = '';\n const frontmost = OverlayElement.__attachedInstances.filter((o) => o !== this).pop();\n if (frontmost) {\n const frontmostZIndex = frontmost.__zIndex;\n zIndex = frontmostZIndex + 1;\n }\n this.style.zIndex = zIndex;\n this.__zIndex = zIndex || pars... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets the navigation mesh the query object is using. | getAttachedNavMesh() {
return this.m_nav;
} | [
"get MeshRenderer() {}",
"get sharedMesh() { return this._sharedMesh; }",
"getNavigation() {\n errors.throwNotImplemented(\"getting navigation (dequeue options)\");\n }",
"getFloorMeshes() {\n if ( this.floorMeshes && this.floorMeshes.length > 0 ) {\n return this.floorMeshes; \n } else if ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return the ISBN10 check digit given the first 9 numbers | function isbn10_check_digit(isbn10)
{
var i = 0;
var s = 0;
var v;
for (n = 10; n > 1; n--) {
s += n * Number(isbn10[i]);
i++;
}
s = s % 11;
s = 11 - s;
v = s % 11;
if (v == 10)
return 'x';
else
return v + '';
} | [
"function isbn13to10(isbn13)\n{\n var first9 = (isbn13 + '').slice(3).slice(0, -1);\n var isbn10 = first9 + isbn10_check_digit(first9);\n return isbn10;\n}",
"function convertIsbn10ToIsbn13(isbn10){\n // Check if isbn10 is valid\n if (!isValidIsbn10(isbn10)){\n console.warn(`${isbn10} is no... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
depending how the script is executed (as part of a form, inside a webresouce) is the serverurl constructed in a different fassion | function getServerUrl() {
var url = null,
localServerUrl = window.location.protocol + "//" + window.location.host,
context = getContext();
if ( Xrm.Page.context.getClientUrl !== undefined ) {
// since version SDK 5.0.13
// http://www.magnetismsolutions.... | [
"function getServerUrl() {\n\n if (SERVER_URL === null) {\n\n var url = null,\n localServerUrl = window.location.protocol + \"//\" + window.location.host,\n context = getContext();\n\n\n if ( Xrm.Page.context.getClientUrl !== undefined ) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
define a base url for a REST API | baseURL () {
return config.api.baseUrl;
} | [
"function setApiBaseUri(baseUri) {\n apiBaseUri = baseUri;\n }",
"function buildBasePath(type) {\n return API_BASE_URL + ( URL_PATHS[type] || '' );\n }",
"function apiUrl({ withTenant, apiBaseUrl, apiDomain, tenant, withFeed, feed }) {\n let result = withTenant\n ? `https://${tenant || '... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Initializes tabs component child element selectors. | _initSelectors () {
this.tabAttribute = 'data-rvt-tab'
this.panelAttribute = 'data-rvt-tab-panel'
this.tabSelector = `[${this.tabAttribute}]`
this.panelSelector = `[${this.panelAttribute}]`
this.tablistSelector = '[data-rvt-tablist]'
this.initialTabSelector = '[data-rvt-... | [
"init () {\n this._initSelectors()\n this._initElements()\n this._initProperties()\n this._initAttributes()\n\n Component.bindMethodToDOMElement(this, 'activateTab', this.activateTab)\n Component.bindMethodToDOMElement(this, 'addTab', this.addTab)\n Component.bindMet... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
enable / disable arrows according the grid | function setArrows(){
var showArrows = false;
if(g_options.gridpanel_arrows_always_on == true){
showArrows = true;
}
else{
var numPanes = g_objGrid.getNumPanes();
if(numPanes > 1)
showArrows = true;
}
if(showArrows == true){ //show arrows
g_objArrowNext.show().fadeTo(0,1);
g_ob... | [
"function updateArrows(stateIdx) {\n if (stateIdx == 0) {\n d3.select('#left-arrow')\n .attr('disabled', true);\n } else if (stateIdx == states.length - 1) {\n d3.select('#right-arrow')\n .attr('disabled', true);\n } else {\n d3.select('#left-arrow')\n .attr('disabled', ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
import FadeInSection from "../components/FadeIn" | function FadeInSection(props) {
const [isVisible, setVisible] = React.useState(false);
const domRef = React.useRef();
React.useEffect(() => {
const observer = new IntersectionObserver((entries) => {
entries.forEach((entry) => setVisible(entry.isIntersecting));
});
observer.observe(domRef.current... | [
"function FadeInTransition() {}",
"function index() {\n return (\n <div>\n <ShowHome />\n </div>\n )\n}",
"function fadeIn() {\n if (fadingOut == true) {\n sendOSC('/composition/video/fadeout/direction', 1);\n fadingOut = false;\n }\n}",
"componentWillUnmount() {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Change product image when users change flavor | function changeFlavor() {
var currentFlavor = document.getElementById("flavor-select");
var productImage = document.getElementById("product-image");
var currentProduct = document.getElementById("product-title");
productImage.src = imageDict[currentProduct.innerText.toLowerCase().replace(/(\r\n|\n|\r)/gm... | [
"changeImageProp() {\n if (['small-image', 'benefits-hero'].includes(this.bannerType)) {\n this.responsive = true;\n this.positionOfImageClass = (this.positionOfImage.toUpperCase() === 'RIGHT') ? ' reverse' : '';\n }\n else {\n this.responsive = false;\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
method that increases the hour value | onIncreaseHour() {
const { hour, minute, hourStep } = this.state;
const hourIncreased = hour + hourStep;
let inputValue = this.getValue(hourIncreased, minute);
if (hourIncreased < 24) {
this.setState({
hour: hourIncreased,
inputValue
});
} else {
inputValue = this.getValue(0, minute);
t... | [
"addHours(hours) {\n this.addSeconds(hours * 60 * 60);\n }",
"function pmAdd(hour)\n{\n //hour will be startHour or endHour, in string format\n hour = parseInt(hour);\n //check that it isn't 12pm, otherwise add 12\n if (hour != 12)\n {\n hour = (hour + 12) % 24;\n }\n return ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
finding the lowest label in the table | function findLabel() {
var numbers = [];
var index = 0;
$("tbody").find("tr").each(function () {
numbers[index] = parseInt($(this).find("td:first").text());
index++;
});
numbers.sort();
var number = numbers.length + 1;
for(var i =0; i < numbers.length; i++){
if(i+1 !=numbers[i]){
return ... | [
"function getLargestLabel() {\n return formatData(-88000000000, 1);\n}",
"low() {\n let mark = Object.values(marks[0]).map(element => {\n return parseInt(element);\n });\n return Math.min(...mark);\n }",
"function getStartIndex(value, label) {\n return (value.indexOf(label) + label.length... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
events from Android app | function fAndroidEvents( vEventName, vEventData )
{
//User has just started the Android app & Switch to remote control view
if (vEventName == "changeview" && vEventData == "remote")
{
}
//User has just started the Android app & select an unconfigured device
if (vEventName == "changeview" && vEventData == "loadin... | [
"handleGameStartEvent() {\n \n }",
"function PushEvent() { }",
"function onMessageReceived(e) {\n var data = JSON.parse(e.data);\n\n switch (data.event) {\n case 'ready':\n onReady();\n break;\n\n case 'playProgress':\n onPlayProgress(data.data);\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
make href in tab container | function tabContainerHrefSesbasic(tabId){
if(sesJqueryObject('#main_tabs').length){
var tab = sesJqueryObject('#main_tabs').find('.tab_'+tabId);
if(tab.length){
var hrefTab = window.location.href;
var queryString = '';
if(hrefTab.indexOf('?') > 0){
var splitStringQuery = hrefTab.split('?');
hrefTa... | [
"function tabLinks( active ) {\n\tfunction tab( id, label ) {\n\t\treturn T( id == active ? 'tabLinkActive' : 'tabLinkInactive', {\n\t\t\tid: id,\n\t\t\tlabel: label\n\t\t});\n\t}\n\tif (((document.location.href.indexOf('nid=') > 0) \n\t&& (document.location.href.indexOf('gid=') > 0) \n\t&& (document.location.href.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
POP UP WINDOW FUNC /The variable robotWindow contains a new window object, referencing the image file robot.png. The name of this new window is robotWindow. Names are required, because we might want to reference this window later in a link or in another script. The new window has a width of 400 pixels and a height of 3... | function newRobotWindow() {
var robotWindow = window.open("Images/robot.png", "robotWindow", "resizable=no,width=400,height=300");
return false;
} | [
"function OpenWindow ( name, wTop, wLeft, wWidth, wHeight, url ) \n { \t \n var w = null;\n \n \tfeatures = \"resizable=1,scrollbars=1,height=\" + wHeight + \",width=\" + wWidth;\n \n \tif ( NS4 || NS6 )\n \t{\n \t\tfeatures += \",screenY=\" + wTop + \",screenX=\" + ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
endregion region fixScheme Changes the URI's scheme to https if the URI has a scheme. If it doesn't, returns the original URI. | function fixScheme(link) {
var uri = new URI(link);
return uri.scheme() == 'http' ?
uri.scheme('https') + '' :
link;
} | [
"function convertToCurrentProtocol(url)\n{\n if(url && url.replace)\n {\n url = url.replace(/http[s]?:/i, document.location.protocol);\n }\n \n return url;\n}",
"function isValidSchemeUrl(url) {\n // If the scheme is 'javascript:' or 'vbscript:', these link\n // types can be da... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Substitutes an array of tokens within a String to return the new String | function atgCommon_substituteTokenArray(originalString, substitutionStringArray, substitutionTokenArray) {
var newString = originalString;
// Loop through the array and update the String accordingly
for (var i=0; i< substitutionTokenArray.length; i++) {
newString = atgCommon_substituteToken(newString, subs... | [
"function str_replace(haystack, needle, replacement) {var temp = haystack.split(needle);return temp.join(replacement);}",
"function splice(str, token, replacement) {\r\n var i = str.indexOf(token);\r\n return str.substr(0, i) + replacement\r\n + str.substr(i + token.length);\r\n}",
"function censorString(s... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
box the holds the search search string. Decorates the VisData with custom colors when search applies. | function textSearchColor(searchBox, visSVGName) {
var searchStr = document.getElementById(searchBox).value;
var svg = d3.select(visSVGName)
// go through each point and line
svg.selectAll(".dot")
.style("fill", function(d) { return colorChoice(d, searchStr); })
svg.selectAll(".line")
.style("stroke"... | [
"highlightSearchSyntax() {\n console.log('highlightRegexSyntax');\n if (this._highlightSyntax) {\n this.regexField.setBgHtml(this.regexField.getTextarea().value.replace(XRegExp.cache('[<&>]', 'g'), '_'));\n this.regexField.setBgHtml(this.parseRegex(this.regexField.getTextarea().value));\n } else ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Manage initial height of Mega menu when opening | function initializeMegaMenuHeight(currentStatus){
currentStatus.heights=[]
max=0;
//console.log("before : "+currentStatus.heights);
$(".data-depth-0>li.selected").children(".ul-reset").each(function() {
if(max<$(this).find(".ul-reset").height()){
max = $(this).find(".ul-reset").height();
}
});
curren... | [
"function setMenuMaxHeight() {\n \tvar outerHeight = $(pDiv+jq(config.CSS.IDs.divBottomWrapper)).outerHeight(true);\n \tvar docHeight = $(pDiv+ jq(\"divMainJsmol\")).height();//TODO fix\n \t$(pDiv+ jq(config.CSS.IDs.divMenu)).css('max-height',docHeight - outerHeight );\n\t}",
"function initMenuEmptyHeigh... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Apply prettyprinting to code elements inside a pre tag | function makePretty() {
$('pre > code').not('.notpretty').each(
function(index) {
$(this).parent().addClass('prettyprint');
$(this).parent().addClass($(this).attr('class'));
}
);
prettyPrint();
} | [
"function correctCodeSnipplets(){\n\tvar preItems = document.getElementsByTagName('pre');\n\tfor (var p=0; p<preItems.length; p++) {\n\t\tvar codeItems = preItems[p].getElementsByTagName('code');\n\t\tfor (var c=0; c<codeItems.length; c++) {\n\t\t var item = codeItems[c];\n\t\t if (item.classList.contains(\"h... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
ajax_addCustomLecture / > s_index: schedule index / csnum: course number / cdx: course index | function ajax_addCustomLecture(lectime, s_index, csnum, cdx)
{
s_index = $("s_index").innerHTML;
csnum = $("csnum").innerHTML;
cdx = $("cdx").innerHTML;
new Ajax.Request("lecnum_c.php",
{
method: "post",
parameters:
{
lecs: lectime,
six: s_index,
num: csnum,
cix: cdx
},
onSucce... | [
"function addCourse(){\n if ( !($(\"#courseNameInput\").val() && $(\"#creditsInput\").val() && $(\"#workloadInput\").val()) ) {\n\t\t\t$(\"#warningField\").empty();\n\t\t\t$(\"#warningField\").append(\"<span class='redColor'>All fields are required!</span>\")\n\t\t\treturn;\n\t\t} else {\n\t\t\tvar nameValue... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns a new Vector4 set with the multiplication result of the given floats and the current Vector4 coordinates. | multiplyByFloats(x, y, z, w) {
return new Vector4(this.x * x, this.y * y, this.z * z, this.w * w);
} | [
"multiplyByFloats(x, y, z) {\n return new Vector3(this.x * x, this.y * y, this.z * z);\n }",
"multiply(otherVector) {\n return new Vector4(this.x * otherVector.x, this.y * otherVector.y, this.z * otherVector.z, this.w * otherVector.w);\n }",
"multiplyByFloats(x, y) {\n retur... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
append js file to document | function addJs( src, document )
{
e = document.createElement("script");
e.async = true;
e.type = "text/javascript";
e.src = src;
document.body.appendChild(e);
} | [
"function includeJS(file_path){ \r\n var j = document.createElement(\"script\");\r\n j.type = \"text/javascript\";\r\n j.onload = function(){\r\n lib_loaded(file_path);\r\n };\r\n j.src = file_path;\r\n document.getElementsByTagName('head')[0].appendChild(j); \r\n}",
"function includeJs... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
/ DOS Date format: high|YYYYYYYm.mmmddddd.HHHHHMMM.MMMSSSSS|low add 1980 to stored year stored second should be doubled / write JS date to buf as a DOS date | function write_dos_date(buf, date) {
if(typeof date === "string") date = new Date(date);
var hms = date.getHours();
hms = hms << 6 | date.getMinutes();
hms = hms << 5 | (date.getSeconds()>>>1);
buf.write_shift(2, hms);
var ymd = (date.getFullYear() - 1980);
ymd = ymd << 4 | (date.getMonth()+1);
ymd = ymd << 5 |... | [
"function DateSerial(yy, mm, dd) {\n return FormatDateTime(cvdate(mm+'/'+dd+'/'+yy),2);\n}",
"function excelDateToJSDate(serial) {\n return new Date((serial - (25567 + 2 - 0.00000001)) * 86400 * 1000);\n}",
"function toJalali() {\n\n const DATE_REGEX = /^((19)\\d{2}|(2)\\d{3})-(([1-9])|((1)[0-2]))-([1-... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Calculates the checked stated of the item | getItemCheckedState(item) {
const descendants = this.getItemDescendants(item).filter(descendant => !this.composer.isItemLocked(descendant));
const isParent = descendants.length > 0;
if (isParent && this.manageRelationships) {
const checkedCount = descendants.reduce((count, item) => {... | [
"get checkedItems() {\n return this.composer.queryItems((item) => {\n return this.isItemChecked(item) && (!this.manageRelationships || !this.getItemChildren(item).length);\n }, Infinity);\n }",
"isItemChecked(item) {\n return this.composer.getItemPropertyValue(item, 'selected') ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Tell if this is a blocker frame | is_blocker() {
return true;
} | [
"is_blocker() {\n return false;\n }",
"tracking_block(type) { return this.blocks[type] !== undefined; }",
"function adBlockNotDetected() {\n }",
"has_block(type) { return (this.tracking_block(type)) ? this.blocks[type] : false; }",
"function isDamagedFrame(frame) {\n // In real life, re-ge... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Determine whether the given properties match those of a `LoginProfileProperty` | function CfnUser_LoginProfilePropertyValidator(properties) {
if (!cdk.canInspect(properties)) {
return cdk.VALIDATION_SUCCESS;
}
const errors = new cdk.ValidationResults();
errors.collect(cdk.propertyValidator('password', cdk.requiredValidator)(properties.password));
errors.collect(cdk.prope... | [
"function hasProperties(json, properties) {\n return properties.every(property => {\n return json.hasOwnProperty(property);\n });\n}",
"function CfnMultiRegionAccessPointPolicyPropsValidator(properties) {\n if (!cdk.canInspect(properties)) {\n return cdk.VALIDATION_SUCCESS;\n }\n cons... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
load the chart csv with the colorscales | function loadcolorscale ()
{
colour = []
avoidline = []
colorscale = []
d3.csv("Stylesheets/chart.csv", function(err, Chart) {
Chart.forEach(function(i){
header = i.headline;
colorscale[header] = [];
avoidline[header] = [];
})
Chart.forEach(function(i){
if (i.serie == "map"){
colou... | [
"function readInChartCSV() {\n\tvar $ = jQuery;\n\t\n\t$.ajax({\n\t\turl: chartContainer.data('src'),\n\t\ttype: 'get',\n\t\tdataType: 'text',\n\t\tsuccess: function(result) {\n\t\t\tvar parseResult = $.parse(result,{header: false, dynamicTyping: true})\n\t\t\t//console.info(parseResult);\n\t\t\tvar chartArray = pa... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
After moving directories, relative symlinks may be incorrect. This fixes. | function fixMovedSymlinks(d) {
fs.readdirSync(d).map(f => path.join(d, f)).forEach(f => {
const stats = fs.lstatSync(f)
if (stats.isDirectory()) {
fixMovedSymlinks(f) // recurse
}
else if (stats.isSymbolicLink()) {
let dest = fs.readlinkSync(f)
let... | [
"function fixFileLinks(yarnLock, projectRoot) {\n const fileLinkDelimiter = '@file:';\n const linkedKeys = Object.keys(yarnLock).filter(key => key.includes(fileLinkDelimiter));\n if (linkedKeys.length === 0) return yarnLock;\n const updatedYarnLock = { ...yarnLock\n };\n\n for (const key of linkedKeys) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Constructs a new OrderStatus. If requestId exists, the result for that request is returned. See the Examples for details on the various responses that you can receive. Generally, if you see a Response Code of 0 in a result for a TN, information will be available for it. Any other Response Code will indicate no informat... | function OrderStatus() {
_classCallCheck(this, OrderStatus);
OrderStatus.initialize(this);
} | [
"function cloneStatus( targetResponse, sourceResponse ) {\n return targetResponse.status( sourceResponse.statusCode );\n}",
"function createStatus() {\r\n return $('<span/>', { class: 'status', text: 'available' });\r\n}",
"createOrder(orderOptions) {\n const params = _.merge(orderOptions, this.get... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
function to append popupUrl into an Iframe. | function appendPopupIFrame(p, src, title){
popupIframe = document.createElement("IFRAME");
popupIframe.setAttribute("src", src);
popupIframe.setAttribute("title", title);
popupIframe.setAttribute("id", "popup-iframe-id");
popupIframe.setAttribute("scrolling", "no");
popupIframe.setAttribute("marginhei... | [
"function loadPopupInDialogBox(popupUrl, popupTitle){\r\n\r\n\t\tpopup_Div = document.getElementById(\"gauth-light-box\");\r\n\t \r\n\t\tpopup_Div.innerHTML = \"<a class='button' id='liteBoxClose' href='#' onclick='hideLightBox();return false;'><span>X</span></a>\";\r\n\t\t\r\n\t\tvar popup_source;\r\n\t\tvar ho... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Searches the channel list to locate a channel with name matching the given parameter, and returns it (if one is found) | getChannelByName(name){
for (var i = 0; i < this.channelList.length; i++) {
if(this.channelList[i].name == name){
return this.channelList[i];
}
}
} | [
"function GetChannelByName(name) { \r\n var channel = client.channels.find(val => val.name === name); \r\n return channel; \r\n }",
"getIdFromChannel(channelName, callback){\n this.robot.http(`https://api.slack.com/api/users.conversations?token=${this.botToken}&user=${this.botSlackUserId}&type... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
addToWatchList adds selected stock to watch list | function addToWatchList(event) {
var stockSymbol = $(this).attr("stock-id");
event.preventDefault();
// empty out stock-ticker content
$("#stock-ticker-content").empty();
console.log("in addToWatchList() ");
console.log("stock symbol: " + stockSymbol);
// $("#financial-text").empty();
... | [
"function addToWatchList(event) {\n var stockSymbol = $(this).attr(\"stock-id\");\n\n console.log(\"in addToWatchList, currentUser: \" + appUser.email);\n\n event.preventDefault();\n // empty out stock-ticker content\n $(\"#stock-ticker-content\").empty();\n $(\"#my-watch-table\").show();\n\n c... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
if the key pressed is up arrow then hain is true | function keyPressed() {
if (keyCode === UP_ARROW) {
hain = true;
}
} | [
"function keyReleased() {\n if (keyCode === UP_ARROW) {\n hain = false;\n }\n}",
"function keyReleased() {\n if (keyCode === DOWN_ARROW) {\n downPressed = false; // To avoid bug of continuous down\n }\n}",
"function keyDown(key) {\n key = key.toUpperCase();\n if (keyStatus.hasOwnProperty(ke... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Send the film to the server in XML format by using the serialized form name & values of inputs To create our own valid XML format | function parseFilmToXML(filmForm) {
var tag = "";
$.each(filmForm, function(i, filmInput) {
if(i != 0) {
tag += "<" + filmInput.name + ">" + filmInput.value + "</" + filmInput.name + ">";
}
});
var filmStringToSend = "<film>" + tag + "</film>";
return filmStringToSend;
} | [
"function ProcessableXML() {\n\n}",
"function generateXML(){\n\t\t\t\tconsole.log(\"###### FUNCTION generateXML START\");\n\t\t\t\tvar xml2Send = '';\n\t\t\t\txml2Send += '<?xml version=\"1.0\" encoding=\"UTF-8\"?><simpledc xmlns:dc=\"http://purl.org/dc/elements/1.1/\" xmlns:dct=\"http://purl.org/dc/terms/\" xmln... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Name: Draw unopned and new brand lead Author: Peter Chen Purpose: Unopened and new brand lead infographic elements Arguments: DrawUnopenedLead(canvas_name, x_position, y_position, unopened_data, new_data); Data format: value Example: DrawUnopenedLead("myCanvas", 0, 0, 1000, 1200); | function DrawUnopenedLead(c,x,y,d,d2) {
var canvas = document.getElementById(c);
var context = canvas.getContext("2d");
context.save();
img_unopened= new Image();
//write text
context.beginPath();
context.fillStyle = "#ffffff";
context.font = "24pt Calibri";
context.fillText("The Number of Leads", x+400, y-50)... | [
"function ActivityDeclined(){\n\n\tif (g_bFullScreen) {\n\t\tfor (i=0; i<=g_nNumButs+7; i++) {\n\t\t\tMFBar.SetObjectPosition(g_strButID[i]+\"Full\", \t\n\t\t\tg_nButPos[i][0], g_nButPos[i][1] -1000,\n\t\t\tg_nButPos[i][2], g_nButPos[i][3]);\n\t\t}\n\t\tDVD.CursorType = -1;\n\t}\n\n\tg_bActivityDeclined = true;\n\t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
FUNCTION NAME : checkNewPortValidation AUTHOR : Krisfen G. Ducao DATE : March 18, 2014 MODIFIED BY : REVISION DATE : REVISION : DESCRIPTION : PARAMETERS : | function checkNewPortValidation(val){
var msg = "Maximum port must not over is 65535."
if (val>=65535) {
error(msg,"Notification");
}
} | [
"function checkSlotPortNumber(){\n\tvar ipadd = GlobalMapPort.MAINCONFIG[0].DEVICE\t\n\tvar slot = \"\";\n\tvar newslot = \"\";\n\tvar slotnumber = $(\"#partnerslot\").val();\n\tvar ports = \"\";\n\tvar port = \"\";\n\tvar portid = \"\";\n\tvar val = $(\"#partnerhostname\").val();\n\tfor (var a=0; a<ipadd.length; a... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
generate given number of random containers | function getRandomContainers(amount, maxSize = 1000, maxValue = 1000) {
// const maxSize = 10; // fixed maxSize of container
// const maxValue = 10; // fixed maxVize of container
const containers = [];
for (let i = 0; i < amount; i++) {
let temp = getRandomIntInclusive(1, maxSize);
const element = {
... | [
"function generateTargets() {\n let number = 10;\n let result = [];\n while (result.length < number) {\n result.push({\n id: 'target-' + result.length,\n x: stage.width() * Math.random(),\n y: stage.height() * Math.random()\n });\n }\n return result;\n}"... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates the clustergrams' color legends and handles events. | function makeClustergramColorLegend(root, colors) {
var list = '',
isHidden = true,
MAX_CATS_BEFORE_HIDE = 20,
$legend,
$ul,
$h3;
$.each(colors, function(categoryName, hex) {
categoryName = $.trim(categoryName.split(':')[1]);
... | [
"function drawLegend() {\n var legend = $(\"#legend\");\n legend.empty();\n\n var legendContainer = $(\"<div>\");\n legendContainer.addClass(\"legendContainer\");\n\n // Nur die Labels, die wir auch anzeigen!\n for(var lbl of usedLabels.entries()) {\n var catId = lbl[0];\n var catego... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Finds a user by its id Parameters: 'id' (string type) id of the user, callback function Callback: error argument, user (mongoose document object) if there is no error or null otherwise | function userFind(id, cb){
User.findById(id, function (err, user) {
if (err){
if (cb) cb(err, null);
return;
}
if (cb) cb(null, user);
});
} | [
"function get_user_by_id(id, callback) {\n\n const error_handler = (error, res) => {\n const status = res.statusCode;\n let response_body = res.responseText;\n try {\n response_body = JSON.parse(response_body);\n } catch(e) {}\n\n if(error) return console.error('Der ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets the language of a literal in the N3 library | function getLiteralLanguage (literal) {
var match = /^"[^]*"(?:@([^@"]+)|\^\^[^"]+)?$/.exec(literal);
if (!match)
throw new Error(literal + ' is not a literal');
return match[1] ? match[1].toLowerCase() : '';
} | [
"function language (node) {\n let className = node.properties.className || []\n let length = className.length\n let index = -1\n let value\n\n while (++index < length) {\n value = className[index]\n\n if (value === 'no-highlight' || value === 'nohighlight') {\n return false\n }\n\n if (value.s... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
FIX LINE SERIES GROUP STRUCTURE Called from processContentGroup. NOTE: this is at least partly temporary, until I can fix in Sibyl There are 2 issues: Line grouping has an additional interposed group, so move line series subgroup up a level But also, this interposed group is duplicated, so I need to eliminate the 'dumm... | function fixLineSeriesGroupStructure(cGroup) {
// Loop, looking for the group
var gLen = cGroup.groupItems.length;
for (var gNo = gLen - 1; gNo >= 0; gNo--) {
// Hunt through the content group
var thisGroup = cGroup.groupItems[gNo];
if (thisGroup.name === c_itsAllLineSeriesOuterGroup) {
// This 'a... | [
"function bringMixedScaleLineSeriesToFront(contentLayer) {\r\n // debugger;\r\n var pItems = contentLayer.pathItems;\r\n // Is there a zero line?\r\n var zeroLine = lookForElement(contentLayer, 'pathItems', 'axis-zero-line');\r\n if (typeof zeroLine === 'undefined') {\r\n return;\r\n }\r\n // The problem ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
=================================================================================== Obtiene el menu dependiendo del role del usuario =================================================================================== | function obtenerMenu(ROLE) {
var menu = [{
titulo: 'Principal',
icono: 'mdi mdi-gauge',
submenu: [
{ titulo: 'Dashboard', url: '/dashboard' },
//{ titulo: 'ProgressBar', url: '/progress' },
//{ titulo: 'Grafica', url: '/grafica1' }
... | [
"static get noRole() { return NO_ROLE; }",
"function showAllRoles() {\n query = 'SELECT * FROM role;';\n connection.query(query, (err, results) => {\n if (err) throw err;\n console.table(results);\n // return to main menu\n askUser();\n });\n}",
"accountPageToHeader(){\n if(JSON.parse(sessionS... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Filters out events not attached to the primary pointer (currently left mouse button) | function filterPrimaryPointer(eventHandler) {
return event => {
var isMouseEvent = event instanceof MouseEvent;
var isPrimaryPointer = !isMouseEvent || isMouseEvent && event.button === 0;
if (isPrimaryPointer) {
eventHandler(event);
}
};
} | [
"function ignoreMouseEvents() {\n if ( $webSiteContainer==null ) return;\n\n $webSiteContainer.css(\"pointer-events\", \"none\");\n }",
"function disableMainPageButtons() {\n\t\t\tevents.forEach( ev => { \n\t\t\t\tev.button.mouseEnabled = false;\n\t\t\t\tev.button.cursor = \"default\";\n\t\t\t});\n\t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
readonly attribute AUTF8String startTimeZoneId; | get startTimeZoneId()
{
return this._startTimeZoneId;
} | [
"get parentZoneId() {\n return this.getStringAttribute('parent_zone_id');\n }",
"get zoneType() {\n return this.getStringAttribute('zone_type');\n }",
"generatePrivateId()\n\t{\n\t\tvar nanotime = process.hrtime();\n\t\treturn String(nanotime[0]) + nanotime[1] + '-' + this.name;\n\t}",
"ge... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
A background for debugging purposes | function _initDebugBackground() {
if (!this.options.debug) return;
this.containers.forEach(function(containerObj, i) {
var background = new Surface({
properties: {
background: 'black',
border: '1px dashed green',
zIndex: '-9999999'
... | [
"function _renderBackground () {\n\t_ctx.fillStyle = _getColor(\"background\");\n _ctx.fillRect(0, 0, _ctx.canvas.clientWidth, _ctx.canvas.clientHeight);\n}",
"function logbg(msg: any) {\n console.error('%o', msg)\n chrome.runtime.sendMessage({\n method: 'logging',\n source: 'popup.js',\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Saves changed filter to cookie, if rememberGridPosition enabled. | function saveFilterRowToCookie() {
if (div.settings.rememberGridPosition) {
var values = {};
$.each($('#' + div.settings.id + ' th .col-filter'), function() {
values[this.id] = $(this).val();
});
indiciaFns.cookie('report-filterrow-' + opts.id, JSON.stringify(... | [
"function cookieFromFilterpanel(){\n var ch = [];\n if ($j('.shop-filter-panel .filter-toggle').hasClass(\"open\")){\n ch.push(true);\n }\n\n $j.cookie(\"filterpanelCookie\", ch.join(','));\n}",
"function applySettingsFromCookies(opts) {\n var filterRow;\n var fieldname;\n var re... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Displays the Flickr default buddy icon if the buddy icon link is broken. | function showDefaultBuddyIcon(image_element) {
image_element.onerror = '';
image_element.src = 'https://www.flickr.com/images/buddyicon.gif';
return true;
} | [
"displayAvatar( message ){\n let allowedImageFileTypes = [ '.png', '.jpeg', '.jpg', '.gif' ];\n let accountWithAvatar;\n\n for( let account of this.accounts ){\n if( account.usernick === message.usernick ){\n accountWithAvatar = account.avatar;\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Copies the given Javascript String object 'str' to the emscripten HEAP at address 'outPtr', nullterminated and encoded in UTF16 form. The copy will require at most str.length4+2 bytes of space in the HEAP. Use the function lengthBytesUTF16() to compute the exact number of bytes (excluding null terminator) that this fun... | function stringToUTF16(str, outPtr, maxBytesToWrite) {
assert(typeof maxBytesToWrite == 'number', 'stringToUTF16(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!');
// Backwards compatibility: if max bytes is not specified, assume unsafe unbounded write is... | [
"function analyzeUTF8(str, maxByteLen)\n{\n var lengthInBytes = lengthInUTF8Bytes(str);\n var excessBytes = lengthInBytes - maxByteLen;\n if(excessBytes > 0) {\n var coef = lengthInBytes / str.length; // Number of bytes per one character.\n return Math.round(excessBytes / coef);\n }\n r... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create (multiple) notes that can be played for the specified arbitrary integer length | function createTiedNotes(noteToken, length) {
if (length !== (length | 0)) {
throw new Error("The input length is not integer");
}
const notes = [];
while (length > 0) {
const largest2 = Math.pow(2, (Math.log2(length) | 0));
length -= largest2;
... | [
"repeat (x) {\n\n const notes = this.notes;\n let res = [];\n\n for (let i = 0; i < x; i++) {\n res = res.concat(this.notes.map(a => ({...a})));\n }\n\n this.notes = res;\n return this;\n }",
"function _createSoundNote(step, alter, octave, duration, lyricTex... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Setter for the bundling parameters / Set the weight factor for each edge. | setWeight(factor) {
this.weightFactor = factor;
this.edges.forEach(edge => {
edge.weight = Math.pow(edge.dist, factor);
this.weight[edge.target][edge.source] = edge['weight']
this.weight[edge.source][edge.target] = edge['weight']
});
} | [
"setWeight(factor) { \n this.weightFactor = factor;\n\n this.edges.forEach(edge => {\n edge.weight = Math.pow(edge.dist, factor);\n\n this.weight[edge.target][edge.source] = edge['weight']\n this.weight[edge.source][edge.target] = edge['weight']\n });\n }",
... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates a client which will fetch an ID token for authorization. | async getIdTokenClient(targetAudience) {
const client = await this.getClient();
if (!('fetchIdToken' in client)) {
throw new Error('Cannot fetch ID token in this environment, use GCE or set the GOOGLE_APPLICATION_CREDENTIALS environment variable to a service account credentials JSON file.');... | [
"function initClient() {\n \n const keys = {\n // fill\n };\n\n return new Gdax.AuthenticatedClient(\n keys[\"API-key\"],\n keys[\"API-secret\"],\n keys[\"Passphrase\"],\n keys[\"Exchange-url\"]\n );\n}",
"function getClient() {\n return new googleapis.auth.OAu... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
returns list of albums from localStorage | static getAlbums() {
let albums;
if (localStorage.getItem('albums') === null) {
albums = [];
} else {
albums = JSON.parse(localStorage.getItem('albums'));
}
return albums;
} | [
"static addAlbum(album) {\n const albums = Storage.getAlbums();\n\n albums.push(album);\n\n localStorage.setItem('albums', JSON.stringify(albums));\n }",
"function getMusicLikedDataStorage(){\n const musics = localStorage.getItem(STORAGE_LIKED);\n if(!musics) return;\n return JSON.parse(musics)... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns an object that contains a new `CancelToken` and a function that, when called, cancels the `CancelToken`. | static source() {
let cancel;
const token = new CancelToken(function executor(c) {
cancel = c;
});
return {
token,
cancel
};
} | [
"canceledError() {\n const error = new Error(\"Canceled\");\n error.name = error.message;\n return error;\n }",
"cancel() {\n console.log('Canceling the transaction')\n return this.replace({\n from: this.manager.address,\n to: this.manager.address,\n value: 0,\n })\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
============================================= Funcion para insertar datos en la tabla ascensor_valores_iniciales ============================================== | function addItemsAscensorValoresIniciales(k_codusuario,k_codinspeccion,n_cliente,n_equipo,n_empresamto,o_tipoaccion,v_capacperson,v_capacpeso,v_paradas,f_fecha,v_codigo,o_consecutivoinsp,ultimo_mto,inicio_servicio,ultima_inspeccion,h_hora,o_tipo_informe) {
db.transaction(function (tx) {
var query = "INSERT INTO a... | [
"function addItemsAscensorValoresFinales(k_codusuario,k_codinspeccion,o_observacion) {\n db.transaction(function (tx) {\n var query = \"INSERT INTO ascensor_valores_finales (k_codusuario,k_codinspeccion,o_observacion) VALUES (?,?,?)\";\n tx.executeSql(query, [k_codusuario,k_codinspeccion,o_observacion], func... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Call function take largest value from voteCount and push the name to officers (not the numbers) | function pickWinner(voteCount) {
for(var office in voteCount) { // president, vicePresicent etc.
var maxVote = 0; // Numerical placeholder to compare numbers
var winner = ""; // placeholder
var officePosition = voteCount[office];
for(var name in officePosition) { // Bob, Mary etc.
... | [
"function finalSlate(voteCount) {\n for(var office in voteCount) {//targets office position in voteCount variable\n var highestTally = 0;\n var studentName = \"\";\n var officePosition = voteCount[office];\n for(var officerName in officePosition) {\n var tally = officePosition[officerName];\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Async JS callback function is used to be called after some code the callback function getPost is being invoked after the post being added | function addPost(post , callback){
setTimeout( () =>{
posts.push(post);
callback();
} , 2000);
} | [
"async publishPost () {\n\t\tif (!this.post.get('teamId')) { return; }\n\t\tawait new PostPublisher({\n\t\t\tdata: this.responseData,\n\t\t\trequest: this,\n\t\t\tbroadcaster: this.api.services.broadcaster,\n\t\t\tteamId: this.post.get('teamId')\n\t\t}).publishPost();\n\t}",
"function sendNewPostEvent(postData) {... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Retrieves all counties from the database. | getAllCounties(callback) {
super.query('SELECT * FROM county', [], callback);
} | [
"function getAll() {\n\t'use strict';\n\tds.historics.get(function(err, response) {\n\t\tif (err)\n\t\t\tconsole.log(err);\n\t\telse {\n\t\t\tconsole.log('Historic queries: ' + JSON.stringify(response));\n\t\t\tcheckStatus();\n\t\t}\n\t});\n}",
"function get_all_sucursals(req, res) {\n var sucursal_list = DBCo... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Resizes the help window | function resizeHelpWindow () {
//Matches the window dim effect layer to the window height.
dom.byId("helpUnderlay").style.height = win.getBox().h + "px";
//Finds out how many columns there are, creates array of heights
var helpLists = query(".help-list");
var helpColsCount = hel... | [
"static set helpBox(value) {}",
"function resizedw(){\n resizegraph();\n plotWithOptions(wg(formatedData), options);\n}",
"_handleResize(e) {\n this.resizeToolbar();\n }",
"function displayHelp() {\n\tlet helpText = require('../html/help.html.js');\n\tcreateDialog('show-dialog', 'Help', helpText... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Constructor for ApImageFullscreen plugin. | function ApImageFullscreen(elements, options) {
var self = this;
var settings = $.extend(true, {}, ApImageFullscreen.defaultSettings, options);
// Do not remake the fullscreen plugin
// BUT if autoReassign = true, we remove the element from it's previous fullscreen instance,
// so we can use it within this i... | [
"initFullscreen () {\n if (this.hasAttribute('fullscreen')) {\n let modalBody = this.shadowRoot.getElementById('modalId');\n this.width = '100%';\n this.height = '100%';\n this.top = '0%';\n modalBody.style.setProperty('--dialog-width', this.width);\n modalBody.style.setProperty('--... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Animates rotation of the face (by clockwise if cw), and then swaps stickers | function animateRotation(face, cw, currentTime) {
var k = .3 * (face % 2 * 2 - 1) * (2 * cw - 1),
qubes = Array(9).fill(pieces[face]).map(function (value, index) {
return index ? getPieceBy(face, index / 2, index % 2) : value;
});
(function rotatePieces() {
var passed = Date.now() - currentTime,
style... | [
"function animate() {\r\n requestAnimationFrame(animate);\r\n spirit_3.rotation -= 20;\r\n spirit_1.rotation += 100;\r\n renderer.render(stage);\r\n}",
"turnAround() {\n this.left(180);\n }",
"function changeFace(slideKey, keepSameDirectionOfRotation) {\n slideKey = slideKey || currentSlide... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Set status to red 'Overdue' in the book's patron's book table. | function changeToOverdue(book) {
// Add code here
const cardNumber = book.patron.cardNumber
const patronsDisplayed = patronEntries.querySelectorAll('.patron')
const table = patronsDisplayed[cardNumber].getElementsByTagName('tbody')[0]
const rows = table.querySelectorAll('tr')
for (var i = 1; i < rows.length; i++)... | [
"function changeToOverdue(book) {\n\t// Add code here\n\tconsole.log('changeToOverdue', book.title)\n\n\t// Add code here\n\tconst Patron = book.patron\n\tconst table = PatronTableFind(Patron)\n\tconst bookID = book.bookId\n\n\tlet c_Line = table.firstElementChild.firstElementChild.nextElementSibling\n\tlet c_BookI... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Executes after the fragment path has changed. Shows a confirmation dialog to the user if the current configuration is to be reset and updates the fields to reflect the newly selected content fragment. | function onFragmentPathChange() {
// if the fragment was reset (i.e. the fragment path was deleted)
if (!fragmentPath.value) {
var canKeepConfig = elementsController.testStateForUpdate();
if (canKeepConfig) {
// There was no current configuration. We just need to ... | [
"function afterChange() {\n\n\t\t\t// Make current page inactive\n\t\t\tcurrentContentPage.classList.remove('active');\n\t\t\thelper.setData(currentContentPage, 'currentcontent', false);\n\n\t\t\t// Set the title\n\t\t\telems.dashboardContentTitle.innerHTML = helper.getData(newPage, 'title');\n\n\t\t\tdocument.titl... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
follow() creates a relationship between `fromId` and `toId` and returns an empty Promise. For an initial request, `toId` is added to `fromId`s `requested` list, and `fromId` is added to `toId`s `pending` list. For a reciprocal request, `toId` is removed from `fromId`s `pending` list, and `fromId` is removed from `toId`... | follow(fromId, toId) {
return new Promise((resolve, reject) => {
// check if this is an initial or reciprocal request
this.client.zscore(`${this.namespace}:user:${fromId}:${STATE_KEY.pending}`, toId, (err, result) => {
if (err) { reject(err); }
// use date for sorted set ordering
... | [
"function updateFollowers() {\n const alreadyFollowersArray = models.users\n .findById(followingId)\n .then((resultUser) => {\n return resultUser.get({\n plain: true\n }).followers;\n });\n\n return alreadyFollow... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Dispatch action to toggle info window when user closes info window. | handleOnInfoWindowClose(clazzRef) {
this.props.dispatch(action.toggleMarkerIW(
clazzRef.props.anchor.getPlace().placeId, null, actionType.TOGGLE_TYPE_INFO_WINDOW));
} | [
"toggleWindow(marker,infoWindow) {\n // If it is already associated to the marker and thus open, closes it and removes\n // animations\n if(infoWindow.marker === marker) {\n infoWindow.marker = null;\n marker.setAnimation(null);\n infoWindow.close();\n } else {\n // else,... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sets the search history | function setSearchHistory (searchHistory) {
localStorage.setItem("searchHistory", JSON.stringify(searchHistory));
} | [
"updateHistory(flag) {\n this.search.current = `?status=${this.params.status.join('+')}&assignee=${this.params.assignee.join('+')}`;\n if (!flag) window.history.pushState({ state: this.search.current }, this.search.current, ('search' + this.search.current));\n }",
"function populateSearchHistory(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
cookies for filter block | function cookieFromFilterpanel(){
var ch = [];
if ($j('.shop-filter-panel .filter-toggle').hasClass("open")){
ch.push(true);
}
$j.cookie("filterpanelCookie", ch.join(','));
} | [
"function bakeCookies() {\n\n}",
"_initCookies() {\n\n const KEY = window.btoa('' + Math.random() * Math.random() * Math.random() * Math.PI),\n COOKIE = new Cookies(),\n PREFIX = 'default-wid';\n // expire cookie a month from now\n let expDate = new Date(Date.now());\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns array of verbs from the ADL list | getVerbsList() {
// return Object.keys(VerbDictionary).map((key) => VerbDictionary[key].display[defaultLanguage]);
return this.getDictionaryWordsList(ADLVerb);
} | [
"static getValidVerbs() {\n return [\n SUPPORTED_VERBS.GET,\n SUPPORTED_VERBS.PUT,\n SUPPORTED_VERBS.POST\n ];\n }",
"agencies(cb) {\n var agencies = [ ];\n\n this._newRequest().query({ command: 'agencyList' }, function(e) {\n switch(e.name) {\n case '... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Search on HP The search button should send us to an address according to the thing selected in the select | function do_search() {
var $form = $('#search-form');
var option = $form.find('select[name=action] option[selected]').val();
if (!option) return false;
var search_terms = $form.find('input[name=q]').val();
var url = str_concat(option , '?q=' , search_terms);
adr(url);
... | [
"function search() {\n\t\tvar searchVal = searchText.getValue();\n\n\t\tsources.genFood.searchBar({\n\t\t\targuments: [searchVal],\n\t\t\tonSuccess: function(event) {\n\t\t\t\tsources.genFood.setEntityCollection(event.result);\n\t\t\t},\n\t\t\tonError: WAKL.err.handler\n\t\t});\n\t}",
"function doSearch(){\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Automatically build diagram by input JSONmessage with information about tables, views, references and etc. autoPlacement flag, if set true, elements are placed on the virtual grid | function buildDiagram(jsonData, elementName, autoPlacement) {
var view = joint.dia.LinkView.extend({
mouseover: function (evt, x, y) {
},
mouseout: function () {
}
});
var graph = new joint.dia.Graph;
var mainPaper = new joint.dia.Paper(... | [
"function renderViz() {\n\n // Define variables for viz\n var mainVizDiv = $(\"#tableauViz\");\n var mainVizOptions = {\n hideTabs: true,\n hideToolbar: true,\n //toolbarPositon: top, // (or \"bottom\")\n width: 850,\n height: 860,\n onFirstInteractive: function (... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Handles when the currently loaded approach has been changed. | handleApproachChanged() {
if (this.currentApproachName.startsWith('RN')) {
this.approachMode = WT_ApproachType.RNAV;
if (this.currentLateralActiveState === LateralNavModeState.APPR) {
this.isVNAVOn = true;
}
if (this.currentVerticalActiveState === VerticalNavModeState.GS) {
... | [
"__i18nChanged() {\n this.__updateDrawerAriaAttributes();\n }",
"_onThemeChanged() {\n this._changeStylesheet();\n if (!this._disableRedisplay)\n this._updateAppearancePreferences();\n }",
"handleVPathChanged() {\n this.vPathState = this._inputDataStates.vpath.state;\n this... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Emit the gameOver event for the give player rankings | function announceResults() {
socket.sockets.emit("gameOver");
} | [
"function gameOver() {\n update($question, \"Game Over. You scored \" + score + \" points.\");\n }",
"function winOrLose() {\n if (playerScore === randomNum) {\n winsCounter++;\n $(\"#wins\").html(\" \" + winsCounter);\n startGame();\n } else if (playerScore > randomNum) {\n lossCo... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
save opts into object | function saveOpts($this, opts) {
return $this.data('accordion-opts', opts);
} | [
"function saveOptions() {\n\t\t\tif (supported('localStorage') && options.saving) {\n\t\t\t\tlocalStorage.setItem('ADI.options', JSON.stringify(options));\n\t\t\t}\n\t\t}",
"function writeOptions () {\n needsToSave = false\n fs.writeFile('options.json', JSON.stringify(settings, null, 2), 'utf8')\n}",
"saveCli... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
twoNums([2,5,5,11], 10); twoNums([2,7,11,15], 9); 3. Gas station problem. you have two array s the same length, N. number of gas staions = [1,2,3,4,5], in a circular route. each station has gas[i] amount of fuel there you have a car with an unlimited gas tank, but it costs fuel to get from one statio nto the next. the ... | function gasStation(gas, cost){
// first thing, compare sum(gas) to sum(cost), if the total cost is higher than the amount of gas you get, there is no solution, so right away you return -1, let's check. Get sum of each array =...
var sum = gas.reduce(function(a, b){
return a + b;
}, 0);
var sum2 = cost.redu... | [
"function roadsInHackerland(n, roads) {\n function removeDuplicateRoad(roads) {\n let roadKey2Cost = new Map(), changed = false;\n for (let road of roads) {\n let smaller = (road[0] < road[1] ? road[0] : road[1]), bigger = (road[0] > road[1] ? road[0] : road[1]), roadKey = smaller + ':' ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Registers a scrollable instance with the service and listens for its scrolled events. When the scrollable is scrolled, the service emits the event to its scrolled observable. | register(scrollable) {
if (!this.scrollContainers.has(scrollable)) {
this.scrollContainers.set(scrollable, scrollable.elementScrolled()
.subscribe(() => this._scrolled.next(scrollable)));
}
} | [
"_listenToScrollEvents() {\n this._viewportScrollSubscription = this._dragDropRegistry\n .scrolled(this._getShadowRoot())\n .subscribe(event => {\n if (this.isDragging()) {\n const scrollDifference = this._parentPositions.handleScroll(event);\n i... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Load free gifts and add them to the select field | function load_free_gifts() {
request('xw_controller=freegifts&xw_action=view&xw_city=1&tmp=&cb=&xw_person='+User.id.substr(2)+'&mwcom=1&popup=1&showFriends=&friendSnid=undefined&ref=hud_icon&xw_client_id=8&ajax=1&liteload=1&fbml_iframe=1',function(msg){
var m,gifts={},html='<select id="'+spocklet+'_sel">';
i... | [
"function loadPropertySelectData() {\n \"use strict\";\n var i;\n //depend on how many select tap.\n for (i = 0; i < getSelectID.length; i++) {\n createP_Option(getSelectID[i]);\n }\n}",
"function loadSelect(select,data){\n\tvar options = buildOption(data);\n\tselect.html(options);\n}",
"f... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
VxEuclideanRythm k numbers of pulses (1 in the binary sequence) N length of the binary sequence (number of steps) R rotation to apply (the rotation to apply) integermode = if value is set to 'inc' then will replace each 'pulse' by their respective pulse index position. ex: 100100100 > 100200300. algorithm = if value is... | function VxEuclideanRythm ()
{
this.k = 4;
this.N = 16;
this.R = 0;
this.algorithm = 'bjorklund';
this.integermode = 0;
} | [
"function rotateClockwise(){\n let result = [];\n let obj={};\n for (let i=arguments[0].length-1; i>=0; i--){\n for(let j=0; j<arguments[0][i].length; j++){\n let arr = [arguments[0][i][j]];\n if (Array.isArray(obj[j])){\n \t//result[val.toLowerCase()] = (result[val.toLowerCase()] || 0) + 1;\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Permet le positionnement automatique en cliquant sur le bouton. | autoPositionBoats() {
this.HTMLElement.autoPositionButton.addEventListener('click', () => {
if (!this.gameEvent.isStart()) {
this.grid1.reset();
this.grid1.installBoatAuto();
this.grid1.validPositionAuto();
}
else
... | [
"function updateTogglePosition() {\n if (\n window.innerHeight + window.scrollY >\n banner.offsetHeight + main.offsetHeight\n ) {\n toogleContainer.classList.remove(\"pos-fixed\", \"top\");\n toogleContainer.classList.add(\"pos-abs\", \"bottom\");\n } else if (\n window.innerHeight... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Mark the user as viewed by a specific user. | function viewUser(req, res) {
// find the user with the specified source id
User.findOne(
{_id: req.params.source},
function(err, user) {
// output an error message if an error occurs or
// the target user could not be marked as viewed
if(err || !user) {
return res.send({error: 'Un... | [
"function selectUserForEdit(user) {\n setUserData(user)\n }",
"function userView(targetid, user){\n apply_template(targetid, \"user-detail-template\", user);\n}",
"set user(aValue) {\n this._logger.debug(\"user[set]\");\n this._user = aValue;\n }",
"set user(aValue) {\n this._logService.debug... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |