query stringlengths 9 34k | document stringlengths 8 5.39M | negatives listlengths 19 20 | metadata dict |
|---|---|---|---|
Hide all animation elements | function hideAll()
{
$('.animated').each(function(i)
{
if(!$(this).closest('.hero').length) // Dont hide hero object
{
$(this).removeClass('animated').addClass('hideMe');
}
});
} | [
"function hideAll()\n{\n\tdocument.querySelectorAll('.animated').forEach(targetObj =>\n\t{\t\n\t\tif ((!document.body.classList.contains('mob-disable-anim')) || (document.body.classList.contains('mob-disable-anim') && window.innerWidth > 767))\n\t\t{\n\t\t\tvar targetRect = targetObj.getBoundingClientRect();\n\t\t\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets or sets the series marker outline. | get markerOutline() {
return brushToString(this.i.markerOutline);
} | [
"get yAxisAnnotationOutline() {\r\n return brushToString(this.i.ph);\r\n }",
"get outline() {\n return brushToString(this.i.ao);\n }",
"get markerOutlineBrightness() {\r\n return this.i.pk;\r\n }",
"get axisAnnotationOutline() {\r\n return brushToString(this.i.ng);\r\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
method for selecting features of other components | function selFeature(value){
//...
} | [
"function selFeature(value){\n \n\n }",
"function selFeature(value){\n //...\n }",
"function ComponentSelection(){}",
"selectActiveComponents() {\n // TODO\n }",
"onShowAllFeaturesButtonClick() {\n let foundedFeatures = this.get('foundedFeatures');\n if (!Ember.isArray(founded... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Refusing to surrender to the enemy, they instead opted for mass suicide, with a twist: they formed a circle and proceeded to kill one man every three, until one last man was left (and that it was supposed to kill himself to end the act). Well, Josephus and another man were the last two and, as we now know every detail ... | function josephus(items, k) {
let count = 0;
let result = [];
while (items.length > 0) {
for (let i = 0; i < items.length; i++) {
if (++count % k === 0) { //our count start at 0,we increment it....the % is what we have in our sequence[...] and k is what we want to be sorted and that pers... | [
"function josephus(items, k) {\n let i = 0;\n let result = [];\n\n while (items.length > 0) {\n i = (i + k - 1) % items.length;\n result.push(items[i]);\n items.splice(i, 1);\n }\n return result;\n}",
"function getPermutation(n, k) {\n //\n}",
"function getPermutation(n, k) ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
The style which turns off high contrast adjustment in browsers. | function getHighContrastNoAdjustStyle() {
return {
forcedColorAdjust: 'none',
MsHighContrastAdjust: 'none',
};
} | [
"function removeContrastSetting(){\n\t\t\t$('.activecontrast').removeClass('activecontrast');\n\t\t\t$('body').removeClass('contrast_default contrast_low contrast_high'); \n\t\t}",
"function ncsuA11yToolRemoveHighContrastCSSStyle(fr) {\n fr.find('[data-id=\"ncsuA11yToolHighContrastCSS\"]').remove();\n}",
"fu... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
wrapper to set the Search state to visible/not visible | toggleSearch(){
this.setState({
visibleSearch: !this.state.visibleSearch
});
} | [
"function toggleSearchFromVisibility() {\r\n $(\".trip-from-search\").css({\r\n display: toggleSFromDropdown === \"none\" ? \"block\" : \"none\",\r\n });\r\n toggleSFromDropdown = toggleSFromDropdown === \"none\" ? \"block\" : \"none\";\r\n }",
"function makeSearchVisible(){\n searchBody.sty... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
if the game is on, move cars reflect the cars model to the dom if game is NOT on, moveCars will set the initial distance | function moveCars() {
var isVictory = false;
for (var i = 0; i < gCars.length; i++) {
var car = gCars[i];
var elCar = gElCars[i];
if (gIntervalRace) {
car.distance += car.speed;
elCar.style.marginLeft = car.distance + 'px';
if (car.distance > gElRoad... | [
"function moveCars() {\n\t//ROW 1 goes left\n\tif (vars.car[0].pX < -200) {\n\t\tvars.car[0].pX = 800;\t//right edge of canvas\n\t}\n\telse {\n\t\tvars.car[0].pX += vars.car[2].speed ;\n\t}\n\t//ROW 2 goes right\n\tif (vars.car[1].pX > 950) {\n\t\tvars.car[1].pX = -vars.car[1].len;\n\t}\n\telse {\n\t\tvars.car[1].p... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns the lineheight of an element as an integer. | function getLineHeight(elem) {
var lh = computeStyle(elem, 'line-height');
if (lh == 'normal') {
// Normal line heights vary from browser to browser. The spec recommends
// a value between 1.0 and 1.2 of the font size. Using 1.1 to split the diff.
lh = parseInt(computeStyle(elem, 'fo... | [
"function getLineHeight(elem) {\n\t var lh = computeStyle(elem, 'line-height');\n\t if (lh == 'normal') {\n\t // Normal line heights vary from browser to browser. The spec recommends\n\t // a value between 1.0 and 1.2 of the font size. Using 1.1 to split the diff.\n\t lh = parseInt(co... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
uses function from context and 'story model' to creat a new story and push the user to that new story page | function addNewStory(){
addNewIdea(story)
setTravel(true)
} | [
"function createStory() {\r\n\r\n\tif (!user) {\r\n displayAlertMessage('Failed to post. User not logged in.')\r\n return;\r\n }\r\n if (storylocation == null) {\r\n displayAlertMessage('Failed to post. You must select a location.')\r\n return;\r\n }\r\n\r\n $('#story-publish-button').text('Posting.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
copy content Converts from client to WinRT coordinates, which take scale factor into consideration. | function clientToWinRTRect(e) {
var zoomFactor = document.documentElement.msContentZoomFactor;
return {
x: e.pageX,
y: e.pageY,
width: 80,
height: 80
};
} | [
"_copy() {\n let surface = this.getSurface()\n let sel = surface.getSelection()\n let doc = surface.getDocument()\n let clipboardDoc = null\n let clipboardText = \"\"\n let clipboardHtml = \"\"\n if (!sel.isCollapsed()) {\n clipboardText = documentHelpers.getTextForSelection(doc, sel) || \... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
var msgId= '15f457e952618896' //dont use this just for testing purpose getMessage(userId,userId,gmailToken,msgId); | function getMessage(userId, gmailId, gmailToken, id)
{
console.log("----------------Message Id: " + id + " Content-------------------");
var sync = true;
var data = null;
var options = {
url: urlRoot + "/" + gmailId + '/messages/' + id,
method: ... | [
"function getParams(msg)\n{\n return \"msgNo=\" + g.msgNo + \"&username=\" + g.chatName + \"&msg=\" + msg; \n}",
"function getUserId(msg) {\n return msg.message.user.id;\n}",
"function getMessageUrl(id) {\n return 'https://mail.google.com/mail/?shva=1#inbox/' + id;\n}",
"function generateMessageID() ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Window_PDButtonCommand The window for selecting New Game/Continue on the title screen. | function Window_PDButtonCommand() {
this.initialize.apply(this, arguments);
} | [
"createCommandWindow() {\n let graphics = [];\n let actions = [];\n let command;\n for (let i = 0, l = Datas.Systems.mainMenuCommands.length; i < l; i++) {\n command = Datas.Systems.mainMenuCommands[i];\n graphics[i] = new Graphic.Text(command.name(), { align: Enum.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
The Nature of Code Daniel Shiffman Flock object Does very little, simply manages the array of all the boids | function Flock() {
// An array for all the boids
this.boids = []; // Initialize the array
} | [
"function Flock() {\n this.boids = []; // Initialize the array\n\n}",
"function Flock() {\n // An array for all the boids\n this.boids = [] // Initialize the array\n \n this.run = function() {\n for (var i = 0; i < this.boids.length; i++) {\n this.boids[i].run(this.boids) // Passing t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Nodes class extends olLayer. | function Nodes(map) {
Nodes.superclass.constructor.call(this, map);
} | [
"function addNodes(nodes, layer) {\r\n const yPos = constants.NETWORK_HEIGHT / (layer.size + 1)\r\n const arr = [];\r\n for (let i = 0; i < layer.size; i++) {\r\n arr.push({x: layer.xPos, y: yPos*(i+1)});\r\n }\r\n nodes[layer.name] = arr;\r\n}",
"initNodes() {\n // Create Nodes map a... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
function to select a random tweet from an array of tweets | function getRandomTweet (arr) {
var index = Math.floor(Math.random()*arr.length);
return arr[index];
} | [
"function selectTweet(tweets) {\n const index = Math.floor(Math.random() * tweets.length)\n return tweets[index];\n}",
"function pickRandomTweet() {\n\t\t\t\t\t// Store tweetNumber so we can change which bird is highlighted\n\t\t\t\t\ttweetNumber = Math.floor(Math.random() * fakeTweets.length);\n\t\t\t\t\tconso... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This is a function for snippetsWorkspaceEncodedIdWatchGet / Used to check if the current user is watching a specific snippet. Returns 204 (No Content) if the user is watching the snippet and 404 if not. Hitting this endpoint anonymously always returns a 404. | snippetsWorkspaceEncodedIdWatchGet(incomingOptions, cb) {
const Bitbucket = require('./dist');
let defaultClient = Bitbucket.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications['api_key'];
api_key.apiKey = incomingOptions.apiKey;
// Uncomme... | [
"getWatchLater( userID ) {\n return axios.get( API_URL + \"/\" + userID, { headers : authHeader() } );\n }",
"function isWatchPage() {\n return window.location.pathname === \"/watch\"; \n }",
"function retrieveWatchList() {\n $.getJSON('/users/me/')\n .done(function (json) {\n const listArr... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
generate all potential moves (not empty) based on a given board('current' status) | generateMoves(currentStatus) {
var potentialMoves = [];
if (this.checkIfWin(currentStatus)) {
return potentialMoves;
}
for (var i = 0; i < currentStatus.length; i++) {
if (!currentStatus[i]){
potentialMoves.push(i);
}
}
... | [
"possibleMoves(board) {\r\n const currentRow = this.row;\r\n const currentCol = this.col;\r\n const maxDimension = 8; // max units in any direction\r\n const possibleMoves = [];\r\n\r\n /* possible moves for queen; to simplify code, I pushed in \r\n 7 units in all 8 directions and then filtered... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Mock HTTP transport function | function mock_http(options)
{ let url = options.url;
let handler;
//Test log
test_log("http", options);
//Mock APIs
let api_map = mock_http.__api_map;
for (let path in api_map)
if (url.match(path))
{ handler = api_map[path];
... | [
"function MockXMLHttpRequest() {}",
"function mockHttpRequest( http_https, t, ms ) {\n var mockReq = new MockReq();\n var mockRes = new MockRes();\n\n var spy = t.stubOnce(http_https, 'request', function(uri, cb) { cb(mockRes); return mockReq });\n\n if (ms === undefined) setImmediate(function(){ mock... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Removes any diagnostics in collection, where there is a diagnostic in newDiagnostics on the same line in fileUri. | function removeDuplicateDiagnostics(collection, fileUri, newDiagnostics) {
if (collection && collection.has(fileUri)) {
collection.set(fileUri, deDupeDiagnostics(newDiagnostics, collection.get(fileUri).slice()));
}
} | [
"function clearDiagnosticsAndLintVisibleFiles (eventUri) {\n\tif (eventUri) {\n\t\toutputLine(`INFO: Re-linting due to \"${eventUri.fsPath}\" change.`);\n\t}\n\tdiagnosticCollection.clear();\n\tlintVisibleFiles();\n}",
"function clearDiagnosticsAndLintVisibleFiles (eventUri) {\n\tif (eventUri) {\n\t\toutputLine(`... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
function get rider mail body | function getRiderMailBody
(
name,
lift
)
{
var smoker = lift.smoker == true? 'yes': 'No';
var date = $.getDateTime.formatDate(lift.dt);
var time = $.getDateTime.formatTime(lift.dt);
var emailBody = '<div><p><strong>Dear '+
name +'</strong>,</p><br />';
emailBody +='... | [
"getHtmlBodyEmail(message) {\n var htmlBody = \"\";\n\n if (typeof message.data !== 'undefined' &&\n typeof message.data.payload !== 'undefined' &&\n typeof message.data.payload.body !== 'undefined' &&\n typeof message.data.payload.body.data !== 'undefined'\n ) ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Julian century from the epoch. | julianCentury(julianDay) {
/* Equation from Astronomical Algorithms page 163 */
return (julianDay - 2451545.0) / 36525;
} | [
"function getJulianCentury(day) {\n if ('undefined' === typeof day) {\n day = this.getJulianDay();\n }\n\n return (day - this.J2000) / julian_year;\n }",
"function GetJulianCentury(date) {\n var epoch = 2451545; // Jan 1, 2000 12:00 UTC\n var daysInCentury = 36525;\n \n return (GetJulianDay(dat... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
public function to get DataModel by name from global list of DataModels | function getDataModel(name){
return dataList[name];
} | [
"model(name) { return this.models[name.name || name]; }",
"static getByName(name) {\n if (!name) {\n return null;\n }\n let n = name.toLocaleLowerCase();\n n = n[0].toUpperCase() + n.substr(1) + 'Model';\n return this.MODELS[n] || null;\n }",
"getModel(name) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
add eventlisteners for the 4 choices | function addListeners(){
document.getElementById("choice1").addEventListener("click",choice1Select);
document.getElementById("choice2").addEventListener("click",choice2Select);
document.getElementById("choice3").addEventListener("click",choice3Select);
document.getElementById("choice4").addEventListener("click",cho... | [
"function createListeners() {\n firstChoice.addEventListener(\"click\", clickedChoiceOne);\n secondChoice.addEventListener(\"click\", clickedChoiceTwo);\n thirdChoice.addEventListener(\"click\", clickedChoiceThree);\n forthChoice.addEventListener(\"click\", clickedChoiceFour);\n}",
"function set_liste... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Resets Workspace Form to Default View | function resetWorkspaceForm() {
var errorMsg = document.getElementById("workspaceError");
var successMsg = document.getElementById("workspaceSuccess");
var tabs = document.getElementsByClassName('tab');
numRegularTabs = 0;
numPinnedTabs = 0;
while(tabs[0]) {
tabs[0].parentNode.removeChild(tabs[0]);
... | [
"function resetProject() {\n problemManager.resetProject();\n // Reset ractive bindings\n setRactives();\n update();\n showProjectResetDialogue();\n}",
"function Reset() {\n vm.model = angular.copy(vm.master);\n resetForm();\n }",
"function resetView() {\n $viewEntries.className... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Add all of the school properties onto the array of schools associated with a given site | function addSiteSchoolComputes(siteSchools, schools) {
_.forEach(siteSchools, function (siteSchool) {
// Lookup the school associated with the site in the list of schools
var foundSchool = _.findWhere(schools, { code: siteSchool.code });
if (foundSchool) {
... | [
"addSchool(school){\n //If no schools in mySchools array yet, start it\n if(this.mySchools.length == 0){\n this.mySchools = [school];\n }\n else{\n //If the school was already selected, don't add it twice\n if(this.mySchools.in... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get the channel name from the user with ENTER key | function get_channel_from_keyboard(event) {
// Number 13 is the "Enter" key on the keyboard
if (event.keyCode === 13) {
// Cancel the default action, if needed
event.preventDefault();... | [
"function getChannelNameByInput() {\n\treturn $('#tbxChannelname').val();\n}",
"function GetChannelName(){\n var channelname = config.App.Channel.name;\n if(channelname !== \"\" && channelname !== undefined){\n return channelname;\n }\n else{\n var name = readline... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
methods start here generates and binds the route to the correct udpsend in the max patch | function makeNetsend(val)
{
if(arguments.length) // bail if no arguments
{
// parse arguments
a = arguments[0];
// safety check for number of udpsends
if(a<0) a = 0; // too few, set to 0
if(a>instanceMax) a = instanceMax; // too many udpsends, set to maximum allowed
steps = []; // array for route numbe... | [
"function udp_route_static()\n{\n if (debug) { post(\"TRACE: udp_route_static ( )\\n\"); }\n\n // Get the udp subpatcher and remove all the objects with the exception of the inlets\n var udp_patch = top_patch.getnamed(\"udp_route\").subpatcher();\n udp_patch.apply(rem_objects);\n\n // Get the inlet objects\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Adds a collection strategy to be located when iterating different collection types. | addStrategy(collectionStrategy: Function, matcher: (items: any) => boolean) {
this.strategies.push(collectionStrategy);
this.matchers.push(matcher);
} | [
"function collect(type, collection, implemented) {\n implemented = implemented || new Dict();\n\n collection.inherits.forEach(function (parent) {\n if (collections.has(parent)) {\n collect(type, collections.get(parent), implemented);\n }\n });\n collection.mixin.forEach(function... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Given the current environment, this method must return the current url as URL instance | getUrl() {
if (!this._url) {
this._url = new URL(location + "");
}
return this._url;
} | [
"function get_current_url() {\n if (exports.CONTEXT_IS_BROWSER)\n return new URL(location);\n return new URL(get_current_href(), get_current_href());\n}",
"get url()\n\t{\n\t\treturn this.ctx.url;\n\t}",
"function getCurrentURL() {\n return window.location.href;\n}",
"static async getURL() {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Start a new project. The response from this button depends on whether the server is online or offline. | function new_proj() {
// First, get text of server status span.
var status = $('#server_status_badge').text().toLowerCase();
// Note: we don't have to check whether the server is online because
// the "new project" button is only enabled when the server is on.
// Show the loading spinner.
var button = $('... | [
"function createNewProject() {\r\n\tvar requestData = '{'\r\n\t\t\t+ '\"command\" : \"createProject\",'\r\n\t\t\t+ '\"arguments\" : {'\r\n\t\t\t+ '\"project\" : \"' + $('#new-project-name').val() + '\"'\r\n\t\t\t+ '}'\r\n\t\t\t+ '}';\r\n\tmakeAsynchronousPostRequest(requestData, refresh, null);\t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
constructor receives: from: incoming NeuronGene object to: outgoing NeuronGene object enabled: initial state of the object. True by default. | constructor(from, to, enabled = true) {
this.id = 0;
this.from = from;
this.to = to;
this.enabled = enabled;
} | [
"clone(from, to) {\n\t\tvar clone = new connectionGene(from, to, this.weight, this.innovationNo);\n\t\tclone.enabled = this.enabled;\n\t\treturn clone;\n\t}",
"_addEdgeGene(innovationNumber, from, to, weight, enabled) {\n\t\t// Add the neurons to the networ if they do not already exist\n\t\tif (!this._network.con... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Set data to new post, clearing tmp files and updating original data. | function setPostData(scope, scrollView, replyingTo, editing, isEditing, subject, text, files) {
// Delete the local files from the tmp folder if any.
$mmFileUploaderHelper.clearTmpFiles(scope.newpost.files);
scope.newpost.replyingto = replyingTo;
scope.newpost.editing = editing;
... | [
"setPost(post) {\n // don't do anything else if we're setting the same post\n if (post === this.post) {\n // set autofocus as change signal to the persistent editor on new->edit\n this.set(\"shouldFocusEditor\", post.get(\"isNew\"));\n return;\n } // reset everything ready for a ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Computes the upper convex hull per the monotone chain algorithm. Assumes points.length >= 3, is sorted by x, unique in y. Returns an array of indices into points in lefttoright order. | function computeUpperHullIndexes(points){var n=points.length,indexes=[0,1],size=2;for(var i=2;i<n;++i){while(size>1&&cross(points[indexes[size-2]],points[indexes[size-1]],points[i])<=0)--size;indexes[size++]=i}return indexes.slice(0,size);// remove popped points
} | [
"function computeUpperHullIndexes(points) { // 10896\n var n = points.length, // 10897\n indexes = [0, 1], ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
OPERATORS takes a source as input, returns a new source general API: const operator = (...args) => inputSource => outputSource; | function pipe(source, ...ops) {
return ops.reduce((res, op) => op(res), source);
} | [
"function operatorSquare(source) {\n // create result Observable\n var result = Rx.Observable.create((observer) => {\n // subscribe source input stream\n source.subscribe(\n (x) => {\n // forward to observer.next\n observer.next(x * x);\n },\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets if the provided structure is a TypeAliasDeclarationStructure. | static isTypeAlias(structure) {
return structure.kind === StructureKind_1.StructureKind.TypeAlias;
} | [
"static isTypeAliasDeclaration(node) {\r\n return node.getKind() === typescript_1.SyntaxKind.TypeAliasDeclaration;\r\n }",
"function isAliasSymbol(symbol, ts) {\n return hasFlag(symbol.flags, ts.SymbolFlags.Alias);\n}",
"function isTypeAlias(context, node, type) {\n if (!type || !node ||... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Examples: first3("Techtonica") > "Tec" first3("Baby Yoda") > "Bab" Hint: [ | function first3(string){
return(
// your code here
)
} | [
"function first3(string){\n let arr = string.split(\"\",3);\n return arr.join(\"\")// or: arr[0]+arr[1]+arr[2];\n}",
"function front3(str)\n {\n if (str.length < 3) {\n return str + str + str\n } else {\n var first3 = str.substring(0, 3)\n return first3 + first3... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
format event as HTML | formatEvent(event) {
var event_date = luxon.DateTime.fromSQL(event.date_and_time, {zone: event.timezone});
var eventHTML = "<div class='card mb-3 midground rounded-0'>";
eventHTML += `<img src="img/events/${event.img}" alt="${event.title}" class='card-image-top img-w100'>`;
eventHTML += "<div class='car... | [
"function formatEvent(event) {\n // display_timestamp based on configured timezone and format\n if (selected_index_config.display_timestamp_format != null) {\n var display_timestamp = moment(event['display_timestamp']);\n if (selected_index_config.display_timezone !== 'local') {\n display_tim... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Maybefantasyland/traverse :: Applicative f => Maybe a ~> (TypeRep f, a > f b) > f (Maybe b) . . `traverse (A) (f) (Nothing)` is equivalent to `of (A) (Nothing)` . `traverse (A) (f) (Just (x))` is equivalent to `map (Just) (f (x))` . . ```javascript . > S.traverse (Array) (S.words) (Nothing) . [Nothing] . . > S.traverse... | function Nothing$prototype$traverse(typeRep, f) {
return Z.of (typeRep, this);
} | [
"traverse(T, f) {\n\t\t// Applicative u, Traversable t => t a ~> (TypeRep u, a -> u b) -> u (t b)\n\t\treturn T.of(AJS.of(f(this.value).value))\n\t}",
"function Array$prototype$traverse(typeRep, f) {\n var xs = this;\n function go(idx, n) {\n switch (n) {\n case 0: return of (typeRep, []);\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Pipe a value through a series of transformers. | function pipe(value) {
function nextPipe(transformer) {
return pipe(transformer(value));
}
nextPipe.value = value;
return nextPipe;
} | [
"function pipeline(value, function1, function2){\n return function2(function1(value));\n }",
"function pipeA(value) {\r\n function nextPipe(transformer) {\r\n return pipeA(Promise.resolve(value).then(transformer));\r\n }\r\n nextPipe.value = Promise.resolve(value);\r\n return nextPipe;\r\n}... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Toggles maximum range search filter | function toggleMax() {
var maxInput = document.getElementById('rangeTextMax');
maxInput.disabled = !maxInput.disabled;
} | [
"function setFilterMax(event) {\n updateFilter(event.currentTarget, \"max\");\n}",
"function filterPriceMax(btn) {\n const minUpdate = document.getElementById(\"one\")\n filterObject.priceRange.max = btn.value\n filterObject.priceRange.min = minUpdate.value\n updateList()\n}",
"function setFilter(ionRang... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Metodo: Listar productos de media res | listarMediaRes(req, res) {
return __awaiter(this, void 0, void 0, function* () {
try {
// Ordenar
let ordenar = [req.query.columna || 'descripcion', req.query.direccion || 1];
// Filtrado
const busqueda = {};
let filtroO... | [
"function getMediaGallery(product) {\n var e_1, _a;\n var mediaGallery = [];\n if (product.media_gallery) {\n try {\n for (var _b = __values(product.media_gallery), _c = _b.next(); !_c.done; _c = _b.next()) {\n var mediaItem = _c.value;\n if (mediaItem.image)... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
When the value is a function, the function is still evaluated only once per element even if there are multiple class names. | function classedFunction() {
var i = -1, x = value.apply(this, arguments);
while (++i < n) name[i](this, x);
} | [
"function iterate(className, func, value){\n\t\n\tvar elems = document.getElementsByClassName(className);\n\tfor (i = 0; i<elems.length; i++){\n\t\tfunc(elems[i], value);\n\t}\n}",
"function classedFunction() {\n var i = -1, x = value.apply(this, arguments);\n while (++i < n) name[i](this, x);\n }",
"fun... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
FUNCTION: SBRecordsetPHP.decodeVarRefs DESCRIPTION: Takes an SQL string and decodes the variable references into a form presentable to the user. These references are returned in the varNameArray parameter. ARGUMENTS: theSQL string. the SQL extracted from the code varNameArray an array to populate with the referenced va... | function SBRecordsetPHP_decodeVarRefs(theSQL, varNameArray)
{
var retVal = (theSQL != null) ? theSQL : "";
// in case of upgrade from 2004 all like params are sourounded by '
var myRe = /'(%*%s%*)'/;
retVal = retVal.replace
(/like\s+'%*%s%*'/ig,
function (str,offset,s) {
... | [
"function SBRecordsetPHP_decodeVarRefs(theSQL, varNameArray) \r\n{\r\n var retVal = (theSQL != null) ? theSQL : \"\";\r\n \r\n // if we escaped the percent signs for use in the sprintf statement,\r\n // then unescape them\r\n if (retVal.indexOf(\"%%\") != -1)\r\n {\r\n retVal = retVal.replace(/%%/g, \"%\"... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function to add stock to the list | function addList() {
var x = document.getElementById("stock_name").value;
callAPI(x, 0, -1); //calling API to add stock to list
} | [
"function add_stock(event) {\n var selected_stock = which_checked(),\n i;\n for (i = 0; i < selected_stock.length; i++) {\n update_stock(selected_stock[i], 'add');\n };\n}",
"function addStock(symbol) {\r\n // don't add stock if it already exists in the list\r\n const filteredList = stockList.filter(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
length field validation function console.log( length_field_check("12345675890", "faxNum", "conf1")); | function length_field_check(input, type, config){
var lowerbound = eval(config)[type].minlenght;
var upperbound =eval(config)[type].maxlenght;
if(input.length >= lowerbound && input.length <=upperbound)
{
return true;
}
else
{
return false;
}
} | [
"function validateLength(field) {\n \n}",
"function checkPhoneLength() {\n let phoneLength = phone.value.length;\n if (phoneLength < 17) {\n error_phone = true;\n } else {\n error_phone = false;\n }\n displayError(error_phone, phoneError)\n }",
"fu... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function removedeadinsert() closes the Dead Code popup. | function removedeadinsert() {
document.getElementById('deadselection').style.visibility = "hidden";
} | [
"function exitDeleteWarning() {\n let warningContainer = document.getElementById('delete-warning-container')\n warningContainer.style.zIndex = 0\n deleteWarning.style.visibility = 'hidden'\n allowPointerEvents()\n}",
"hideBlockInsertionPoint() {\n if (this.insertionBlockEl) {\n this.el.removeC... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
/ Return true if input ship is an onmap aircraft carrier or / airbase. | function canHasAircraft(ship) {
return ($.inArray(ship.ShipType, ["CV", "CVL", "BAS"]) > -1 && $.inArray(ship.Location, ["DUE", "OFF", "SNK"]) == -1);
} | [
"function isShip(coordinate) {\n\tif (lightCell(coordinate) == 'v') {\n return true;\n } else {\n return false;\n }\n}",
"function isShip(coordinates) {\n if (lightCell(coordinates) == 'v') {\n return true;\n } else {\n false;\n }\n }",
"fixed() {\n return this.type ==... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Disable playback slider and change CSS to display disabled cursor on hover | function disableSlider (slider, div) {
slider.disable();
const children = div.getElementsByTagName('*');
for (let i = 0; i < children.length; i++) {
if (children[i].style) {
children[i].style.cursor = 'not-allowed';
}
}
} | [
"function enableSlider (slider, div) {\n\n slider.enable();\n\n const children = div.getElementsByTagName('*');\n\n for (let i = 0; i < children.length; i++) {\n\n if (children[i].style) {\n\n children[i].style.cursor = '';\n\n }\n\n }\n\n}",
"function stopSlider() {\n docu... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
compute possible schedules. returns true if all went fine, false if no possible schedules. since this will be exponential with course count anyway, we do some kind of branch elimination. instead of getting all permutations and checking them if they are viable, we branch course by course. we do this by maintaining sorte... | function compute(){
var i, j, k, out = [sortsch(dontfills)], out_nxt, sects = digest(get_sects());
for(i=0; i<sects.length; i++){
out_nxt = [];
if(hasphantom(sects[i])) break;
for(j=0; j<out.length; j++){
for(k=0; k<sects[i].length; k++){
var part = out[j].tuck_multiple(sects[i][k]);
if(viable(part))... | [
"function viable_schedules(courses) {\n return viable(courses, []);\n\n /**\n * Viable Schedule Helper Function\n *\n * @param courses Array of Arrays of Courses categorized seminar field\n * @param schedules List of Schedules that are comprised of Lists of courses\n * @returns Returns Lis... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Generate random number, dependent on how many tips there are. | function generateNumber() {
return Math.floor(Math.random() * tipsArray.length);
} | [
"function generateTip() {\n\tgenerateNumber()\n\tvar tip = tipsList[ generatedNumber ]\n\treturn tip\n}",
"function getRandomNum() {\r\n\treturn Math.floor(Math.random() * 1e13);\r\n}",
"function generateNum() {\n goalNumber = Math.floor((Math.random() * 120) + 19);\n }",
"function generateTarget()... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Renders the AWS CloudFormation properties of an `AWS::WAFv2::WebACL.JsonBody` resource | function cfnWebACLJsonBodyPropertyToCloudFormation(properties) {
if (!cdk.canInspect(properties)) {
return properties;
}
CfnWebACL_JsonBodyPropertyValidator(properties).assertSuccess();
return {
InvalidFallbackBehavior: cdk.stringToCloudFormation(properties.invalidFallbackBehavior),
... | [
"function cfnWebACLBodyPropertyToCloudFormation(properties) {\n if (!cdk.canInspect(properties)) {\n return properties;\n }\n CfnWebACL_BodyPropertyValidator(properties).assertSuccess();\n return {\n OversizeHandling: cdk.stringToCloudFormation(properties.oversizeHandling),\n };\n}",
... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Fires each callback for the "ready" event. | function _fireReadyEventCallbacks() {
_callbacks.ready.forEach(function(callback) {
callback();
});
} | [
"function fireReady() {\n\t\tvar i;\n\t\tdomready = true;\n\t\tfor (i = 0; i < readyfn.length; i += 1) {\n\t\t\treadyfn[i]();\n\t\t}\n\t\treadyfn = [];\n\t}",
"_onReady() {\n this.ready = true;\n if (this._whenReady) {\n this._whenReady.forEach(fn => fn.call(this, this));\n this._whenReady = null;... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
base ajax function. url : is php/html file that returns response text param : is in 'xxx=123&yyy=456' url format handler : is the function name to call with returned response text handle_id : is div/span container id="handle_id" which will receive response text (but can also just be a marker) | function xhr(url,param,handler,handle_id) {
var ro=window.XMLHttpRequest ? new XMLHttpRequest() : new ActiveXObject("Microsoft.XMLHTTP");
ro.open('POST',url,true);
ro.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
ro.onreadystatechange=function(){if(ro.readyState==4) handler(ro.responseTe... | [
"function ajaxify(url){\n $.get(url, function(response) {\n handleResponse(response);\n });\n }",
"function ajaxRequestHandler(url, method, paramStr) {\n var xml = new XMLHttpRequest();\n xml.open(method, url, true);\n if(paramStr && paramStr != \"\")\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Close the menu and call the AuthActions to logout the user. | _logout() {
this._closeMenu();
AuthActions.logout();
} | [
"onLogoutClick() {\n logout();\n this.onMenuClose();\n }",
"function logout() {\n // restore previous mainbar content\n mainBar.find('li.welcome, li.logout').remove();\n mainBar.find('li').show();\n // ask the user to logout ;)\n T.user.logout();\n }",
"onLogoutClick... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Composes a new model from one or more existing model types. This method can be invoked in two forms: 1. Given 2 or more model types, the types are composed into a new Type. 2. Given 1 model type, and additionally a set of properties, actions and volatile state, a new type is composed. Overloads: `compose(...modelTypes)... | function compose() {
var args = []
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i]
}
var typeName = typeof args[0] === "string" ? args.shift() : "AnonymousModel"
if (
args.every(function(arg) {
return isType(arg)
})
) {
// comp... | [
"function compose$$1() {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n // TODO: just join the base type names if no name is provided\n var typeName = typeof args[0] === \"string\" ? args.shift() : \"AnonymousModel\";\n // check all para... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get the UI style of selection button | get styleSelectBtn() { return Object.assign({}, this.style.comboBox.button); } | [
"get selectionStyle() {\n return this._selectionStyle;\n }",
"get selectionColor() {}",
"getActiveStyle() {\n\n let style = \"\";\n this.bar.buttons.forEach(button => {\n if (button.active) {\n if (button.type == \"style\" || button.type == \"align\") {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This class holds the neural network, the tetris game, and the created training data | function Holder(){
this.network = new Network();
//For replacing a network if intial weights are really bad
this.replaceNetwork = function() { this.network = new Network(); }
this.game = new TetGameGD();
this.xs = []; //Inputs for training
this.ys = [[]]; //Targets for training
this.masks = []; //Masks for tr... | [
"function trainNetwork() {\n let trainData = inputGridToMatrix();\n NETWORK.train(trainData);\n}",
"function NeuralNetwork(){\n /**\n * matrix is an adjacentcy list representing the network\n * the value at matrix[i][j] is the weight of the synapse connecting\n * neuron i to neuron j.\n * Inherentl... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function: Add xattr with user.readlist for a specified file or folder Parameters: path > specified from caller which to deal with value > readlist's new value | function AddReadlistXattr(path, value)
{
var filename = path;
fs.stat(path, function(err, stats)
{
if (err)
{
console.log('Get State Error!');
}
else
{
if (stats.isDirectory() || stats.isFile())
{
// get xattr fir... | [
"function AddWritelistXattr(path, value)\n{\n var filename = path;\n\n fs.stat(path, function(err, stats)\n {\n if (err)\n {\n console.log('Get State Error!');\n }\n else\n { \n if (stats.isDirectory() || stats.isFile())\n {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sets the focused option of the selectionlist. | _setFocusedOption(option) {
this._keyManager.updateActiveItem(option);
} | [
"function onFocus() {\n if (this._mouseDownFlag !== true && this._options.autoSelect === true && this.index === -1) {\n this._activeDescendant.index = 0;\n this.items[0].setAttribute('aria-selected', 'true');\n\n if (this._options.useAriaChecked === true) {\n this.items[0].setAttr... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Enable Draging by enabling dragControlVertical and dragControlHorizontal. | enableDrag() {
this.dragControlVertical.enabled = true;
this.dragControlHorizontal.enabled = true;
} | [
"disableDrag() {\n this.dragControlVertical.enabled = false;\n this.dragControlHorizontal.enabled = false;\n }",
"enableDrag() {\r\n this.disableDragEvents = false;\r\n }",
"enableDrag() {\n const o = this.options;\n\n if (o.drag && this._pane) {\n const dragP... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Make FooMediaObject and BarMediaObject for testing the queue | function FooMediaObject (obj) {
MediaObject.call(this, obj);
} | [
"function createMedia() {\r\n batchAssMedia();\r\n }",
"configureImageQueue() {\n this.queue = new ImageQueue((meta, k) => {\n if (!meta) return;\n if (this.mediaTypes[meta.type]) {\n this.mediaTypes[meta.type].apply(this, [ meta.payload, k, k+100 ])\n }\n else {\n t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Responsible for rendering the differnet shapes | function Shapes() {
var renderShape = {
box: function(E1) {
var rx = E1.position.x;
var ry = E1.position.y;
noStroke();
fill(55, 189, 255);
rect(rx - game.renderOffset.x, ry + game.renderOffset.y, E1.size.width, E1.size.height);
}
};
... | [
"function renderShapes() {\n \n //Draw the shapes\n for (var i = 0; i < shapes.length; i++) {\n\t\t\n\t\t// Check the type of the shape\n\t\tif (shapes[i].type == \"rect\") {\n\t\t\n\t\t\t// Draw the shape\n\t\t\tdrawRect(shapes[i]);\n\t\t\n\t\t}\n\t\telse if (shapes[i].type == \"circle\") {\n\t\t\t\n\t\t\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Prints InterfaceExtends, prints id and typeParameters. | function InterfaceExtends(node, print) {
print.plain(node.id);
print.plain(node.typeParameters);
} | [
"function InterfaceExtends(node, print) {\n print.plain(node.id);\n print.plain(node.typeParameters);\n}",
"function _interfaceish(node, print) {\n\t print.plain(node.id);\n\t print.plain(node.typeParameters);\n\t if (node[\"extends\"].length) {\n\t this.push(\" extends \");\n\t print.join(node[\"exten... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
convert enter to tab behavior: pressing enter will focus the next input field | function initConvertEnterToTab() {
$('body').on('keydown', 'input, select', function(e) {
//console.log('init convert enter to tab');
if( $(this).hasClass('submit-on-enter-field') ) {
//console.log('submit-on-enter-field !');
return;
}
//console.log('continue ... | [
"function onEnterAdvanceFocus() {\n $(\"input\").bind('keypress', function (event) {\n if (event.keyCode === 13) {\n var $set = $('input'),\n $next = $set.eq($set.index(this) + 1);\n $next.focus();\n }\n });\n }",
"function tabKeyPressed(event)\n{\n\t//9 = enter\n\treturn k... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
output CLI help screen | function outputHelp(){
print([
"\nUsage: csslint-rhino.js [options]* [file|dir]*",
" ",
"Global Options",
" --help Displays this information.",
" --format=<format> Indicate which format to use for output.",
" --list-rules Outputs all ... | [
"function outputHelp(){\n print([\n \"\\nUsage: csslint-rhino.js [options]* [file|dir]*\",\n \" \",\n \"Global Options\",\n \" --help Displays this information.\",\n \" --rules=<rule[,rule]+> Indicate which rules to include.\",\n \" --format=<format> ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
link to viewbook from saved page | function viewBook( books) {
if(books){
return window.location.assign(books.link)
}else{
return 'No link for book!'
}
} | [
"function viewBook(objToView) {\n var viewedBookTitle = escape(objToView.id.replace(\"btnView\", \"\")); //get book title\n //open the viewer page with page 1 and book title\n window.location = '../web/viewer.html?bookName=' + viewedBookTitle + '&bookPage=1';\n\n}",
"function viewBook(book){\n his... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Save the status into our Firestore DB | async saveStatus(status) {
const db = FirebaseLib.FIRESTORE_DB;
try {
const ref = db.collection(config.DBPaths.HISTORY).doc();
const now = firebase.firestore.Timestamp.now();
await ref.set({value: status, startedAt: now});
this._checkNext(status);
... | [
"async function sendCommand(status) {\n try {\n //Create a random id\n id = Date.now().toString();\n //Send the status to the firebase\n await firebase.firestore().collection('status').doc().set({\n key: id,\n status: status,\n time: new Date(),\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
send poll to public poll db and redirect to myPolls page | function updatePublicAndRedirect(){
publicPollCollection.insert({
username: username,
poll: submittedPoll,
options: optsArray,
updated: false,
dateCreated: time
}, function (err,doc){
if (err) {
res.send("There was a problem adding to database.");
}
else{
res.location('m... | [
"function sendData() {\n dispatch(\n addPoll({\n question: question,\n options: options,\n status: status,\n }),\n )\n history.replace('/view-poll')\n }",
"function redirect() {\n\n $(\"#result_link\").on(\"click\", function () {\n window.location.href = \"/admin/poll/... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns the selected color. | get selectedColor() {
return this._selectedColor;
} | [
"get selectionColor() {}",
"function colorSelected() {\n var node = this.selection.getNode();\n return standardizeColor(Element.getStyle(node, 'color'));\n }",
"get selectedColor() {\n\t\treturn this._selectedColor;\n\t}",
"getSelectedColor() {\n // return first selected label color\n const sel =... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Retorna todos os instrutores | function list(){
return $http.get(urlBase + '/instrutor');
} | [
"function listarInstrutores () {\n instrutorService.listar().then(function (resposta) {\n //recebe e manipula uma promessa(resposta)\n $scope.instrutores = resposta.data;\n })\n instrutorService.listarAulas().then(function (resposta) {\n $scope.aulas = resposta.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
it displayes all the namespaces int he first drop down | function processResponse(){
if ((xmlObj.status ==200) && (xmlObj.readyState == 4)){
allNamespaces = JSON.parse(xmlObj.responseText)
const nsSelect = document.getElementById("namespaces")
for (var i=0; i<allNamespaces.length; i++){
var anOption = document.createElement("... | [
"function collectNamespaces()\n\t\t{\n\t\t\tvar namespaces = new Array();\n\t\t\t$(\".namespaces fieldset ul li input\").each(function() {\n\t\t\t\tnamespaces.push($(this).val());\n\t\t\t\t\n\t\t\t});\n\t\t\treturn namespaces;\n\t\t}",
"function loadNamespaces() {\n function toggleNamespaces() {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Initialize app service and reviews service | async function initServices() {
await Vue.prototype.$appService.init()
await Vue.prototype.$reviewAppService.init()
} | [
"initializeAppServices() {\n\t\t// initializes menu handler\n\t\tthis.menuHandler = new MenuManagerService(Menu, app);\n\n\t\t// initialize app manager service\n\t\tthis.appManager = new AppManagerService({\n\t\t\tapp: app,\n\t\t\tdebugMode: true,\n\t\t\tmenuManager: this.menuHandler,\n\t\t});\n\t}",
"async initi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Prints DeclareFunction, prints id and id.typeAnnotation. | function DeclareFunction(node, print) {
this.push("declare function ");
print.plain(node.id);
print.plain(node.id.typeAnnotation.typeAnnotation);
this.semicolon();
} | [
"function DeclareFunction(node, print) {\n this.push(\"declare function \");\n print.plain(node.id);\n print.plain(node.id.typeAnnotation.typeAnnotation);\n this.semicolon();\n}",
"function declaration() {\n console.log(\"Hi, I'm a function declaration!\");\n }",
"function FunctionTypeAnnotation(node,... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This is a solution to React Router's issue of not scrolling to hashlinks when use using the component to navigate. It uses a Router onUpdate hook and calls element.scrollIntoView() if a hash is present in the url. Since it's defined on the Router component, the scroll functionality will work with every route, and it wo... | function hashLinkScroll() {
if (window && document) {
let {hash} = window.location;
if (hash !== '') {
// Push onto callback queue so it runs after the DOM is updated,
// this is required when navigating from a different page so that
// the element is rendered on the page before trying... | [
"scrollToAnchor() /* istanbul ignore next */ {\n const validateHashSelector = function (hash) {\n return /^#[a-zA-Z_]\\d*$/.test(hash);\n };\n\n let hash = window.location.hash;\n if (\n !hash ||\n ((hash = hash.slice(hash.lastIndexOf('#'))) &&\n !va... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Checks if this instance is being used to print a PDF. | function isPrintingPDF() {
return ( /print-pdf/gi ).test(window.location.search);
} | [
"function isPrintingPDF() {\n\n\t\t\treturn ( /print-pdf/gi ).test( window.location.search );\n\n\t\t}",
"function isPrintingPDF() {\n\n\t\treturn ( /print-pdf/gi ).test( window.location.search );\n\n\t}",
"isPrintingPDF() {\n\n\t\treturn ( /print-pdf/gi ).test( window.location.search );\n\n\t}",
"isPrintingP... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Converts a money value in the form $?,???.00 to a regular number | function unformatMoney(money) {
return parseFloat(money.replace(/[$,]/g, ""));
} | [
"function convertCurrency(amount='100usd'){\n const money = amount.toLowerCase();\n let result = '';\n let digits = 0;\n\n switch(money.replace(/[0-9.]/g,'')){\n case 'uah':\n digits = money.replace(/[a-z]/g, '');\n result = `${digits / 25}$`;\n break;\n ca... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
merge several streams into one stream providing the values of all streams as an array accepts also non stream elements, those are just copied to the output the merge will only have a value if every stream for the merge has a value | function merge$(potentialStreamsArr) {
var values = potentialStreamsArr.map(function (parent$) {
return parent$ && parent$.IS_STREAM ? parent$.value : parent$;
});
var newStream = stream(values.indexOf(undefined) === -1 ? values : undefined);
potentialStreamsArr.forEach(function (potentialStream, index) {
... | [
"function merge$(potentialStreamsArr) {\n var values = potentialStreamsArr.map(function (parent$) {\n return parent$ && parent$.IS_STREAM ? parent$.value : parent$;\n });\n var newStream = stream(values.indexOf(undefined) === -1 ? values : undefined);\n potentialStreamsArr.forEach(function (potentialStream, ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Draw a label next to the line indicating slope | function drawSlopeLabel() {
let label = document.getElementById("slopeLabel");
// display when points are pinned. do not redraw if nothing changed
if (pt1.pinned && pt2.pinned && m != label.innerHTML.substring(2)
&& isFinite(m) && m != 0 && !riseRunDisplay) {
// find midpoint of line, put the label the... | [
"drawLabel(){\n //Get data\n let currLeg = legData.leg_list[this.legNum];\n let num = this.legNum + 1;\n let dist = currLeg.dist;\n\n //Create string\n let infoString = LEG_LABEL + str(num) + \"\\n\"\n + DIST_LABEL + str(dist) + MI_LABEL + \"\\n\"\n + ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
TODO: Remove all of the rows (tr) in the cart table (tbody) | function clearCart() {
var tableRows = document.querySelectorAll('#cart tbody tr');
for (var i = 0; i <= tableRows.length; i++) {
if (tableRows[i]) {
tableRows[i].remove();
}
}
} | [
"function clearCart() {\n var tbodyEl = document.getElementsByTagName('tbody')[0];\n var tableRows = tbodyEl.getElementsByTagName('tr');\n var rowCount = tableRows.length;\n for (var x = rowCount - 1; x >= 0; x--) {\n tbodyEl.removeChild(tableRows[x]);\n }\n}",
"function clearCart() {\n var tableRows = d... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Test whether we can use ranges to measure bounding boxes Opera doesn't provide valid bounds.height/bottom even though it supports the method. | function supportRangeBounds() {
var r, testElement, rangeBounds, rangeHeight, support = false;
if (doc.createRange) {
r = doc.createRange();
if (r.getBoundingClientRect) {
testElement = doc.createElement('boundtest');
testElement.style.height = "123px";
testElement.style.dis... | [
"function supportRangeBounds()\n {\n var r, testElement, rangeBounds, rangeHeight, support = false;\n\n if ( doc.createRange ) {\n r = doc.createRange();\n if ( r.getBoundingClientRect ) {\n testElement = doc.createElement( 'boundtest' );... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
doPassZero() Pass zero goes through the document, and makes sure that tags aren't nested too deeply for us to handle Returns true if ok, false if nesting is too deep | function doPassZero()
{
var root = dreamweaver.getDocumentDOM('document');
var stubCallback = new Function( "node", "userData", "return true;" );
var retVal = true;
if ( root != null && root.hasChildNodes() )
{
retVal = traverse( root, stubCallback);
if (retVal == false)
... | [
"checkTag(tag){\r\n console.log(this.tagsfound);\r\n if(this.tagsfound.indexOf(tag)>=0)return true;\r\n if(tag.children.length==0)return false;\r\n for(var i=0;i<tag.children.length;i++){\r\n var haschild = this.checkTag(tag.children[i]);\r\n if(haschild==false)retu... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Fill order details for selected shipping | function fillOrderDetails (selectedRow) {
console.log ("Filling order details to update shipping");
$ ('#shippingDetails').find ('#sRowId').val (selectedRow.index ());
fillShippingDataForUpdating (selectedRow.data ());
} | [
"function shipping(details) {\n if (_.isObject(details)) {\n $lastPromise = $$\n .postCartDetails(composeShippingData(details), { validates: 'shipping' })\n .then(onSyncd);\n\n return _this_;\n }\n\n return extractShippingData();\n }",
"function populateReviewAndPlace... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Retrieves portions of the player information for the given |nickname| from the database that will be used for outputting their information on IRC. | async getPlayerSummaryInfo(nickname) {
const results = await server.database.query(PLAYER_SUMMARY_QUERY, nickname);
return results.rows.length ? results.rows[0]
: null;
} | [
"function getPlayerInfo(userid,callback) {\n let userdb = new sqlite3.Database('server/dbs/users.db');\n let sql = \"SELECT `username`,`inventory`,`spawnx`,`spawny`,`health`,`lastx`,`lasty` FROM `users` WHERE `userid`='\" + userid + \"';\";\n userdb.all(sql, function(err,rows) {\n if (err) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Detach the scroll spy | _detachScrollSpy() {
this._scrollCarrier.removeEventListener('scroll', this._scrollSpy);
this._scrollCarrier.removeEventListener('resize', this._scrollSpy);
} | [
"detach() {\n this._scrolledIndexChange.complete();\n\n this._viewport = null;\n }",
"detach() {\n this._scrolledIndexChange.complete();\n this._viewport = null;\n }",
"function _unbindScroll () {\n $window.off('scroll.items');\n }",
"_disposeScrollStrategy() {\n c... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Likewise, this is meant to finalize an element after it has had a chance to 'attach' its children (i.e. after `appendInitialChild` has run for all its child elements.) The return value of this function determines whether React Fiber will run `commitMount` for the newly created element. (I can't quite tell why this fina... | finalizeInitialChildren(newElement, type, props, rootContainerInstance) {
if (typeof newElement.finalizeBeforeMount === 'function') {
newElement.finalizeBeforeMount(type, props, rootContainerInstance);
}
} | [
"finalizeInitialChildren(props) {\n let commitMount = false;\n\n Object.entries(props).forEach(([propKey, eventHandler]) => {\n if (this.allPropHandlers.hasOwnProperty(propKey)) {\n commitMount = true;\n }\n });\n\n return commitMount;\n }",
"complete() {\n let compone... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Functions Add tab objects to array | function addTabObjects() {
tabObjects.push({
name: name,
state: state,
panelID: panelID,
panelEl: panelEl,
panelHeight: panelHeight,
tabNumber: tabNumber,
current: element,
previous: previous,
next: next,
icon: icon,
}... | [
"function populateTabArray(){\n\t\t\t\tvar tabData,\n\t\t\t\t\ttabSplit,\n\t\t\t\t\ti,\n\t\t\t\t\tindividualTab;\n\n\t\t\t\ttabData = $(\"#tabData\").val();\n\t\t\t\ttabSplit = tabData.split('|');\n\t\t\t\tfor(i=0; i< tabSplit.length ; i=i+1){\n\t\t\t\t\tindividualTab = tabSplit[i].split('/');\n\t\t\t\t\ttabArray[i... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
bind activity date chage function for select item change event | function changeActivityDate(){
$("select[id^='dateSelect']").change(function(){
$("#activityPopUp").block({ message: '<div style="position:absolute; left:100px; top:0px" ><img src="images/ajax-loader (1).gif" /></div>' });
CLICKED_ITEM_ID=$(this).attr('id');
var idSplit=$(this).attr('id').split("-");
var par... | [
"onDateSelectedListen(event) {\n const detail = event.detail;\n this.selectedDate = this.getFormattedDate(detail.month, detail.date, detail.year);\n }",
"onDateSelected(value) {\n this.value = value;\n }",
"handleDateClick(event){\n this.currentSelectedDate = event.currentTarget.ge... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
fieldToNumber start a==arrObjData b==fieldNumber | function fieldToNumber(a, b) {
$.each(a, function (index, item) {
$.each(item, function (key, value) {
$.each(b, function (index_1, item_1) {
if (key == item_1) {
a[index][key] = parseFloat(a[index][key]);
}
});... | [
"'bb_record_to_bb_index_record'(bb_record) {\n //console.log('this.table.name', this.table.name);\n // \n\n // Think this fn will take a little while + more focus to get right.\n // It fits in generally with keeping data encoded as binary until it's needed.\n // Faster internal ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Use callback either only on the initial render or on all renders. In concurrent mode the "initial" render might run multiple times | function useInitialOrEveryRender(callback, isInitialOnly) {
if (isInitialOnly === void 0) { isInitialOnly = false; }
var isInitialRender = useRef(true);
if (!isInitialOnly || (isInitialOnly && isInitialRender.current)) {
callback();
}
isInitialRender.current = false;
} | [
"function useInitialOrEveryRender(callback, isInitialOnly) {\n if (isInitialOnly === void 0) { isInitialOnly = false; }\n var isInitialRender = React.useRef(true);\n if (!isInitialOnly || (isInitialOnly && isInitialRender.current)) {\n callback();\n }\n isInitialRender.current = false;\n}",
... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Add an item to order | function addItem() {
var order = ordersGrid.selection.getSelected()[0];
itensStore.newItem({
pi_codigo: "new" + itensCounter,
pi_pedido: order ? order.pe_codigo : "new",
pi_prod: "",
pi_quant: 0,
pi_moeda: "R$",
pi_preco: 0,
pi_valor: 0,
pi_desc: 0,
pi_valort: 0,
pr_descr:... | [
"function addToOrder(item) {\n var table = getCurrentTable();\n //Checks that the order isn't full(above 10)\n if(checkFullOrder(table.item_id))\n {\n return;\n }\n var key;\n //Depending where it was added from, the variable item is different\n if (item.includes(':')) {\n key = getIdFromName(item.spl... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Converts an Immutable Sequence to JS object Can be called on any type | function toJS(arg) {
// arg instanceof Immutable.Sequence is unreleable
return (isImmutable(arg))
? arg.toJS()
: arg;
} | [
"function toJS(arg) {\n\t // arg instanceof Immutable.Sequence is unreleable\n\t return (isImmutable(arg))\n\t ? arg.toJS()\n\t : arg;\n\t}",
"sequenceToJSON(sequence) {\n return sequence.getValue();\n }",
"function toJS(x) {\n // nil -> null\n if (x == null) {\n return null\n }\n\n con... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
post req must provide currentDirId, dirName currentDirId might be null if it's root directory | function makeDirectory(req, res, next) {
req.body.currentDirId = parseInt(req.body.currentDirId);
if (!(req.body.dirName)) {
return next(new Error('Missing some fields'));
}
if (!req.body.currentDirId && req.body.currentDirId !== 0) {
req.body.currentDirId = null;
}
Nodes.insertDirectory(
req.bo... | [
"function new_dir(current_dir) {\n new_dir_name = prompt(\"Name for new folder:\");\n xmlhttp = new XMLHttpRequest();\n xmlhttp.open(\"POST\", (\"/admin/new-dir/\"), true);\n xmlhttp.send('{\"current_dir\": \"' + current_dir + '\", \"name\": \"' + new_dir_name + '\"}');\n window.location.href = \"/admin/browse... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Loads the login page | function loadLogin() {
var login = $("#login");
login.load("view/login.html", function () {
userSetup.setupLogin();
});
} | [
"function loadLogin(){\n\t\t$('body').load('templates/login.html', function(){\n\t\t\t$('#login_button').click(checkCredentials);\t\n\t\t});\n\t\t\n\t\t\n\t}",
"function loadLoginPage(){\n\tnavigate(loginForm);\n\tvar phs = new PlaceholderSupporter();\n\tphs.init();\t\n}",
"function load_login_page() {\n pag... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
function to handle user request to sign in as anonymous | function anonymousSignIn(e) {
e.preventDefault();
errorReset();
window.Babble.register({ name: '', email: '' });
} | [
"function anonymousLogIn() {\n firebase.auth().signInAnonymously()\n .then(user => {\n // capture the user data as guest\n let status = \"new\";\n captureUserData(user, status);\n // if successful login then display relevant guest items\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Objects Trash object THIS CAN CARRY OVER TO OTHER LEVELS!(!!!) | function Trash(spawnX, spawnY){
//Functions to create trash and children
this.createTrash = function(x, y) {
var trash = game.add.sprite(x, y, 'Trash');
game.physics.enable(trash);
trash.body.collideWorldBounds = true;
return trash;
}
this.createChild = function(... | [
"addTrash()\n {\n let tilt = Phaser.Math.Between(0, 50);\n let trash = new Garbage(this, this.garbageSpeed - tilt);\n this.trashGroup.add(trash);\n }",
"keep(obj) {\n try {\n this.redoList = []\n if (this.current) {\n this.undoList.push(this.current)\n }\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sets the currentlyselected month based on a model value. | _setSelectedMonth(value) {
if (value instanceof DateRange) {
this._selectedMonth = this._getMonthInCurrentYear(value.start) ||
this._getMonthInCurrentYear(value.end);
}
else {
this._selectedMonth = this._getMonthInCurrentYear(value);
}
} | [
"setDefaultMonth() {\n let defaultMonth = this.selectedMonthFromCalendar >= 0 ? this.selectedMonthFromCalendar : this.now.getMonth();\n if (!this.selectedMonthFromCalendar) {\n if (this.throughYear < this.now.getFullYear()) {\n defaultMonth = 0;\n }\n }\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
remove the current page from url list | function removeCurrentPage (url) {
let current_page_slug = url.match(/(?:.*?\/){2}[^\/]+(.+)/);
if(current_page_slug && (current_page_slug = current_page_slug[1])) {
for(let i = 0, l = urls.length; i < l; i++) {
if(urls[i] == current_page_slug) {
console.log(`%c ✔ Initial Pag... | [
"function removeThisPageFromSite() {\n var tabId = this.getAttribute(\"data-item\");\n var siteOfPage = this.getAttribute(\"data-site\");\n var tabsFromSite = JSON.parse(localStorage.similar)[siteOfPage];\n\n var newList = tabsFromSite.filter(function (item) {\n return item.id... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
The person is at least 15 years old. They have parental supervision. The function accepts two parameters, age and isSupervised. Return a boolean. | function acceptIntoMovie(age, isSupervised) {
return (age >= 15) || (age <= 15 && isSupervised) ? true : false
} | [
"function acceptIntoMovie(age, isSupervised) {\n return age >= 15 || isSupervised === true ? true:false;\n }",
"function acceptIntoMovie(age, isSupervised) {\n return (age >= 15) || (isSupervised === true);\n}",
"function acceptIntoMovie(age, isSupervised) {\n\tif(age >=15 || isSupervised === true)... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Controller to propose time after match | async proposeTime(req, res) {
try {
await matchService.proposeTime(req.user.id, req.body).then(response => {
return res.status(HttpStatus.OK).send(response)
}).catch(error => {
if (error.error) {
return res.status(HttpStatus.INTERNAL_SE... | [
"function _updatePostMatchToLive() {\n $scope.data.MatchTime = 0;\n if($scope.homePage) {\n _liveMatch();\n } else {\n $('.match-score-summary').removeClass('pre-match');\n setTimeout(function () {\n var url = location.href;\n\n if ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
write a function that receives 2 cards, returns the higher one | function isHigher(firstCard, secondCard) {
console.log('In isHigher:', firstCard, secondCard);
if (firstCard.number === 1) {
firstCard.number = 14;
} //change ace
if (secondCard.number === 1) {
secondCard.number = 14;
} //change ace
if (firstCard.number > secondCard.number) {
if (firstCard.numb... | [
"function war(player1Card, player2Card) {\n\n\n\n if(player1Card.number > player2Card.number){\n\n return 1\n\n }\n else if(player2Card.number > player1Card.number){\n\n return 2\n }\n else{\n\n return 3\n }\n\n }",
"function getHigherC... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |