query stringlengths 9 34k | document stringlengths 8 5.39M | negatives listlengths 19 20 | metadata dict |
|---|---|---|---|
Add the background color to the navbar if the header component is outside the viewport, otherwise remove the background color from the navbar: | function backgroundColor() {
if (panache.inview(header, 68)) {
panache.addClass(nav, 'is-transparent');
} else {
panache.removeClass(nav, 'is-transparent');
}
} | [
"function navbarBg() {\n var menu = document.getElementsByClassName(\"nav-menu\")[0];\n var viewPort = document.getElementsByTagName(\"header\")[0];\n\n if (menu.id !== \"menu-down\") {\n if (document.body.scrollTop > 60 || window.pageYOffset > 60 || document.documentElement.scrollTo... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
TransparentColorControl: Configuration control for colors | function TransparentColorControl(parent, initialValue, toolTip)
{
this.__base__ = Control;
if (parent)
this.__base__(parent);
else
this.__base__();
this.color = initialValue;
this.onColorChanged = null;
this.color_ComboBox = new ColorComboBox(parent);
this.color_ComboBox.setCurrentCol... | [
"initColorControls_() {\n // default to showing nothing\n this['showColorPicker'] = false;\n this['showColorReset'] = false;\n this['showBasicColor'] = false;\n this['showHue'] = false;\n\n var nodes = this.getLayerNodes();\n if (nodes && nodes.length > 0) {\n // make sure all selected lay... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
the `canBeValidated = false` argument suggests, that the cell passes validation by default. | function done(valid) {
var canBeValidated = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
// Fixes GH#3903
if (!canBeValidated || cellProperties.hidden === true) {
callback(valid);
return;
}
var col = cellProperties.visualCol;
var row = c... | [
"unvalidateCells() {\n for (let i = 0; i < this.view.board.cells.length; i++)\n this.view.board.cells[i].valid = false;\n }",
"function validateCell( row, col, value ) {\n\n if( _sotable == null ) {\n _sotable = $(_htableid).handsontable('getInstance');\n }\n\n //console.log( ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
check if the bot is playing music | function is_bot_playing() {
return voice_handler !== null;
} | [
"function player_available_music() {\n\treturn data_music.length > 0;\n}",
"checkOnMusic()\n { \n if(!this.mainWebSound.isPlaying && !this.mainWebSound.loop)\n {\n this.mainWebSound = this.mainPossibleLoop;\n this.playNoFade(this.mainWebSound);\n }\n }",
"... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Callback for the pointerdown event for the ghost anchor. | onGhostPointerDown(e) {
this.ghostAnchor.node.setPointerCapture(e.pointerId);
this.dragOrigin = new Point2D_1.Point2D(e.offsetX, e.offsetY);
this.onChange(this, this.regionData.copy(), IRegionCallbacks_1.ChangeEventType.MOVEBEGIN);
} | [
"onGhostPointerUp(e) {\r\n this.ghostAnchor.node.releasePointerCapture(e.pointerId);\r\n this.onChange(this, this.regionData.copy(), IRegionCallbacks_1.ChangeEventType.MOVEEND);\r\n }",
"function onPointerDown (e) {\n console.log('down')\n const { x, y } = e.data.global\n pointerDownTarg... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates a modal dialog box, and appends only the part data (using "getInvData()") inside a tag at the end of the html file | function createDialogWithPartData(title,templateName,width) {
var ui = SpreadsheetApp.getUi();
var createUi = HtmlService.createTemplateFromFile(templateName).evaluate().getContent();
var html = HtmlService.createTemplate(createUi+
"<script>\n" +
... | [
"function appendDialogBox(){\n\t\t\t\t$(\"body\").append('<div id=\"drunk-amazon-dialog-box\" class=\"drunk-amazon-modal\" role=\"dialog\">' +\n\t\t\t\t\t\t\t\t\t\t\t\t '<div id=\"drunk-amazon-header\">' +\n\t\t\t\t\t\t\t\t\t\t\t\t '<p class=\"drunk-amazon-lead\">Cool your jets buddy, prove you\\'re sober enough to... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
deletes all markers and infowindows on the map | function deleteMarkers() {
infowindows.length = 0;
for (marker of markers) {
marker.setMap(null);
}
markers.length = 0;
} | [
"function clearLocationMarkers() {\n infoWindow.close();\n for (var i = 0; i < markers.length; i++) {\n markers[i].setMap(null);\n }\n markers.length = 0;\n}",
"function deleteMarkers(){\r\n setAllMap(null);\r\n markers = [];\r\n}",
"function deleteAllMarkers() {\n for (var i = 0; i < al... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Renders the AWS CloudFormation properties of an `AWS::CloudFront::Distribution.LambdaFunctionAssociation` resource | function cfnDistributionLambdaFunctionAssociationPropertyToCloudFormation(properties) {
if (!cdk.canInspect(properties)) {
return properties;
}
CfnDistribution_LambdaFunctionAssociationPropertyValidator(properties).assertSuccess();
return {
EventType: cdk.stringToCloudFormation(propertie... | [
"function functionResourcePropsToCloudFormation(properties) {\n if (!cdk.canInspect(properties)) {\n return properties;\n }\n FunctionResourcePropsValidator(properties).assertSuccess();\n return {\n Code: functionResourceCodePropertyToCloudFormation(properties.code)... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Load all files inside `startPath`, and also all opened documents. | async loadStartData() {
console.timeStart('track');
for (let document of this.documents.all()) {
if (this.shouldTrackFile(vscode_uri_1.URI.parse(document.uri).fsPath)) {
this.trackOpenedDocument(document);
}
}
if (this.alwaysIncludeGlobPattern) {
... | [
"function readFilesProcess(startPath, targetDirectory) {\n // get full path of the directory\n const layerPath = path.join(startPath, targetDirectory);\n // read all files\n const layerFiles = fs.readdirSync(layerPath);\n\n const accumulator = {\n pageTitles: [],\n fullPages: {},\n directories: [],\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Connects all the neurons of one layer to all the inputs of a second one | connectInput(backLayer, weight = null) {
for (let backNeuron of backLayer) {
for (let frontNeuron of this) {
frontNeuron.connectInput(backNeuron, weight);
}
}
return this;
} | [
"connect() {\n\t\tfor(var i = 0; i < this.layers.length; i++) {\n\t\t\tvar currentLayer = this.layers[i];\n\t\t\tvar nextLayer = this.layers[i+1];\n\t\t\tif(nextLayer) {\n\t\t\t\tfor(var j = 0; j < currentLayer.neurons.length; j++) {\n\t\t\t\t\tvar currentNeuron = currentLayer.neurons[j];\n\t\t\t\t\tfor(var k = 0; ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create alarm if user enters a valid float. Triggered on enter keydown in alarmCreate form. | function createAlarm(e) {
if (e.keyCode !== 13)
return;
input = document.getElementById("alarmCreate").value;
var duration = parseFloat(input);
if (isNaN(duration))
alert("Invalid time duration entered!");
else {
var name = "Alarm " + Date.now(); // Generate unique a... | [
"function createDaily(event) {\n \n var objectStorage,\n $input = $(event.target),\n val = $input.val().trim();\n\n\t\tif ((event.which !== 13) || (!val)) {\n\t\t\treturn;\n\t\t}\n \n\t\tobjectStorage = {\n 'val': val,\n 'isChecked': false\n };... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Append the filters form to the given container | function add_filters(container) {
var form = document.createElement('form');
form.className = "filter form-control";
form.innerHTML = `<!-- Description -->
<div>
<label for="title">Description</label>
<input id="title" type="text" name="title[text]" value="">
<div class="options">
<input id="... | [
"addFilters() {\n const { $, i18next } = this;\n \n const div = $(\"<div>\");\n div.append(i18next.t('filter.title'));\n // Iterate over each filter group\n $.each(this.filters, (_, group) => {\n // Set button group\n const grp = $(\"<div>\", { class: ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Ticket numbers usually consist of an even number of digits.A ticket number is considered lucky if the sum of the first half of the digits is equal to the sum of the second half. Given a ticket number n, determine if it's lucky or not. Example For n = 1230, the output should be isLucky(n) = true; For n = 239017, the out... | function isLucky(n) {
const numberToString = n.toString();
let firstHalf = 0;
let secondHalf = 0;
for (let i = 0; i < numberToString.length; i++) {
const length = numberToString.length;
const number = parseInt(numberToString[i]);
if (i <= (length / 2) - 1) {
firstHalf += number;
} else {
... | [
"function isLucky(n){\n const ticketNumString = n.toString();\n const firstHalf = ticketNumString.substring(0, ticketNumString.length / 2);\n const secondHalf = ticketNumString.substring(ticketNumString.length / 2);\n \n const firstHalfSum = firstHalf.split('').reduce( (a, b) => parseInt(a) + parseIn... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Filters the arguments to return the value of the `glob=` option. | function getGlobArg(args) {
const found = args.find((a) => a.startsWith(GLOB_OPTION));
return found ? found.substring(GLOB_OPTION.length) : null;
} | [
"function glob(/* patterns... */) {\n return glob.pattern.apply(null, arguments);\n }",
"function simple_glob(glob) {\n if (Array.isArray(glob)) {\n return [].concat.apply([], glob.map(simple_glob));\n }\n if (glob && glob.match(/[*?]/)) {\n var dir = path.dirname(glob);\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Grabs package registry metadata and returns an array of package names and their tarball URLs, via an array of package names and versions | function getTarballUrls (packagesMetadata) {
var constructedUris = packagesMetadata.map(function (metadata) {
return REGISTRY_URI + `${metadata[0]}/${metadata[1]}`
})
return Promise.map(constructedUris, function (uri) {
return request({uri: uri, timeout: 5000, json: true})
// return the tarball url... | [
"function getPublishedVersions() {\n const { name } = pkg;\n const cmd = `yarn info ${name} versions --json`;\n const result = shell.exec(cmd, {\n silent: true,\n shell: '/bin/bash',\n });\n if (result.code !== 0) {\n console.error(`Unable to fetch versions for ${name}`);\n console.log(result.stdou... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
declare the targetScore variable that will be displayed to the page and the user will try to match (between 19 and 120) | function generateTargetScore() {
targetScore = Math.floor(Math.random() * 100) + 20;
// display the targetScore to the screen in the appropriate div
$("#target-score").html("Target Score: " + targetScore);
console.log("generate target " + targetScore);
} | [
"function targetScoreVal () {\n\ttargetScore = randomNum(20, 50);\n\t$(\"#targetScore\").html(\"<h2> Target Score: \" + targetScore);\n}",
"function getTargetScore() {\n targetScore = Math.floor(Math.random()*(120-19+1)+19);\n}",
"function getTargetScore() {\n min = Math.ceil(19);\n max = Math.floor(120)... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Open the mobile app's local database | function openDB() {
debug && console.log( "MobileDb.openDB: Opening DB" );
if ( db == null ) {
try {
db = window.openDatabase( "CrownSFA", "1.0", "CrownSFA", 1024000000 );
debug && console.log( "MobileDb.openDB: Database opened" );
} catch ( e ) {
... | [
"function open(){\n return openDatabase('bernAppDb', '1.0', 'Database for the bernApp.', 2 * 1024 * 1024);\n }",
"function setupDB() { \n db = window.openDatabase(\"appContentsDB\", \"1.0\", \"HamiltonCollege\", 200000);\n audDB = window.openDatabase(\"appAudience\", \"\", \"HamiltonCollege\", ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get last 50 messages in chat. | get getLastMessageList () {
//
const limit = this
.request
.input('limit', null)
return Message
.query()
.notDeleted()
.with('user')
.limit(limit || 50)
.orderBy('id', 'desc')
.fetch()
} | [
"function getLatestMessages(profile) {\n return profile.get('direct_messages/sent', \n \t{ screen_name: profile.screen_name, \n \t count: 5 \n \t});\n}",
"getLimitedMessages(limit = 10 : number) {\n return Template.currentData().chat.messages.splice(0, limit);\n }",
"function get_200_messages(m... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
if it can return s.match(re)[g], if not, but def is passed, return def, otherwise throw an exception | function match(s, re, g, def){
var r = s.match(re);
if(r && r.length > g) return r[g];
if(def!==undefined) return def;
throw new Error('match: '+re+'['+g+']');
} | [
"static matchDo(regExString, s, func) {\n var m = s.match(regExString)\n if (m) {\n return func.call(...m)\n }\n }",
"function regex_getmatch(argument0)\n{\n\ttry\n\t{\n\t\tif (argument0<0 || argument0>keys.length)\n\t\t\treturn \"\";\n\t\tif (keys[argument0]==null)\n\t\t\treturn \"\";\n\t\treturn ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Initialises the website: binds even listeners, gets the data, calls app() when the page loads. | function init() {
const params = getUrlParameters() // valuable information is encoded in the URL
const dataPromise = loadData(params) // start loading the data
const callback = () => app(params, dataPromise)
// set error handlers
window.addEventListener("error", errorHandler)
window.addEventListener("unhandledr... | [
"function init() {\n setupApplication();\n createWorld();\n createCamera();\n\n loadLevel(app.level.name);\n\n console.info('Web app loaded');\n }",
"function init() {\n\twindow.addEventListener(\"error\", errorHandler)\n\twindow.addEventListener(\"unhandledrejection\", error... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns true if reading nbytes starting at offset is inbounds for the given DataView, false otherwise. | function inBounds (view, nbytes, offset) {
return (offset + nbytes) <= view.byteLength
} | [
"hasOffset (offset) {\n let min = this.offset\n let max = min + this.length\n return offset >= min && offset <= max\n }",
"fits_memory(offset, len) {\n return utils.toNum(offset) + utils.toNum(len) < this.memory.length;\n }",
"contains(offset) {\n return (offset >= this.start) && (offset ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Write varintencoded tag and argument to output. | write_tag(tag, arg) {
this.write_varint(tag | (arg << 3));
} | [
"writeTag(tag, arg) {\n this.writeVarInt(tag | (arg << 3));\n }",
"writeVarInt(num) {\n if (num > Number.MAX_SAFE_INTEGER) {\n throw new RangeError(\"Could not encode varint\");\n }\n this.ensure(8);\n while(num >= 0x80000000) {\n this.buffer[this.pos++] = (num & 0xFF) | 0x80;\n num... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
called in gamap.js to display the pie graph using the data passed in. | function displayPieGraph(data) {
console.log(data)
var pie = d3.layout.pie()
.value(function(d) { return +d.votes; })
.sort(null);
piePath = d3.select('.pie-chart')
.selectAll('path')
.data(pie(data));
piePath
.transition()
.duration(500)
.attrTween("d", arcTween);
// g.select... | [
"function render_pieGezelschap() {\n var plotPie = hgiPie().mapping(['name','value']);\n d3.select('#pieGezelschap').datum(data_gezelschap).call(plotPie);\n}",
"function render_pieGezelschap() {\n var plotPie = hgiPie().mapping(['name', 'value']);\n d3.select('#pieGezelschap').datum(data_gezelschap).call(plot... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
on :: (b > b > c) > (a > b) > a > a > c . . Takes a binary function `f`, a unary function `g`, and two . values `x` and `y`. Returns `f (g (x)) (g (y))`. . . This is the P combinator from combinatory logic. . . ```javascript . > S.on (S.concat) (S.reverse) ([1, 2, 3]) ([4, 5, 6]) . [3, 2, 1, 6, 5, 4] . ``` | function on(f) {
return function(g) {
return function(x) {
return function(y) {
return f (g (x)) (g (y));
};
};
};
} | [
"function lift(op) {\r\n return function (f, g) {\r\n return x=> op(f(x), g(x));\r\n }\r\n}",
"function liftf(binary){\n return function(x){\n return function (y){\n return binary(x, y);\n };\n };\n}",
"function liftf(binary) {\n return function(first) {\n return function... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Checks if an array of points is clockwise. | static isClockwise(points) {
// make positive
let tSubX = Math.min(0, Math.min.apply(null, Utils.map(points, function(p) {
return p.x;
})));
let tSubY = Math.min(0, Math.min.apply(null, Utils.map(points, function(p) {
return p.x;
})));
var tNewPoi... | [
"static isClockwise(points) {\n // make positive\n let tSubX = Math.min(0, Math.min.apply(null, Utils.map(points, function(p) {\n return p.x;\n })));\n let tSubY = Math.min(0, Math.min.apply(null, Utils.map(points, function(p) {\n return p.x;\n })));\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
add the hidden class to all the squares and make the array with the position of all the bombs | function addBombs(){
numBombs.innerHTML = bombAmount
suffledArray = gameArray.sort(()=>Math.random()-0.5);
//you can see where are the bombs in the console
console.log(suffledArray)
squares.forEach(square =>{
square.classList.add('hidden');
})
} | [
"revealBombs() {\n this.bombsArray.forEach(bomb => {\n const { domElement } = this.board[bomb.row][bomb.col];\n changeClass(domElement, domObjects.fieldClass, domObjects.bombClass);\n });\n }",
"revealAllMines(squares){\n for(let i = 0; i < this.state.height; i++){\n for(let j = 0; j < th... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns the plaintext contents of all rich text widgets within the provided doc or area, concatenated as a single string. By default the rich text contents of the various widgets are joined with a newline between. You may pass your own `options.delimiter` string if you wish a different delimiter or the empty string. Wh... | plaintext(within, options) {
options = options || {};
const richText = self.richText(within, options);
let plaintext = self.apos.util.htmlToPlaintext(richText).trim();
plaintext = plaintext.replace(/\n+/g, '\n');
if (!options.limit) {
return plaintext;
}
... | [
"richText(within, options) {\n options = options || {};\n function test(attachment) {\n if (!attachment || typeof attachment !== 'object') {\n return false;\n }\n if (!_.includes(self.richTextWidgetTypes, attachment.type)) {\n return false;\n }... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Helps decide if a link should be relative or absolute. | function isRelative (linkData) {
let routeIdentifier = _.get(linkData, 'routeIdentifier'),
publicHandle = _.get(linkData, 'routeParams.publicHandle'),
wid = _.get(linkData, 'routeParams.wid');
return (routeIdentifier === 'workspace.open') && publicHandle && wid;
} | [
"function isAbsolutePath(href) {\n return constants_1.default.ABS_URL.test(href);\n}",
"isRelative() {\n return ! this.isAbsolute()\n }",
"function isRelative(href) {\n try {\n var parsed = url.parse(href);\n\n return !!(!parsed.protocol && parsed.path);\n } catch(err) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
if geolocation available, sets data for current weather with desired units | function setData(units) {
navigator.geolocation.getCurrentPosition(
function(position) {
//retrieves coords
var lat = position.coords.latitude;
var lon = position.coords.longitude;
//call owm api
$.getJSON(getApiUrl(lat, lon, units), function(data) {
//prints json response fr... | [
"function updateWeather() {\n\t\tconsole.log('updating weather data...')\n\t\tgetLocation();\n\t}",
"function updateWeather() {\n\t\tvar cityName = 'Vancouver';\n\t\tif (citySpecified) {\n\t\t\t// just set the value of cityName\n\t\t\t// cityName = \"something\";\n\t\t\tgetWeather(cityName);\n\t\t} else {\n\t\t\t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Given an object 'mesh' in the format returned by parsing an OBJ file with 'parse_OBJ_text()', modifies the passed object to have '.vertex.tangents' and '.vertex.bitangents' vertex properties and '.faceVertexIndices.tangents' and '.faceVertexIndices.bitangents' face properties with pervertex tangents and bitangents calc... | function insert_per_vertex_tangents_to_parsed_OBJ( mesh )
{
/// 1 Initialize each vertex tangent and bitangent to zero.
/// 2 Iterate over each face and calculate the xyz-to-uv mapping for its edge vectors.
/// 3 Use the mapping to recover xyz vectors for the u and v directions.
/// ... | [
"function normalize_parsed_OBJ( mesh )\n {\n /// 1 Initialize a min and max variable for x,y,z.\n /// 2 Iterate over each vertex and update the min and max.\n /// 3 Iterate again over each vertex, translating it by -(min+max)/2\n /// and scaling it by one over the maximum coordinate... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function to edit spot in Firebase | updateSpot(spot) {
const current_spot = this.props.navigation.state.params.spot;
let the_spot = firebase.database().ref(`spots/${current_spot.key}`);
// find the spot in database
the_spot
.update({
description: spot.description,
price: spot.price
})
.then(() => {
... | [
"function editParty(partyID) {\n var party = fb.child(partyID);\n party.update({\n partyName: $name,\n location: {\n street: $street,\n city: $city,\n state: $state,\n zip: $zip\n\n },\n cost: $cost,\n url: $url\n },\n function(error) {\n if (error) {\n alert(\"Data co... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Computed style for horizontal scroll element. This is computed so that its width matches table's width and the table and the element can share same scrolling. | @computed('hasFixedColumn', 'bodyColumns.@each.width')
get horizontalScrollStyle() {
let style = '';
let hasFixedColumn = this.get('hasFixedColumn');
let columns = this.get('bodyColumns');
let width = 0;
for (let i = hasFixedColumn ? 1 : 0; i < columns.length; i++) {
width += get(columns[i]... | [
"@computed(\n 'hasFixedColumn',\n 'bodyColumns.firstObject.width',\n 'allColumnWidths',\n '_width'\n ) get horizontalScrollWrapperStyle() {\n let columns = this.get('bodyColumns');\n let visibility = this.get('_width') < this.get('allColumnWidths') ? 'visibility' : 'hidden';\n let left;\n i... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
want to use a prime arrayLen too (aka the length of the array that we're converting to a hash) | function hash(key, arrayLen) {
let total = 0;
//prime numbers reduce collisions - many hashes use prime numbers
let WEIRD_PRIME = 31;
// taking the min solves the speed issue (we'll take the smaller number between length of array and 100)
for (let i = 0; i < Math.min(key.length, 100); i++)... | [
"function hash(key, arraylength){\n let total=0;\n let primeNumber=31\n\n for(let i=0;i<Math.min(arraylength, 100); i++){\n //pulling the individual character of the key\n //and converting each character to an alphabetic\n //ranking and adding the prime number and diving it by the array l... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Bleno key characteristic read handler. | function onReadRequest(offset, callback) {
if (readTimeout === null) {
if (DEBUG) console.log(`KEY READ: ${currentClient}`);
clearTimeout(connectionTimeout);
currentSubjects++;
readTimeout = setTimeout(() => {
bleno.disconnect();
}, Config.readTimeout * 1000);
}
callback(Characteristic.RESULT_SUCCESS, c... | [
"async doCharacteristicRead(op) {\n try {\n const char = new Characteristic(op.characteristicUUID, op.serviceUUID);\n char.value = await this.bluetoothAdapter.readCharacteristicValue(op.deviceAddress, char);\n this.mqttFacade.reportCharacteristicRead(op.deviceAddress, char);\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
/ Get Period Game Odds by Week / / Year of the season, with optional season type. Examples: 2018, 2018POST, etc. / The week of the scores (games). Examples: 1, 2, etc. | getPeriodGameOddsByWeekPromise(season, week){
var parameters = {};
parameters['season']=season;
parameters['week']=week;
return this.GetPromise('/v3/nfl/odds/{format}/AlternateMarketGameOddsByWeek/{season}/{week}', parameters);
} | [
"function GamesPerWeek(season, week, type, games) {\n\tthis.season = season; // Season year\n\tthis.week = week; // Season week\n\tthis.type = type; // Season type\n\tthis.games = games; // number of games\n}",
"getPreGameOddsByWeekPromise(season, week){\n var parameters = {};\n parameters['season']... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
function to add a tweet to local storage | function addTweetLocalStorage(tweet) {
let tweets;
tweets = checkTweetsLocalStorage();
tweets.push(tweet);
localStorage.setItem('tweets', JSON.stringify(tweets));
} | [
"function addtweet(tweet){\n let tweets= gettweet();\n tweets.push(tweet); \n localStorage.setItem('tweets', JSON.stringify(tweets));\n}",
"function addTweetsToLocalStorage(tweet) {\n let tweets = getTweetsFromLocalStorage();\n\n\n tweets.push(tweet);\n\n localStorage.setItem('tweets', JSON.stringif... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Formats tooltip to show pH label | function format_y_tooltip_ph(dataPoint) {
return " pH: " + dataPoint.ph;
} | [
"function tt_FormatTip()\n{\n\tvar fn = \"[tooltip.js tt_FormatTip] \";\n\tvar css, w, h, pad = tt_aV[PADDING], padT, wBrd = tt_aV[BORDERWIDTH],\n\tiOffY, iOffSh, iAdd = (pad + wBrd) << 1;\n\n\t//--------- Title DIV ----------\n\tif(tt_aV[TITLE].length)\n\t{\n\t\tpadT = tt_aV[TITLEPADDING];\n\t\tcss = tt_aElt[1].st... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
when a user enters a display name, the name is stored in local storage | function display_name()
{
// localStorage.clear();
let username=document.getElementById("username").value;
// alert(username)
localStorage.setItem('username', username);
} | [
"function storeName() {\r\n // gets timestamp\r\n var time = new Date();\r\n \r\n // gets value of name entered\r\n //var fullName = document.getElementById(\"fname\").value;\r\n var fullName = getName();\r\n \r\n if(fullName === \"\") {\r\n display(fullName)\r\n return;\r\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Open and close prices and volume for all currencies between a customizable time range. | currenciesInterval({ startISOString, endISOString }) {
return this.getCurrenciesIntervalV1({ startISOString, endISOString })
.catch((err) => {
console.error("Error in 'currenciesInterval' method of nomics module\n" + err);
throw new Error(err);
});
} | [
"async getClosingPrices(currency = 'ETH', period = 5, unit = 'thirtyMin') {\n const ticks = await this.getTicks(currency, unit);\n const { result = [] } = ticks;\n return _.takeRight(result, period).map(e => e.C);\n }",
"async getCurrencies() {\n const promises = this.currencies.map(currency =>\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get the language regular expression. | function GetLanguageRegex(language) {
var regex;
switch (language) {
case 'hebrew':
regex = /[\u0590-\u05FF]+/;
break;
case 'english':
regex = /[a-zA-Z]+/;
break;
case 'rusian':
regex = /[\u0400-\u04ff]+/;
break;
... | [
"function langRe(value, global) {\n\t\t return new RegExp(\n\t\t\t toSource(value),\n\t\t\t 'm' + (language.case_insensitive ? 'i' : '') + (global ? 'g' : '')\n\t\t );\n\t }",
"getRegexes(language) {\n switch (language) {\n case 'html':\n case 'xml':\n return ALL_RE... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This function creates the canvas with the column headings | function drawColHdrs(){
console.log(`draw col headers`);
var obj = gridSize();
var canvas = document.getElementById('col_hdrs');
//Adjust the workspace so that both canvases can fit into it
var body = document.getElementById('body');
var workSpace = document.getElementById('work_space');
workSpace.style.wi... | [
"function drawRowHdrs(){\n\tconsole.log(`draw row headers`);\n\t\n\tvar obj = gridSize();\n\tvar indent = 40; //this is the width of the row headers column\n\t\n\tvar canvas = document.getElementById('row_hdrs');\n\t\n\tvar context = canvas.getContext('2d');\n\tcontext.scale(dpr,dpr);\n\t//Set the canvas size\n\tca... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Complete the method so that it formats the words into a single comma separated value. The last word should be separated by the word 'and' instead of a comma. The method takes in an array of strings and returns a single formatted string. Empty string values should be ignored. Empty arrays or null/nil values being passed... | function formatWords(words){
if (words === null) return '';
let arr = words.filter((word) => { return word.length > 1 });
if (arr.length === 1) return arr[0];
return arr.reduce((acc, curr) => {
if (arr.indexOf(curr) === arr.length - 1) {
acc += 'and ' + curr;
} else if (arr.indexOf(curr) ===... | [
"function formatWords(words){\n\n if(!words){\n return '';\n } else {\n var filtered = words.filter(word => {\n return word !== '';\n });\n\n if(filtered.length === 0){\n return '';\n } else if(filtered.length < 2){\n return filtered[0];\n } else if (filtered.length < 3){\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Validates that the value passed into a disjunctive filter satisfies all array requirements. | function ic(t, e) {
if (!Array.isArray(t) || 0 === t.length) throw new S(_.INVALID_ARGUMENT, "Invalid Query. A non-empty array is required for '" + e.toString() + "' filters.");
if (t.length > 10) throw new S(_.INVALID_ARGUMENT, "Invalid Query. '" + e.toString() + "' filters support a maximum of 10 elements in ... | [
"function validateDisjunctiveFilterElements(value, operator) {\n if (!Array.isArray(value) || value.length === 0) {\n throw new FirestoreError(Code.INVALID_ARGUMENT, 'Invalid Query. A non-empty array is required for ' +\n (\"'\" + operator.toString() + \"' filters.\"));\n }\n if (value.le... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
A card can contain content metadata | function CardMeta(props) {
var children = props.children,
className = props.className,
content = props.content;
var classes = (0, _classnames2.default)(className, 'meta');
var rest = (0, _lib.getUnhandledProps)(CardMeta, props);
var ElementType = (0, _lib.getElementType)(CardMeta, props);
... | [
"function CardMeta(props) {\n\t var children = props.children,\n\t className = props.className,\n\t content = props.content;\n\n\t var classes = (0, _classnames2.default)(className, 'meta');\n\t var rest = (0, _lib.getUnhandledProps)(CardMeta, props);\n\t var ElementType = (0, _lib.getElementType)(Car... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Load ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Load legacy wallet from 0.33 fork | function loadLegacyWallet(filename, password) {
Siad.apiCall({
url: '/wallet/load/033x',
method: 'POST',
qs: {
filepath: filename,
encryptionpassword: password,
},
}, function(result) {
notify('Loaded Wallet', 'success');
});
} | [
"function loadWallet() {\n if (!localStorage.getItem(\"currentWallet\")) {\n return;\n }\n currentWallet = JSON.parse(localStorage.getItem(\"currentWallet\"));\n}",
"function loadWallet(callback) {\r\n if (_config.secret.private_key === \"\") {\r\n if (_config.secret.password === \"\") {\r\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Transforms a possibly single group into its patterns | function degroupSingle(group) {
return group.type === 'group' && group.patterns.length === 1 ? group.patterns[0] : group;
} | [
"function degroupSingle(group) {\n return group.type === 'group' && group.patterns.length === 1 ? group.patterns[0] : group;\n }",
"function degroupSingle(group) {\r\n return group.type === 'group' && group.patterns.length === 1 ? group.patterns[0] : group;\r\n }",
"filterGroups(regex, invert) {\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
returns the image of the piece depending on its color | getImage(){
if(this.color == 'white'){
return './img/knight_white.svg';
}
else{
return './img/knight_black.svg';
}
} | [
"calcFill() {\n let imagePiece = marlon.get(this.left, this.top, this.w, this.h);\n imagePiece.loadPixels();\n\n let r = 0, g = 0, b = 0;\n\n for (let i = 0; i < imagePiece.pixels.length; i += 4) {\n r += imagePiece.pixels[i];\n g += imagePiece.pixels[i + 1]; \n b += imagePiece.pixels[i +... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
save a post to a user's `savedPosts` field by adding it to the set (to prevent duplicates) user comes from `req.user` created in the auth middleware function also adds new Post to Post collection | async savePost({ user, body }, res) {
console.log(user);
console.log(body)
try {
const newPost = await Post.create({
author: user.username,
authorID: user._id,
title: body.title,
postText: body.postText,
image: body.image,
link: body.link
})
... | [
"async bumpPostsForUser () {\n\t\tlet totalPosts = this.user.get('totalPosts') || 0;\n\t\ttotalPosts++;\n\t\tconst op = { \n\t\t\t$set: {\n\t\t\t\ttotalPosts,\n\t\t\t\tmodifiedAt: Date.now()\n\t\t\t}\n\t\t};\n\t\tthis.updateOp = await new ModelSaver({\n\t\t\trequest: this.request,\n\t\t\tcollection: this.data.users... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
========================================================================= MethodName: GetDisplayLocationPool() Description: return data to front end for display relevant locations Arguments: string Return Value: none =========================================================================== | GetDisplayLocationList() {
// return [displayLocations] to Frontend
} | [
"async function displayPopularLocations() {\n // Get Dao.\n const storageType = document.querySelector('#map').dataset.mem;\n const dao = MeetingLocationDaoFactory.getLocationDao(storageType);\n\n const popularLocationElement = \n document.getElementById('popular-locations-container');\n popularLocationE... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
direction check Creates a new fruit | function newFruit(){
do {
fruit = { //Fruit is an object with an x and y coordinate
x: Math.floor(Math.random() * COLS),
y: Math.floor(Math.random()* ROWS)
};
} while (onSnake(fruit)); //Repeats if the generated fruit is already on the snake
} | [
"function addFruit() {\n if (getRandomNb() == 5) {\n let newFruit = new Fruit(new Position(getRandomNb(), getRandomNb()));\n fruits.push(newFruit);\n }\n}",
"moveFruit() {\n do {\n this.fruit = new NEFruit(\n Math.floor(Math.random() * this.width),\n Math.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Click listener for the 'go' button on the album selection Sends an array of track uris to the background script | function goHandler() {
$('#sf_go').click(() => {
var track_data = [];
$('.sf_songs input:checked').each((index, element) => {
track_data.push(element.name);
});
chrome.extension.sendMessage({
action: 'track_data',
tracks: JSON.stringify(track_... | [
"function on_album_selection()\n {\n const url = DOM.album_url.value;\n\n if (!imgur.is_valid_album_url(url))\n {\n DOM.import_urls.style.visibility = \"hidden\";\n DOM.album_info.textContent = \"The URL specified does not seem to point to a \" +\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
getLastChar input: string output: last character of string PSEUDOCODE return last character of the input by setting index to length1 | function getLastChar(string) {
return string[string.length - 1];
} | [
"function lastChar(string){\n return string[string.length - 1];\n}",
"function lastCharacter(s){return(s[s.length-1])}",
"function last(input) {\n var lastChar = input.charAt(input.length-1);\n return lastChar;\n\n}",
"function last(input) {\n var str = \"last\";\n return str.charAt(3)\n}",... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Write a function `echo` that takes in a string and returns that string "echoized". Examples: echo("Mom!"); // => "MOM! ... Mom! ... mom!" echo("hey"); // => "HEY ... hey ... hey" echo("JUMp"); // => "JUMP ... JUMp ... jump" | function echo(string) {
dots = ' ... ';
return string.toUpperCase() + dots + string + dots + string.toLowerCase();
} | [
"function echo(string) {\n return(string.toUpperCase() + \" ... \" + string + \" ... \" + string.toLowerCase());\n}",
"function echo(string) {\n var allUpper = string.toUpperCase();\n var allLower = string.toLowerCase();\n return allUpper + \"...\" + string + \"...\" + allLower;\n}",
"function echo(str) {\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Verifies that a bank customer has sufficient funds for a transaction. | verifyFunds({
account,
amount
}) {
if (this.ledger[account] === undefined) {
throw new Error(`${account} is not a registered customer of the bank`);
}
let balance = this.ledger[account];
return balance >= amount;
} | [
"_checkBalanced() {\n assert(\n Math.abs(this._excessCredit()) < 0.0001,\n \"Debits and credits should balance\"\n )\n }",
"checkWithdrawal(amount){\n if ((this.balance - amount) >= 0) {\n return true;\n }else {\n return false;\n }\n }",
"function haveEnoughC... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
filter particles using lifeTime and event callback | filterParticle (particle) {
if (particle.recycled) {
return false
}
if (particle.lifeTime < 0) {
this.pushRecycle(particle)
return false
}
var filter = this.emit(
'particle.filter',
particle)
if (filter !== undefined) {
if (!filter) {
this.pushRecy... | [
"function updateParticles(elapsedTime){\n //Loop through particles backwards to find ones to remove.\n for (let particle = (particles.length-1); particle >= 0; --particle) {\n particles[particle].alive += elapsedTime;\n //Check if they are still alive before updating them.\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Print the field to the terminal | print() {
return this.field.map(row =>
row.join('')
).join('\n');
} | [
"printField() {\n\t\tconst fieldString = this.field.map((row) => {\n\t\t\treturn row.join(\"\");\n\t\t});\n\t\tconst fieldArea = fieldString.join(\"\\n\");\n\t\tconsole.log(fieldArea);\n\t}",
"print() {\n for (let row of this._field){\n console.log(row.join(''));\n }\n }",
"print() {... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Cancel the configuration of a portlet. Just hide the configuration DIV and show the display one. | function cancelPortletConfig() {
updatePortletsToolbar(3);
$("#portlet-param-config").hide();
$("#portlets-configure").hide();
$("#portlets-display").show();
} | [
"function dismissConfig() {\n angular.extend(vm.configParams, compiler.settings());\n \n vm.isConfiguring = false;\n vm.dialogActive = false;\n }",
"function CancelarConfiguracao() {\n AbrirView(VISOES.PRINCIPAL, CONTEUDO.CORPO);\n}",
"function chooseConfig(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
=========== function delete photo =========== | function deletePhoto(event) {
let reqDB = indexedDB.open('photos', 1);
reqDB.onsuccess = function (e) {
let db = e.target.result;
// получаем ключ записи
const id = event.target.getAttribute('id')
// открываем транзакцию чтения/записи БД, готовую к удален... | [
"function deletePhoto(id) {\n return photodb('photos').where({ id }).first().delete();\n}",
"function deleteImage() {\n\tvar image = request.httpParameterMap.file.value;\n\tvar id = request.httpParameterMap.id.value;\n\tvar file = new File(image);\n\tfile.remove();\n\tCalls.deleteFileOnCloudinary(id);\n\treturn ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
6. Create a function mentorWithMoreSkills() that returns the name of the mentor with more number of skills | function mentorWithMoreSkills(mentors) {
mentors.sort((mentor1, mentor2) => mentor1.skills.length > mentor2.skills.length)
mentors.forEach(mentor => console.log(mentor.firstName, mentor.skills.length))
} | [
"function mentorWithMoreSkills(mentors){\r\n let maxSkills = Math.max.apply(null,mentors.map(skill => skill.skills.length));\r\n return mentors.filter(skill => skill.skills.length === maxSkills).map(skill => skill.firstName);\r\n}",
"function maximus() {\nlet max = 0\nlet name = \"\"\nfor (let i = 0; i < mentor... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Modulo para retornar os dados de descarregamento do sqlite para o frontend | async get_descarregamento_data_v2( request, response ){
const { data: Dia, unidade: Unidade } = request.body;
console.log('Iniciou descarregamento', Dia);
const result = await connection('fDescarregamento')
.select('*')
.where({ Dia,... | [
"function readDatabase() {return}",
"function getData(){\r\n\treturn db.Execute('SELECT * FROM sampleTable');\r\n}",
"function buscaProjetoDB(tx) {\r\n\ttx.executeSql('SELECT DESCRICAO, IDGRUPO FROM PROJETOS WHERE ID_PROJETO = \"'+idProAlt+'\"', [], buscaProjetoSuccess);\r\n}",
"db2data() {\n\t\treturn new Pr... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Renders the AWS CloudFormation properties of an `AWS::WAFv2::WebACL` resource | function cfnWebACLPropsToCloudFormation(properties) {
if (!cdk.canInspect(properties)) {
return properties;
}
CfnWebACLPropsValidator(properties).assertSuccess();
return {
DefaultAction: cfnWebACLDefaultActionPropertyToCloudFormation(properties.defaultAction),
Scope: cdk.stringTo... | [
"function cfnWebACLPropsToCloudFormation(properties) {\n if (!cdk.canInspect(properties)) {\n return properties;\n }\n CfnWebACLPropsValidator(properties).assertSuccess();\n return {\n DefaultAction: cfnWebACLWafActionPropertyToCloudFormation(properties.defaultAction),\n MetricName:... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get sequent block number | async * getSequentBlockNum(ts = 2) {
let current = await this.getCurrentBlockNum();
let id = current;
while (true) {
while (current > id) yield id++;
await sleep(ts * 1000);
current = await this.getCurrentBlockNum();
}
} | [
"async getCurrentBlockNum() {\n const properties = await this.getDynamicGlobalProperties();\n return properties.last_irreversible_block_num;\n }",
"snapshotBlockNumber () {\n if (!this.snapshotBlockNumberValue) {\n const snapshotNumberOfCycle = parseFloat(this.snapshotNumber)\n const firstBloc... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
The dragger is an absolutely positioned element that is superimposed on the actual area that we'd like to drag. This is necessary due to a bug in Chromium. Effectively, we need the dragger to change its left position and width to match the intended drag area. These dimensions can change whenever the header is rerendere... | resizeDragHandle() {
const fsblHeader = document.querySelector(".fsbl-header");
if (!fsblHeader) {
// If there isn't an FSBLHeader then there doesn't need to be a drag handle.
return;
}
// Create the dragger if it doesn't already exist
let dragHandle = document.querySelector(".fsbl-drag-handle");
if ... | [
"function UltraGrid_Sizer_Drag_OnMove(event)\n{\n\t//block the event\n\tBrowser_BlockEvent(event);\n\t//get current position\n\tvar currentPos = Browser_GetScreenCoordinates(event);\n\t//Calculate the modifier\n\tvar nModifier = currentPos.x - __DRAG_DATA.StartPosition.x;\n\t//trigger resize\n\tUltraGrid_Resize(__D... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This function clears the calendar. This runs as the first step each time the calendar is rendered. | function clearCalendar()
{
$("TBODY#calendarStart").html("");
} | [
"static clearCalendar(){\n\t\tvar calendar = document.getElementById(\"calendar\");\n\t\twhile(calendar.firstChild){\n\t\t\tcalendar.removeChild(calendar.firstChild);\n\t\t}\n\t}",
"function clearCalendar () {\n var currentCalendar = document.getElementById('calendar')\n\n currentCalendar.innerHTML = ''\n}",
... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Searches in logs for the first event of the given event type and in that event for the first first attribute with the given attribute key. Throws if the attribute was not found. | function findAttribute(logs, eventType, attrKey) {
var _a, _b;
const firstLogs = logs.find(() => true);
const out = (_b = (_a = firstLogs) === null || _a === void 0 ? void 0 : _a.events.find((event) => event.type === eventType)) === null || _b === void 0 ? void 0 : _b.attributes.find((attr) => attr.key === ... | [
"static getFirstAttribute(element, ...attributes) {\n for (let attribute of attributes) {\n if (element.hasAttribute(attribute)) {\n return element.getAttribute(attribute)\n }\n }\n }",
"search(element, attribute) {\n if (element === null) {\n return element;\n }\n\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
clear button state end /clear filter tags | function clearFilterTags() {
$('.location-filter-wrap').find(':checked').prop("checked", false);
clearBtnState();
} | [
"function filterClear(){\r\n\t\tg_searchText = \"\";\r\n\t\tjQuery('.uc-catdialog-button-clearfilter').val('');\r\n\t\tloadCats();\r\n\t}",
"function clearFilters() {\n genderFilter();\n $('#day-filter-btn').html(\"Any Location\")\n $('#city-filter-btn').html(\"Any Day\")\n $('#childca... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Initialates readline in order to listen to console input | function initReadline() {
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout
});
rl.on('line', (input) => {
try {
if (input.startsWith('c')) { // Message to cart
var name = input.split(' ')[1];
var c = carts[... | [
"function initRead() {\n const rl = readline.createInterface({\n input: process.stdin,\n output: process.stdout\n });\n\n rl.prompt();\n\n rl.on('line', (line) => {\n findCorrection(line);\n rl.prompt();\n });\n}",
"readLine(test){\n this.emit(this.eventsDic.initStart);\n let rl;\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Covert BlobTags to Tags type. | function toTags(tags) {
if (tags === undefined) {
return undefined;
}
const res = {};
for (const blobTag of tags.blobTagSet) {
res[blobTag.key] = blobTag.value;
}
return res;
} | [
"function toBlobTags(tags) {\n if (tags === undefined) {\n return undefined;\n }\n var res = {\n blobTagSet: []\n };\n for (var key in tags) {\n if (tags.hasOwnProperty(key)) {\n var value = tags[key];\n res.blobTagSet.push({\n key: key,\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Loops contunually, calling analyse and draw each time | function loop() {
// Compute analysis
const bins = analyser.frequencyBinCount;
var freq = new Float32Array(bins);
var wave = new Float32Array(bins);
analyser.getFloatFrequencyData(freq);
analyser.getFloatTimeDomainData(wave);
// Get the min, max & average of this slice of waveform data
// max: absolute... | [
"loop() {\n\t\tthis.draw();\n\t}",
"iterate() {\n background(this.bg);\n fill(this.fg);\n triangle(this.size / 2, 0,\n 0, this.size,\n this.size, this.size);\n text(this.tap + \"\\n\" +\n this.levels + this.iteration + \"\\n\" +\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
List of buckets created. __Arguments__ `callback(err, bucketStream)` _function_ callback function with error as the first argument. `bucketStream` is the stream emitting bucket information. `bucketStream` emits Object with the format: `obj.name` _string_ : bucket name `obj.creationDate` _string_: date when bucket was c... | listBuckets(cb) {
var requestParams = {
host: this.params.host,
port: this.params.port,
protocol: this.params.protocol,
path: '/',
method: 'GET'
}
signV4(requestParams, '', this.params.accessKey, this.params.secretKey)
var concater = transformers.getConcater()
var re... | [
"listBuckets(cb) {\n\n if (!isFunction(cb)) {\n throw new TypeError('callback should be of type \"function\"')\n }\n\n var method = 'GET'\n this.makeRequest({method}, '', 200, 'us-east-1', true, (e, response) => {\n if (e) return cb(e)\n var transformer = transformers.getListBucketTransfo... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
A callback function to set the initial region once the data and lists are loaded. | function setDefaultRegion() {
if (Region.initialRegion) {
new Region(Region.initialRegion).set();
}
} | [
"function onRegionInit() {\n api.getRegions(function (regions) {\n scope.regions = [{id: 0, title: '\\u2014'}].concat(regions);\n scope.$apply();\n });\n }",
"function setupRegions(){\n /* csv string queried from a url */\n var csvString = $.ajax({ \n type: \"GET\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets the seven day average of a specified key in an array of objects. | function get7DayAverageKey(data, index, key) {
let newData = data.slice(index - 3, index + 3)
.map(el => el[key]);
let mean = d3.mean(newData);
return mean === undefined ? 0 : mean;
} | [
"function average(obj, key) {\n var sum = 0;\n for(var i = 0; i < obj.length; i++){\n sum += obj[i][key];\n }\n\n var avg = sum/obj.length;\n return avg.toPrecision(6);\n}",
"arrayAverage(array, key) {\n var total = 0\n for (var i = 0; i < array.length; i++) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Scale companies by market cap | scaleCompany(d) {
let minMcap = d3.min(this.companyData, function (d) {
return parseInt(d.market_cap)
});
let maxMcap = d3.max(this.companyData, function (d) {
return parseInt(d.market_cap)
});
let scale = d3.scaleLinear()
.domain([minMcap, max... | [
"function computeMarketCaps(data) {\n let large = 0\n let medium = 0\n let small = 0\n let micro = 0\n let portfolioDta = data\n for (var j = 0; j < portfolioDta.length; j++) {\n let mCap = parseFloat(portfolioDta[j]['marketcap'])\n let holding = parse... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
.drawBands() Draws the similarity bands on the chart | function drawBands(){
var path = d3.svg.diagonal()
.source(function(d){
return {
x: d.a.x() + (d.a.width() / 2),
y: d.a.y() + (d.a.height() / 2),
};
})
.target(function(d){
return {
... | [
"function updateBands(d){\n var dirty = d == undefined ? [] : d;\n _similarityBands = createBands(dirty);\n drawBands();\n setMasks();\n }",
"function createBands(d) {\n\t // Create all pairs of pixelLayers\n\t var combos = (0, _plugins.comb... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return a FileCache callback that templates responses of some MIME type mimeType is the MIME type to process (e.g. "text/html"). processor is a function that takes a (HTTP request) path and returns an object of values to template with. | function makeFileCacheCallback(mimeType, processor) {
const cache = new Map();
return function(req, resp, data) {
const m = /^([^;]+)(;.*)?$/.exec(resp.getHeader('Content-Type') || '');
if (! m || m[1] != mimeType) return null;
const hash = resp.getHeader('ETag');
if (! hash) return null;
let co... | [
"function processor(types) {\n return function(variables) {\n /**\n * Process a placeholder.\n *\n * @param {string} type The renderer (possibly empty).\n * @param {string} args A colon-separated string of variable names (or null).\n * @param {string} arg A single variable name... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
exported FunctionNumberLineHighlight / global ExplorableHintedText | function FunctionNumberLineHighlight(options) {
let backgroundColor,
color,
fontFamily,
highlight,
inputFontSize,
outputFontSize,
outputTextAnchor,
outputValue,
significantDigits,
strokeWidth;
highlight = this;
init(options);
return highlight;
/* INITIALZE */
function... | [
"function CustomHighlight() {}",
"highlight() {\n if (arguments.length === 2) {\n this._highlightedPositionsToBe.push({ line: arguments[1], col: arguments[0], type: '.' });\n } else if (arguments.length === 1) {\n let { line, col } = linearPosToLineCol(this._lines.join('\\n'), arguments[0]);\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function selecting the active channel | function selectChannel(lnk){
document.querySelectorAll('.list-group-item').forEach(a => {
a.setAttribute("class","list-group-item list-group-item-action pt-1 pb-1");
});
lnk.setAttribute("class","list-group-item list-group-item-action pt-1 pb-1 active");
// Reset badge if any
lnk.innerHTML = lnk.dataset.n... | [
"selectChannel() {\n\t\tclearTimeout(this.channelSelectTimer);\n\t\tvar cmds = this.channelDigits;\n\t\tthis.channelDigits = [];\n\n\t\t// For debugging\n\t\tvar channel = '';\n\t\tfor (var i = 0; i < cmds.length; i++) {\n\t\t\tchannel += cmds[i].substr(3, 1);\n\t\t}\n\t\tthis._debug('\t- Switch to channel: ' + cha... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
getIgnoreKeywords_allWords_A_Words() Get the common words to ignore that start with: A. | function getIgnoreKeywords_allWords_A_Words() {
return [
'ab', // latin, as in "ab novo"
'abideth',
'able',
'above',
'about',
'absolutely',
'according',
'accordingly',
'achieving',
'across',
'actual',
'actually',
'admit',
'admittably',
'admitted',
'affect',
'affect... | [
"function getIgnoreKeywords_allWords_B_Words() {\n\t\treturn [\n\t\t\t'back',\n\t\t\t'backward',\n\t\t\t'badly',\n\t\t\t'barely',\n\t\t\t'based',\n\t\t\t'basically',\n\t\t\t'be',\n\t\t\t'became',\n\t\t\t'because',\n\t\t\t'become',\n\t\t\t'becoming',\n\t\t\t'becomes',\n\t\t\t'been',\n\t\t\t'before',\n\t\t\t'beforeha... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
=================================================================== from functions/eval/Eval.java =================================================================== Needed early: Builtin Needed late: Compiler Pair | function Eval() {
} | [
"Evaluate() {}",
"__eval__(__source__, __boundValues__) { return eval(__source__) }",
"function eval(){\n var s = evaluate(parse(lex(program)));\n return s;\n}",
"eval(x, env) {\n try {\n for (;;) {\n if (x instanceof Arg) {\n return x.getValue(env);\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
add class 'active' to the drop list the make it visible and set the animation | function delayShowSlide() {
setTimeout(function() {
dropDown.classList.add('active');
}, 1);
} | [
"markActive() {\r\n if(IdeaList.activeList) {\r\n IdeaList.activeList.active = false;\r\n IdeaList.activeList.element.classList.replace('bg-green-400', 'bg-green-200');\r\n\r\n }\r\n IdeaList.activeList = this;\r\n this.active = true;\r\n this.element.classList.replace('b... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This function will show/hide calendar/today date icons as per field's disabled/enabled status. Arguments: 1. ID of field | function SP_ShowHideCalendar(fieldId)
{
if($("#"+fieldId).prop("disabled"))
{
$("#"+fieldId).next("button").hide().next("button").hide();
$("#"+fieldId).removeClass("frm_text");
$("#"+fieldId).addClass("textfield");
}
else
{
$("#"+fieldId).next("button").show().next("button").show();
$("#"+fieldId).rem... | [
"function toggleDatepicker() {\n if (jQuery('.make_a_reservation_calender').is(':visible')) {\n //console.log('disable datepicker');\n jQuery('.bookingForm .checkIn, .bookingForm .checkOut').datepicker('disable');\n } else {\n //console.log('enable datepicker');\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Executes a MySQL query to delete a review specified by its ID. Returns a Promise that resolves to true if the review specified by `reviewID` existed and was successfully deleted or to false otherwise. | function deleteReviewByID(reviewID, mysqlPool) {
return new Promise((resolve, reject) => {
mysqlPool.query('DELETE FROM reviews WHERE id = ?', [ reviewID ], function (err, result) {
if (err) {
reject(err);
} else {
resolve(result.affectedRows > 0);
}
});
});
} | [
"function deleteReviewByID(reviewID, mysqlPool) {\n return new Promise((resolve, reject) => {\n mysqlPool.query('DELETE FROM CriticReview WHERE reviewID = ?', [ reviewID ], function (err, result) {\n if (err) {\n reject(err);\n } else {\n resolve(result.affectedRows > 0);\n }\n }... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
get CEP from input | function getCep() {
let cep = "";
for (let i=1; i<=8; i++)
cep += document.getElementById(`cep-input${i}`).value;
return cep;
} | [
"function getCep() {\n var getInputCep = $inputCep.get()[0].value.replace(/\\D/g, \"\");\n return getInputCep;\n }",
"getCep() {\n\t\treturn this._cep;\n\t}",
"function get_ec(curve_type) {\n\tlet curve;\n\tif (curve_type == 0) {\n\t\tcurve = ec;\n\t} else if (curve_type == 1) {\n\t\tcurve = ecdsa;\n\t}\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
this public function must refresh the boats asynchronously uses notifyLoading | async refresh() {
this.notifyLoading(true);
refreshApex(this.boats);
this.notifyLoading(false);
} | [
"async refresh() {\n this.isLoading = true;\n this.notifyLoading(this.isLoading);\n refreshApex(this.boats);\n this.isLoading = false;\n this.notifyLoading(this.isLoading);\n }",
"async refresh() {\n this.isLoading=true;\n this.notifyLoading(this.isLoading);\n await refreshApex(this.boats... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Move car west through intersection | function car1MoveIntersectionWest() {
let car1Left = getComputedStyle(car1).left.replace('px', '');
let car1Top = getComputedStyle(car1).top.replace('px', '');
car1.style.left = `${parseInt(car1.style.left.replace("px", "")) - 10}px`;
if(car1Left <= 50) {
stopCars();
rotateCar(0)
setTimeout(startCar1North, 1... | [
"function car1MoveIntersectionEast() {\n\tlet car1Left = getComputedStyle(car1).left.replace('px', '');\n\tlet car1Top = getComputedStyle(car1).top.replace('px', '');\n\tcar1.style.left = `${parseInt(car1.style.left.replace(\"px\", \"\")) + 10}px`;\n\n\tif(car1Left >= 780) {\n\t\tstopCars();\n\t\trotateCar(0)\n\t\t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
send image of specific canvas | function sendCanvasImage(id) {
requestedCanvas = {
image: canvasImages[id],
id: id
}
socket.emit("receiveCanvasImage", requestedCanvas);
} | [
"function saveCanvas() {\n var base64PNG = canvas.toDataURL().split(',')[1];\n var fd = new FormData();\n fd.append(\"base64Image\", base64PNG);\n fd.append(\"client\", \"stjudes.demo\");\n var xhr = new XMLHttpRequest();\n xhr.addEventListener('load', imageUploaded, false);\n xhr.open('POST', ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Takes the list and divides it into teams | function createList(numTeams){
shuffleStudents();
var teamsArray = [];
for(var i=0; i< numTeams; i++) {
teamsArray.push(new Team(i + 1));
}
//assigning students to the teams created in first for loop.
for(var studentNum = 0; studentNum < students.length; studentNum++){
var teamNum = studentNum % nu... | [
"function setTeams(){\n var i=0;\n \n while(detailService.list.data.rounds[0].matches[i])\n {\n m.teams.push(\n detailService.list.data.rounds[0].matches[i].team1.name\n );\n m.teams.push(\n detailService.list.data.rounds[0].matches[i].... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
when using TURN, we might want to restrict the bandwidth to the value specified by MAX_RELAY_BANDWIDTH in order to prevent sending excessive traffic through the TURN server. | restrictRelayBandwidth() {
if (!(window.RTCRtpSender &&
'getParameters' in window.RTCRtpSender.prototype)) {
return;
}
this.pc.addEventListener('iceconnectionstatechange', () => __awaiter(this, void 0, void 0, function* () {
if (this.pc.iceConnectionState !== ... | [
"constrainVideoBitrate (maxVideoBitrateKbps) {\n this.constrainVideoBitrateKbps = maxVideoBitrateKbps;\n }",
"async setMaxIncomingBitrate(bitrate) {\n logger.debug('setMaxIncomingBitrate() [bitrate:%s]', bitrate);\n const reqData = { bitrate };\n await this._channel.request('transport.set... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Converts an absolute filepath to a relative path from the given `base` path. | function relative(filepath, base) {
const abs = path.isAbsolute(filepath) ? filepath : path.resolve(filepath);
if (base) {
assert(path.isAbsolute(base), 'expected base to be an absolute path');
return path.relative(base, abs);
}
if (abs[0] === '/') {
return abs.slice(1);
}
return abs;
} | [
"function relativeURI(uri, base) {\n \n // reduce base and uri strings to just their difference string\n var baseParts = base.split('/');\n baseParts.pop();\n base = baseParts.join('/') + '/';\n i = 0;\n while (base.substr(i, 1) == uri.substr(i, 1))\n i++;\n while (base.substr(i, 1) != ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Reduces the point to a length of 1. | function normalize(point) {
var oneOverLen = 1 / ParticleUtils.length(point);
point.x *= oneOverLen;
point.y *= oneOverLen;
} | [
"function normalize(point) {\r\n var oneOverLen = 1 / ParticleUtils.length(point);\r\n point.x *= oneOverLen;\r\n point.y *= oneOverLen;\r\n }",
"function normalize(point) {\r\n var oneOverLen = 1 / ParticleUtils.length(point);\r\n point.x *= oneOverLen;\r\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
user reports broken scooter on the app, but it's handled by the server. | reportBrokenScooter(scooter, server) {
server.handleBrokenScooter(scooter);
} | [
"function rejectUser() {\n saveToken(null);\n saveUser(null);\n user.auth = false;\n\n // notify app that there was a problem, assume user is not auth-ed\n $rootScope.$emit('user:auth', { type: 'logout' });\n }",
"function onRequestDenied() {\n console.log(\"The board's ow... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
draws given edges. duplication based on 'directed' boolean. | function drawEdges(edges) {
//var drawnEdges = {};
for (index in edges) {
var e = edges[index];
// check if drawn forward direction
// if (e.i in drawnEdges && e.j in drawnEdges[e.i]) continue;
// // check if drawn other direction (undirected case)
// if (directed === false && ... | [
"function drawEdge(id, vertex1, vertex2, vertex1Info, vertex2Info, vertex1VisualInfo, vertex2VisualInfo, edgeInfo, edgeVisualInfo) {\r\n var path = this._getEdgePath(vertex1, vertex2);\r\n var clickAreaWidth = 10;\r\n var edge = this.paper.path(path).attr(this.lineAttr).toBack();\r\n //var click... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sets or gets the orientation of the text in the tabs labels of the TabsWindow. Applicable only to TabsWindow. Property type: Orientation | get tabTextOrientation() {
return this.nativeElement ? this.nativeElement.tabTextOrientation : undefined;
} | [
"function updateOrientation(value) {\n\t\t\t\ttarget.innerHTML = 'Current orientation: ' + value;\n\t\t\t}",
"function YDisplay_set_orientation(newval)\n { var rest_val;\n rest_val = String(newval);\n return this._setAttr('orientation',rest_val);\n }",
"swapOrientation() {\n if (this.or... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
constructors Initializes a new instance of the `UnitConvertor` class with DPI value. | function PdfUnitConverter(dpi){this.updateProportionsHelper(dpi);} | [
"function PdfUnitConverter(dpi) {\n this.updateProportionsHelper(dpi);\n }",
"refreshFromUnits() {\n \"use strict\";\n this._pixel = Field.units2pixel(this._unit);\n }",
"function ValueAndUnit(value,/** defines the unit to store */unit,/** defines a boolean indicating if the value can... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sends a JSON object consisting of all comments (including nested comments) of a node to the client. Returned in preorder. | function getComments(response, request) {
console.log("Request handler 'getComments' was called.");
// get parent ID
var queryData = url.parse(request.url, true).query;
var pid = queryData.id;
if (!data.isValid(pid)) {
response.writeHead(400, { "Content-Type" : MIME_TYPES['.txt']});
response.end("400: Invalid... | [
"function comments(ctx, node) {\n return \"\\\\begin{comment}\\n\".concat(node.data.comment, \"\\n\\\\end{comment}\\n\");\n}",
"function comments (ctx, node) {\n return `\\\\begin{comment}\\n${node.data.comment}\\n\\\\end{comment}\\n`\n}",
"function api_get_comments(req, res) {\n Message.find({type : 'commen... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
create input text dialog instance | function InputTextDialog(name) {
var _this = this;
/**
* gray panel element
*/
this.grayPanel = $('#gray_panel');
/**
* dialog frame area element
*/
this.dialogArea = $('#dialog_area_input');
/**
* input text element
*... | [
"function inputBox(title, okCallback, hint, width)\n{\n var options = \"NoCancel\"\n title = title || \"\";\n hint = hint || \"Your text\";\n //suppress title line if no title - pass \" \" to override\n if( title===\"\") options += \",NoTitle\";\n \n // create dialog\n var dlg = app.CreateDialo... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This call returns a random batch of [max] episodes, in no specific order. Note: If no [max] is specified, the default is 1. You can return up to 40 episodes at a time. Note: Language and category names are caseinsensitive. Note: You can mix and match the cat and notcat filters to fine tune a very specific result set. | async episodesRandom(options = {}) {
const parsedOptions = options.max
? { max: options.max }
: {};
parsedOptions.lang = Array.isArray(options.lang) ? options.lang.join(",") : options.lang;
parsedOptions.cat = Array.isArray(options.cat) ? options.cat.join(",") : options.c... | [
"function pickRandomEpisode(){\n\tvar episodesArr = []; //will fill this with possible episodes\n\tfor (var key in episodes){\n\t\tepisodesArr = episodesArr.concat(episodes[key]);\n\t}\n\tvar randomIndex = Math.floor(Math.random()*episodesArr.length);\n\treturn episodesArr[randomIndex];\n}",
"function getRandomEp... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Pushes the given StackEntries on to the Stack | push(...values) {
return stack.push(...values);
} | [
"function pushOpArgs(args)\n {\n opFuncArgsStack.push(args);\n }",
"push(stackNum, value){\n if(this.isFull(stackNum)){\n console.log(\"Stack is Full can't perform Push\");\n return;\n }\n this.sizes[stackNum]++;\n this.values[this.indexOfTop(stackNum)] = value;\n }",
"functi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Given a long string including tags, returns only the first sentence stripped of tags and having converted HTML entities back to text. | function grabFirstSentence(string: string){
//Start the string at the first <p> tag, to ignore leading whitespace
let startIndex = string.indexOf('<p>');
//Add 3 to move past that <p> tag
startIndex += 3;
//End at the closing </p> tag.
let endIndex = string.indexOf('</p>');
//Slice... | [
"function wp_html_excerpt( $str, $count, $more = null ) {\n if ( null === $more )\n $more = '';\n $str = wp_strip_all_tags( $str, true );\n $excerpt = mb_substr( $str, 0, $count );\n // remove part of an entity at the end\n $excerpt = preg_replace( '/&[^;\\s]{... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
In dev env, yarn netlify build inherits of the env vars set in Netlify's UI. We need to manually override them. | function loadDevEnvVariables() {
// eslint-disable-next-line @typescript-eslint/no-var-requires
const dotenv = require('dotenv');
const filePath = path_1.default.join(__dirname, '..', '..', '.env');
const env = dotenv.config({ path: filePath }).parsed;
forceEnvVar(env, 'ALGOLIA_API_KEY');
forceE... | [
"function insideNetlifyBuildContext() {\n return !!process.env.DEPLOY_PRIME_URL;\n}",
"async function setLocalEnvDefaults(context) {\n const projectPath = process.cwd();\n const defaultEditor = 'vscode';\n const envName = 'sampledev';\n context.print.warning(`Setting default editor to ${defaultEditor}`);\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |