query stringlengths 9 34k | document stringlengths 8 5.39M | negatives listlengths 19 20 | metadata dict |
|---|---|---|---|
Return object of services which are defined for alias $Utils. | getUtils() {
return this._oc.get('$Utils');
} | [
"static Get(serviceName) {\n\t if(!this.g_services) this.g_services = [];\n\t \n\t return this.g_services[serviceName];\n }",
"initServices () {\n this.services.db = new DBService({\n app: this,\n db: this.options.dbBackend\n })\n this.services.rpcServer = new RPCServerService({\n app:... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
[16] FunctionCall::= FunctionName '(' ( Argument ( ',' Argument ) )? ')' [17] Argument::= Expr | function functionCall(stream, a) {
var name = stream.trypopfuncname(stream, a);
if (null == name) return null;
if (null == stream.trypop('('))
throw new XPathException(XPathException.INVALID_EXPRESSION_ERR,
'Position ' + stream.position() +
... | [
"ArgumentList() {\n const argumentList = [];\n do {\n argumentList.push(this.AssignmentExpression());\n } while (this._lookahead.type === \",\" && this._eat(\",\"));\n\n return argumentList;\n }",
"function getCallExpressionLog( callExpression ){\n var callee = callExpression.callee;\n var... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
getPartDetails() ================ Method to Get Franchise, Format Mask, Part Name and Part Price for Passed Part No. Parameters Parameter 1 Old Part No. Parameter 2 New Part No. Parameter 3 Part Cost Return value Returns and Array which has following information Index 0 Franchise Code Index 1 Format Mask Index 2 Part N... | function getPartDetails(){
var lstrPartNo = arguments[1].toUpperCase();
var lstrPartCostFlg = '';
if(arguments[2] != null) {
lstrPartCostFlg = arguments[2].toUpperCase();
}
var url = document.AppJsp.ajaxServlet.value + '/getpartdetail' + '?partno=' +
escape(lstrPartNo)+'&partCost=' ... | [
"function fetchPartDetails(responseXML, astrPartNo){\n var lobjParts;\n var lobjPart;\n var lstrPartNo;\n var lstrPartName;\n var lstrFranchise;\n var lstrFormatMask;\n var lstrPrice;\n var lstrCost;\n var lstrMinCost;\n var lstrarrPartDtl = new Array(7);\n\n //Get the Parts node\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Encodes a path separator into the given result | function encodeSeparator(result) {
return result + escapeChar + encodedSeparatorChar;
} | [
"static endPathWithPathSep ( path_str ){\n if ( ! path_str.match(TemplateSet.ends_with_path_sep_re) )\n path_str += path.sep\n return path_str\n }",
"function encodeUriPath(pathParam) { \n /*if (uriPath.indexOf(\"/\") === -1) {\n return encodeUriPathComponent(uriPath);\n }\n var... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
When the function activates, the program will take whatever value was typed into the input box and assign it to the variable 'dInput' and turn it into an integer. The program will divide that value in half and assign the result to the variable 'radius'. If there are no values inside the input box when the user clicks o... | function radiusOutput () {
dInput = document.getElementById('d-input').value
dInput = parseInt(dInput)
radius = dInput / 2
document.getElementById('radius').style.display = 'block'
document.getElementById('radius-input').innerHTML = radius
if (document.getElementById('d-input').value === '') {
document.... | [
"function volumeOfCircle(inputs) {\n const { radius } = inputs;\n if (!isNaN(Number(radius)) && Number(radius) > 0) {\n const volume = (4/3 * Math.PI * Math.pow(radius, 3)).toFixed(8);\n return `\n <p class=\"output\">Input the radius of the circle: ${radius}.</p>\n <p clas... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
To alternate the size of the image, remove or add the classsmall | function switchBtnClasses() {
if(thumbnailElement.classList.contains("small")){
thumbnailElement.classList.remove("small");
}
else {
thumbnailElement.classList.add('small');
}
} | [
"changeImageProp() {\n if (['small-image', 'benefits-hero'].includes(this.bannerType)) {\n this.responsive = true;\n this.positionOfImageClass = (this.positionOfImage.toUpperCase() === 'RIGHT') ? ' reverse' : '';\n }\n else {\n this.responsive = false;\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create a range that places this marker at the given position. | at(pos) { return new Range(pos, pos, this); } | [
"range(start, end) {\n return new vscode.Range(start, end);\n }",
"map(mapping) {\n let from = mapping.mapPos(this.from), to = mapping.mapPos(this.to);\n return from == this.from && to == this.to ? this : new SelectionRange(from, to, this.flags);\n }",
"static forRange(view, cla... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Write the messages out for the group that are present its data | function writeMessagesForGroup(id, data, forceWrite, skipCalculateTotals) {
var parent = jQuery("#" + id).data("parent");
if (data) {
var messageMap = data.messageMap;
var pageLevel = data.pageLevel;
var order = data.order;
var sections = data.sections;
//retrieve heade... | [
"function writeMessagesForChildGroups(parentId) {\n jQuery(\"[data-parent='\" + parentId + \"']\").each(function () {\n\n var currentGroup = jQuery(this);\n var id = currentGroup.attr(\"id\");\n var data = getValidationData(currentGroup, true);\n\n if (data) {\n var message... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Cancels any ongoing request to autoslide. | function cancelAutoSlide() {
clearTimeout( autoSlideTimeout );
autoSlideTimeout = -1;
} | [
"function cancelHttpRequests(){\t\t\t\r\n\t\t\t$injector.get('$http').pendingRequests.forEach(function(request) {\r\n\t\t\t\t\tif (request.cancel) {\r\n\t\t\t\t\t\trequest.cancel.resolve();\r\n\t\t\t\t\t}\r\n\t\t\t});\r\n\t\t}",
"function stopRequestIntervall() {\n\tclearInterval(youtubeRequestInterval)\n}",
"c... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
React predefined Life cycle hook that executes when first the component is mounted to the DOM. Add a listener for the Carousel of photos displayed. | componentDidMount() {
document.addEventListener('DOMContentLoaded', function() {
var elems = document.querySelectorAll('.carousel');
var instances = window.M.Carousel.init(elems, {});
});
} | [
"initCarousel() {\n this.$owlContainer = $( this.owlContainer );\n this.$owlContainer.owlCarousel({\n singleItem: true,\n pagination: false,\n mouseDrag: false,\n transitionStyle: 'fadeUp'\n });\n\n this.setState({ owlInit: true });\n }",
... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates the `MotionInput` module instance. | function MotionInput() {
_classCallCheck(this, MotionInput);
/**
* Pool of all available modules.
*
* @this MotionInput
* @type {object}
* @default {}
*/
this.modules = {};
} | [
"function Input() {\n throw new Error('Input should not be instantiated!');\n}",
"function InputManager(){\n\t/**\n\t * @var private attr\n\t */\n\tvar prv={};\n\n\t/**\n\t * @var public attr\n\t */\n\tvar pub=this;\n\n\t/**\n\t * Constructor\n\t */\n\tprv.init=function(){ \n\t\tpub.KEY_ARROW_LEFT=37;\n\t\tpub.K... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
When the Encrypt button is pressed, create a CryptoKey object from the hex encoded data in the Key input field, then use that key to encrypt the plaintext. Hex encode the random IV used and place in the IV field, and base 64 encode the ciphertext and place in the Ciphertext field. | function encrypt() {
console.log('Encrypting Key');
// Start by getting Key and Plaintext into byte arrays
var keyField = document.getElementById("key");
var hexString = keyField.value;
var keyBytes = hexStringToByteArray(hexString);
var plaintextField = document.getElementById("plaintext");
... | [
"function encryptData(textToEncryp){\n \n // Cipher text\n const cipher = crypto.createCipheriv('aes256', cipherKey, initializationVector);\n \n // Text encrypted with AES-256\n let encrypted = cipher.update(textToEncryp,'utf8','hex');\n encrypted += cipher.final('hex');\n // JSON with Ciphr... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns a Promise which sends the MAIL command to the server. We can abort the operating after a certain number of milliseconds by passing the optional `timeout` parameter. | mail(from = null, timeout = 0) {
const lines = [];
const handler = (line) => lines.push(line);
const command = `MAIL FROM:<${from}>\r\n`;
return super.write(command, handler, timeout).then((code) => {
if (code.charAt(0) === '2') {
return code;
... | [
"rcpt(to = null, timeout = 0) {\r\n const lines = [];\r\n const handler = (line) => lines.push(line);\r\n const command = `RCPT TO:<${to}>\\r\\n`;\r\n return super.write(command, handler, timeout).then((code) => {\r\n if (code.charAt(0) === '2') {\r\n return cod... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This function checks if deletion of old space is complete: If not it will wait a second an checks again, else call the callback function. | function waitForCompleteDeletion(url, callback) {
data.waitForCompleteDeletion(url, function (response) {
if (isCanceled)return;
if (JSON.parse(response).successful) callback();
else setTimeout(waitForCompleteDeletion(url, callback), 1000)
})
... | [
"function deleteOldSpace() {\n setProgress();\n let root = specif.getRoot();\n\n data.removeSpace(space.key, function (success) {\n waitForCompleteDeletion(JSON.parse(success).links.status,\n function () {\n if (isCanceled)ret... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
returns the location of an attribute when present | getAttribLocation(name) {
return this.attributes[name] ? this.attributes[name].location : -1;
} | [
"static getStandardAttribLocation(gl, program){\n return {\n position: gl.getAttribLocation(program, ATTR_POSITION_NAME),\n norm: gl.getAttribLocation(program, ATTR_NORMAL_NAME),\n uv: gl.getAttribLocation(program, ATTR_UV_NAME)\n };\n }",
"getInde... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
extract top ten countries with highest numbers | filterTopTenCountries(data) {
let header = data['columns'].map(header => header);
let lastEntryInHeaders = (header[header.length - 1])
//sort data in descending order by total numbers
let countriesSortedByTotalNumbers = data.sort(compareTotal);
function compareTotal(a, b) {
... | [
"function getLastTenCountries() {\n return countriesAll.filter(\n country => countriesAll.indexOf(country) > countriesAll.length - 11\n );\n}",
"async function getTopTradingPartners(targetCountry) {\n try {\n //Get exports\n const exports = await te.getComtradeTotalByType(\n (country = targetCoun... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
2.3 Filtering table rows | function tableFiltering(){
let filterTableRows=sortTableRows.filter(function(item, index, array){
if (filterTableName){
if(!item.name.includes(filterTableName)) return false;
}
if (filterTableChars){
if(!item.chars.includes(filterTableChars)) return false;
}
if (filterTablePrice){
if(!item.... | [
"function filter () {\n \t\tjq('#tblList').DataTable().search(\n \t\tjq('#tblList_filter').val()\n \t\t).draw();\n }",
"function _filter(rule){\t\n\t\t\t\tvar hidden_row_idx = [];//\n\t\t\t\tvar show_row_idx =[];\n\t\t\t\t\n\t\t\t\tif(rule=='simple_hide_show'){//简单显示隐藏\t\t\t\n\t\t\t\t $trs.show();... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Live jQuery hover function used to display specific behavior when a user hovers over dhildren selector. The parent slector of the children are quired for the even to be live. | function hover(parentSelector, childSelector, mouseEnter, mouseLeave) {
$(parentSelector).on({
mouseenter: function() {
if(mouseEnter != null) {
mouseEnter(this);
}
},
mouseleave: function() {
if(mouseLeave != null) {
mouseL... | [
"function addHover(){\n var hover = $('#hover');\n\n $('.icon').on(\"mouseover\", function(){\n var current = $(this);\n var coords = current.offset();\n var details = current.data(\"titles\");\n if(details.length > 0){\n hover.show()\n .html(details)\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
handleBtnNotGoBackClicked: updates the current user history and disliked lists with currentRestaurant emits event to show next search result in restaurantChoose | function handleBtnNotGoBackClicked() {
console.log('handleBtnNotGoBackClicked');
// Add restaurant to history list and liked list
let data = {
"history" : objForInsert,
"disliked" : objForInsert
};
utilities.makeDbRequest('PUT', data).then(function(data) {
hideComponent();
... | [
"function handleBackToTrips() {\n\t$('main').on('click', '.back-button', function(event) {\n\t\tgetTrips();\n\t})\n}",
"function clickHandlerBack(e) {\n e.preventDefault();\n console.log(\"Back to Listings button in MomViewDrvProfile clicked\");\n sessionStorage.removeItem(\"driverCardId\");\n history... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This method clicks on the "Help" link | clickHelp() {
return this
.waitForElementVisible('@helpLink')
.assert.visible('@helpLink')
.click('@helpLink');
} | [
"function help_OnClick()\n{\n\ntry {\n\tDVDOpt.ActivateHelp();\n}\n\ncatch(e) {\n //e.description = L_ERRORHelp_TEXT;\n\t//HandleError(e);\n\treturn;\n}\n\n}",
"function toggleHelp () {\n if (domClass.contains(\"helpUnderlay\", \"help-isVisible\")) {\n closeHelp();\n } else {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Method to update plot range based on a drag event. Takes the mouse offset introduced by the drag and adds a scale factor. | function drag_updateRange(Mx, Gx, scrollbar, scrollAction, range, event) {
scrollbar.action = mx.SB_DRAG;
if (scrollAction === "YPAN") {
var scaleFactor = Mx.scrollbar_y.trange / Mx.scrollbar_y.h;
if (scrollbar.origin === 4) { // inverted y
scaleFactor *= -1;
... | [
"function scale_changed() {\n\n var s = document.getElementById(\"scale_input\");\n //alert(\"slider value \" + s.value);\n\n var range = s.value / 100; // .25 - 2\n\n g_config.scale_factor = range;\n\n if (g_enableInstrumentation) {\n alert(\"scale_factor \" + g_config.scale_factor);\n }\n\n up... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Exit a parse tree produced by KotlinParserelvisExpression. | exitElvisExpression(ctx) {
} | [
"exitBlockLevelExpression(ctx) {\n\t}",
"visitExit_statement(ctx) {\n\t return this.visitChildren(ctx);\n\t}",
"exitJumpExpression(ctx) {\n\t}",
"exitIfExpression(ctx) {\n\t}",
"exitWhenExpression(ctx) {\n\t}",
"function Return() {\n \t\t\tdebugMsg(\"ProgramParser : Return\");\n \t\t\tvar line=lexer.curr... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Display a buffer in a debugfriendly printable format, with CRLFs escaped for easy protocol verification. | function bufferToPrintable(line) {
var s = '';
if (Array.isArray(line)) {
line.forEach(function(l) {
s += bufferToPrintable(l) + '\n';
});
return s;
}
for (var i = 0; i < line.length; i++) {
var c = String.fromCharCode(line[i]);
if (c === '\r') { s += '\\r'; }
... | [
"printBuffers() {\n for (var i = 0; i < this.numVertices; i++) {\n console.log(\"v \", this.positionData[i*3], \" \",\n this.positionData[i*3 + 1], \" \",\n this.positionData[i*3 + 2], \" \");\n }\n for (var i = 0; i < this.nu... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Initialize global storage by current domain | constructor() {
super();
this.oGlobalStorage = window.globalStorage[document.domain];
} | [
"init() {\n let localStore = model.getLocalStore();\n if (_.isNull(localStore)) {\n localStorage.setItem('vanillaPress', JSON.stringify(jsonData));\n localStore = model.getLocalStore();\n }\n }",
"async function localLoad() {\r\n console.log('Load urls and domains from local stora... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Start game Function setting the maximum character count according to word container width | function setMaxCharacterCount() {
if ($(".word").width() <= 335) {
return 8;
} else if ($(".word").width() <= 425) {
return 9;
} else if ($(".word").width() <= 490) {
return 10;
} else if ($(".word").width() <= 510) {
return 11;
} e... | [
"checkForcedWidth() {\n var maximum_string_width = 0;\n\n for(var i=0;i<this.dispatcher.split_words.length;i++) {\n var block = this.dispatcher.split_words[i];\n if(block.match(/^\\s+$/)) { // только строка из пробелов совершает word-break, так что её не проверяем\n continue;\n }\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
============================= CHANNELS pipeline wrappers ============================= image build path | function imageBuildChannel(srcPath) {
src(srcPath)
.pipe(imagemin({ verbose: true }))
.pipe(size({ showFiles: true }))
.pipe(dest(config.dest));
} | [
"buildAndPushImage(pathOrBuild) {\n return pulumi.all([pathOrBuild, this.repository.repositoryUrl, this.repository.registryId])\n .apply(([pathOrBuild, repositoryUrl, registryId]) => ecs_1.computeImageFromAsset(pathOrBuild, repositoryUrl, registryId, this));\n }",
"async function build(){\n\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Used to determine when to stop adding to dealer hand With or without an ace, dealer stands on 1721 | function stopDealing() {
// Dealer has 17 or better
if (game.dealerHand.handTotal >= 17) {
return true;
// Soft 17 to soft 21
} else if (game.dealerHand.aceInHand && game.dealerHand.handTotal >= 7 && game.dealerHand.handTotal <= 11) {
return true;
// All other hands, deal another card
} else {
r... | [
"isTakeoff() {\n return this.flightPhase === FLIGHT_PHASE.TAKEOFF;\n }",
"function C006_Isolation_Yuki_CheckToStop() {\n\n\t// Yuki doesn't allow the player to stop if she has the egg\n\tif (C006_Isolation_Yuki_EggInside) {\n\t\tOverridenIntroText = GetText(\"NoPullEgg\");\n\t\tC006_Isolation_Yuki_Curre... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
add job feeligns to survey | 'add_job_feelings'(surveyID, feelings)
{
EmployerSurvey.update(
{_id: surveyID},
{$set:
{
"job_satisfaction": feelings.job_satisfaction,
'performance': feelings.performance,
'career': feelings.career,
'leaving': feelings.leaving,
'values': fe... | [
"function add() {\n\t\t\tvm.enquiry.enquiries.push(\n\t\t\t\t{\n\t\t\t\t\titineries: '',\n\t\t\t\t\tplan: '',\n\t\t\t\t\tschool_contact_person: '',\n\t\t\t\t\tschool_class: '',\n\t\t\t\t\ttransport: [],\n\t\t\t\t\tfood: [],\n\t\t\t\t\tsharing: [],\n\t\t\t\t\tpackage_type: [],\n\t\t\t\t\taccomodation: [],\n\t\t\t\t\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Called when player choose the ship type | onPlayerSetShipType(player, shipType) {
player.setShipType(shipType);
} | [
"function onShipSelected(event)\n{\n\t// Save selected starship model to User Variables\n\tvar shipModelUV = new SFS2X.SFSUserVariable(UV_MODEL, event.getUserData().model);\n\tsfs.send( new SFS2X.SetUserVariablesRequest([shipModelUV]) );\n\n\t// Show solar system selection scene, passing the room list to display th... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Visit a parse tree produced by PlSqlParserindextype. | visitIndextype(ctx) {
return this.visitChildren(ctx);
} | [
"visitIndextype_name(ctx) {\n\t return this.visitChildren(ctx);\n\t}",
"visitIndex_expr(ctx) {\n\t return this.visitChildren(ctx);\n\t}",
"visitTable_index_clause(ctx) {\n\t return this.visitChildren(ctx);\n\t}",
"visitOid_index_clause(ctx) {\n\t return this.visitChildren(ctx);\n\t}",
"visitLocal_xmlind... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
return the last n episodes of a playlist | function list_episodes(playlist, n) {
return new Promise(function(resolve, reject) {
let read_buffer = '';
let cmd = spawn(yt_cmd,
['https://www.youtube.com/playlist?list=' + playlist,
'-J',
'--ignore-errors',
'--playlist-end=' + n]);
cmd.stdout.on('data', (data) => {
read_buffer = read... | [
"function getLastNItems(arr,num){\n \n return (num > 0) ? arr.slice(-num) : [];\n}",
"function getRecentSeason(episodes) {\n\t\tvar recentSeasonId = episodes.pop().season;\n\t\treturn episodes.filter(function (val) {\n\t\t\treturn val.season === recentSeasonId;\n\t\t});\n\t}",
"function lastNElements(array,... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
for map page function for check the program list in map page | function mapProgrameList() {
$('.page-nepad-on-the-continent .view-map-program-list li a').each(function(){
if($(this).text().length==0){
$(this).parent().hide();
}
});
$('#mapsvg svg path').click(function(){
$('.page-nepad-on-the-continent .view-map-program-list li a').each(function(){
if($(... | [
"function generatePageList ()\n{\n\tvar result = doAction ('DATA_GETHEADERS', 'GetRow', true, 'ObjectName', gSITE_ED_FILE);\n\tresult = result.split('\\t');\n\tvar out = new Array ();\n\tvar validPageObjArray = new Array();\n\tvar inValidPageObjArray = new Array();\n\tvar bCommerce = (IsCommerceEnabled() && IsComm... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Find website by Website Id | function findWebsiteById(websiteId){
var deferred = q.defer();
Website.findById(websiteId, function (error, response) {
if(error || response == null)
deferred.reject(error);
else
deferred.resolve(response);
});
return deferred.promi... | [
"getById(id) {\n return HubSite(this, `GetById?hubSiteId='${id}'`);\n }",
"function findPagesByWebsiteId(websiteId) {\n var sitePages = [];\n for(var p in pages) {\n var page = pages[p];\n if (page.websiteId === websiteId) {\n sitePa... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
=====| fAnimateHeightWidth Function |===== Animates element's height and width | function fAnimateHeightWidth (elem, eHeight, eWidth) {
tMx.to (elem, animTym, {css: {height: eHeight, width: eWidth}, ease: easePower});
} | [
"function matchWidth()\n {\n obj.height(Math.round( obj.outerHeight( ) * \n obj.parent().width()/obj.outerWidth( ) - \n (obj.outerHeight( ) - obj.height()) ));\n obj.width(Math.round( obj.parent().width() - \n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Directly creates a userTask for the given taskId. | 'userTasks.createUserTask'(taskId, fCompletionState) {
check(taskId, Mongo.ObjectID);
check(fCompletionState, Boolean);
const userId = Meteor.userId();
const task = Tasks.findOne(taskId);
if (!task) {
throw new Meteor.Error('invalid-parameter', "the given taskId does... | [
"function createNewTask(task) {\n storeTaskLocalStorage(task);\n appendToList(task);\n}",
"function createTask(task = {}) {\n\tif (task.promise) return task\n\ttask.promise = new Promise((resolve, reject) => {\n\t\ttask.resolvers = {resolve, reject};\n\t});\n\ttask.id = `${Date.now()}-${Math.floor(Math.rand... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Loads model from URN | async function loadFromURN(token, urn) {
var loadOptions = {
placementTransform: buildTransformMatrix()
}
var pathCollection = await API.getViewablePath(
token, urn);
var model = await API.loadModel(
pathCollection[0],
loadOptions);
return model;
} | [
"function getModel(uri) {\n return _standaloneServices_js__WEBPACK_IMPORTED_MODULE_5__[\"StaticServices\"].modelService.get().getModel(uri);\n}",
"load(req) {\n let self = this;\n // Default the model type to assembly\n req.type = req.modelType ? req.modelType : 'assembly';\n delete... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Handle click on "new Pug" button | function onNewPugClick() {
Global.pageHandler.doRedirectToPage( "new" );
} | [
"function setupCreateNewPathwayButton() {\n var newItem;\n $(\"div[name='createNewPathway']\").click(function(){\n if ( newItem == undefined )\n newItem = \n\t\tcreateDialog(\"div.createPathway\", \n\t\t\t\t{position:[250,150], width: 700, height: 350, \n\t\t\t\ttitle: \"Create a New Pathway... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Clicks the finish button | finish() {
this.finishBtn.click();
} | [
"function cpsh_onFinish(evt) {\n evt.preventDefault();\n finishConfirmDialog.hidden = true;\n WapPushManager.close();\n }",
"function finishAsking(q) {\n // collect given answers and make request\n q.html.trigger('question.finish', q);\n var answers = {'_wizard': 1}, q2 = q, i = 0,\n html = $('<... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Jump(scroll) to an element by name | function jumpToElementByName(name) {
var theElement = jq("[name='" + escapeName(name) + "']");
if (theElement.length != 0) {
if (!usePortalForContext() || jQuery("#fancybox-frame", parent.document).length) {
jQuery.scrollTo(theElement, 1);
}
else {
var headerOffse... | [
"function moveToPageElemnt(element) {\n $('body, html').animate({ scrollTop: $(element).offset().top }, 600);\n}",
"function goToByScroll(dataslide, mstime) {\n $('html,body').animate({\n scrollTop: $('.slide[data-slide=\"' + dataslide + '\"]').offset().top\n }, mstime);\n setActivePage(dataslide... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Load ComponentEnd type resource into model. | function loadComponentEnd(model, resource, jsonld) {
var component = getComponent(model, jsonld.getReference(resource,
'http://linkedpipes.com/ontology/component'));
component.end = jsonld.getString(resource,
'http://linkedpipes.com/ontology/events/created');
} | [
"function loadComponentBegin(model, resource, jsonld) {\n var component = getComponent(model, jsonld.getReference(resource,\n 'http://linkedpipes.com/ontology/component'));\n component.start = jsonld.getString(resource,\n 'http://linkedpipes.com/ontology/events/created');... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
variation of the above middleware but for individual cells and validation that req body must be an object mapping "formula" with the formula to replace/update | function validateFormulaBody(req, res, next){
const bodyContent = req.body;
const badReqError = "request body must be a { formula } object";
if(typeof bodyContent !== 'object' || !bodyContent){
return sendBadReqError(res, badReqError);
}
if(Object.keys(bodyContent).length !== 1 || !bodyConten... | [
"function doUpdateOrReplaceCell(app, replace = false){\n const statusCode = replace? CREATED : NO_CONTENT;\n return async function(req, res, next){\n try{\n const {spreadSheetName, cellId} = req.params;\n const {formula} = req.body;\n \n if(replace){\n await app.locals.ssStore.delete... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Calls the create call to initialize the bubblepopup plugin to take into account any content that may have bubblepopups | function initBubblePopups() {
//CreateBubblePopup was modified to be additive on call, and now uses one handler per event type- kuali customization
jQuery(document).CreateBubblePopup("input:not([type='hidden']):not([type='image']), input[data-role='help'], "
+ "select, textarea, .uif-tooltip", { m... | [
"function createElementsForPopup() {\r\n _dom.el.css(\"position\", \"absolute\");\r\n _dom.el.addClass(\"s-c-p-popup\");\r\n _dom.arrow = $(\"<div></div>\")\r\n .appendTo(_dom.el)\r\n .addClass(\"s-c-p-arrow\");\r\n _dom.arrowInner = $(\"<div... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
MASK FUNCTIONS END ///////////////////////////////////// openChildWindow() ================ Function to open child screen Parameters Return value void | function openChildWindow(){
setErrorFlag();
var lstrWidth = '750px';//set default width
var lstrHeight = '450px';//set default height
var lstrURL;
var lstrArgument;
lstrURL = openChildWindow.arguments[0];
if( lstrURL.indexOf("?") == -1 ) {
lstrURL = lstrURL + "?childFw=Y" ;
} e... | [
"function openDisplayWindow() {\r\n var windowObjectReference;\r\n var strWindowFeatures = \"menubar=no,location=no,resizable=no, scrollbars=no, status=yes, width= 1920, height= 1080\";\r\n\r\n //Set Volume and play audio\r\n //This pauses the music in the login screen\r\n\r\n mySound.pause();\r\n\r\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Map item selection to a `selected` CSS class. | [symbols.itemSelected](item, selected) {
if (super[symbols.itemSelected]) { super[symbols.itemSelected](item, selected); }
item.classList.toggle('selected', selected);
} | [
"function itemClass(item) {\n if (vm.mark) {\n if (vm.selected[vm.valuePropertyName] === item[vm.valuePropertyName]) {\n return decideClass(vm.valuePropertyName);\n }\n }\n\n return \"\";\n\n function decideClass(valuePrope... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
function to copy table html code to clipboard | function getTableCode() {
let string = document.getElementsByTagName('table')[0].innerHTML;
navigator.clipboard.writeText(string);
} | [
"function copyToClipboard() {\n const el = document.createElement('textarea');\n el.value = event.target.getAttribute('copy-data');\n el.setAttribute('readonly', '');\n el.style.position = 'absolute';\n el.style.left = '-9999px';\n document.body.appendChild(el);\n el.select();\n document.execCommand('copy')... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
hasDecorators checks a file's metadata for the presence of decorators without evaluating the metadata. | hasDecorators(filePath) {
const metadata = this.getModuleMetadata(filePath);
if (metadata['metadata']) {
return Object.keys(metadata['metadata']).some((metadataKey) => {
const entry = metadata['metadata'][metadataKey];
return entry && entry.__symbolic === 'cla... | [
"function hasProperties(json, properties) {\n return properties.every(property => {\n return json.hasOwnProperty(property);\n });\n}",
"function addCustomDecorators() {\n /**\n * @type {Set<import('@storybook/react').DecoratorFn>}\n */\n const customDecorators = new Set();\n\n if (['react-card... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Perform the final placement of the data labels after we have verified that they fall within the plot area. | function placeDataLabels() {
this.points.forEach(function (point) {
var dataLabel = point.dataLabel, _pos;
if (dataLabel && point.visible) {
_pos = dataLabel._pos;
if (_pos) {
// Shorten data labels with ellipsis if they still overflow
... | [
"function setLabelPosition() {\r\n if (document.getElementById(\"rb1\").checked) {\r\n chart.labelRadius = 30;\r\n chart.labelText = \"[[title]]: [[value]]\";\r\n } else {\r\n chart.labelRadius = -30;\r\n chart... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Loads a gallery node model | async function loadGalleryNode(node) {
// load model from local resource if available
if(node.model.viewablePath &&
node.model.viewablePath.length) {
var loadOptions = {
placementTransform: buildTransformMatrix()
}
var model = await API.loadModel(
node.... | [
"function loadGalleries() {\n //console.log('loading galleries');\n $('#gallerySpinner').show();\n loadGalleryType('type', 0)\n loadGalleryType('specimen', 0)\n loadGalleryType('other', 0)\n loadGalleryType('uncertain',0)\n}",
"function loadThumbnails()\r\n\t{\r\n\t\tvar gallery_id = $(\"#galler... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
The bottom of the scroll. | get _scrollBottom() {
return this._scrollPosition + this._viewportHeight;
} | [
"get bottom() {\n return this.pos.y + this.size.y / 2; // ball reflects\n }",
"function getPosBottom(id) {\r\n return ++id < scrollPositions.length ?\r\n scrollPositions[id] : $(document).height();\r\n }",
"function scrollToBottom () {\n endRef.current.scrollIntoView({ block: 'end', be... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
position the image depending on the zoom factor and the pan X/Y position | function ViewerImagePanSetPosition(posX, posY, img, savePosition ) {
if( savePosition ) {
G.VOM.panPosX=posX;
G.VOM.panPosY=posY;
}
posX+=G.VOM.zoom.posX;
posY+=G.VOM.zoom.posY;
img.style[G.CSStransformName]= 'translate3D('+ posX+'px, '+ posY+'px, 0) ';
... | [
"function zoom(newscale, center) { // zoom around center\n\t\tif (newscale.toFixed > 2 && newscale.toFixed(2) < 0.25){\n\t\t\treturn;\n\t\t}\n\t\tvar caX = window['variable' + dynamicVar[pageCanvas]].getWidth()/2;\n\t\tvar caY = window['variable' + dynamicVar[pageCanvas]].getHeight()/2;\n\t\tzoomOrigin = window['va... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Funkcija koja puni oderedjeni select element Argumenti: oMenu: objekt kojega punimo asStavke: niz iz kojega se puni iStavka: iz kojeg podniza se puni | function puniSelect(oMenu, asStavke, iStavka) {
var iSeparator, iBrojac, sStavkaTekst, sStavkaVrijednost;
// Postavimo duljinu niza na 0
oMenu.options.length = 0;
for (iBrojac = 0; iBrojac < asStavke[iStavka].length; iBrojac++) {
// Provjerimo gdje je separator
iSeparator = asSta... | [
"function oppdaterSelect(tx, res, selId) {\r\n var rec, i;\r\n /*\r\n * Løp gjennom resultatene og legg til elementer til dropdown\r\n */\r\n for ( i = 0; i < res.rows.length; i++) {\r\n rec = res.rows.item(i);\r\n $(selId).append($(\"<option />\").val(rec.id).text(rec.navn));\r\n };\r\n /... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Set the description of the Option | setDescription(description) {
this.description = description;
} | [
"set description(aValue) {\n this._logger.debug(\"description[set]\");\n this._description = aValue;\n }",
"updateDescription(newDesc) {\n this.description = newDesc;\n }",
"function setMetaDescription(description) {\r\n\t\t\tif (typeof description === 'string') {\r\n\t\t\t\tmetaDescription = d... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
a macro function mute all sound instances by iterating through lookup table | function muteAllSounds() {
var that = this;
for (var s in soundsLookup) {
if (soundsLookup.hasOwnProperty(s)) {
that.mute(s);
}
}
} | [
"function unmuteAllSounds() {\n var that = this;\n for (var s in soundsLookup) {\n if (soundsLookup.hasOwnProperty(s)) {\n that.unmute(s);\n }\n }\n }",
"function fadeMuteAllSounds(duration, animation, easing) {\n var that = this;\n for (var s in soundsLookup) {\n if (soundsL... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
The empty filter do nothing, just to keep the koa chain connected. | async function emptyFilter(ctx, next) {
await next();
} | [
"function ktdNoEmit() {\n return (source$) => {\n return source$.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_1__[\"filter\"])(() => false));\n };\n}",
"clearAllFilters() {\n this.currentFilters = []\n\n each(this.filters, filter => {\n filter.value = ''\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
+ input and qty append to wrap | function createProdQtyWrap(){
const prodQtyWrap = document.createElement("span");
prodQtyWrap.setAttribute("class", "col-sm-10 col-md-4");
const qtyLabel = document.createElement("span");
qtyLabel.innerHTML = "QTY";
const inputField = createQtyInput();
prodQtyWrap.appendChild... | [
"function createQtyInput(){\n const qtyInput = document.createElement(\"input\");\n qtyInput.setAttribute(\"class\", \"prod-qty\")\n qtyInput.setAttribute(\"placeholder\", \"0\");\n qtyInput.setAttribute(\"type\", \"number\");\n return qtyInput;\n }",
"function enterqty(){\n var qtyte... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
muestra la modal para Crear una Orden | function modalOrden() {
$("#agregarOrden").modal();
} | [
"function openModalNewResponsableMedicion() {\n\tabrirCerrarModal(\"modalAsignaPersonas\");\n\tsetFirstInput();\n}",
"buildModal() {\n if(this.style === 'card') {\n this.createCardStructure();\n } else {\n if(!this.content.innerHTML) {\n this.content.innerHTML = ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function to import graph | function importGraph() {
// Clear current graph
clearGraph();
var file = $("#import-data")[0].files[0];
// Use FileReader to read contents of file (https://developer.mozilla.org/en-US/docs/Web/API/FileReader)
var reader = new FileReader();
reader.onload = (function () {
return function (e... | [
"function load_graph_to_map(results){\n load_markers(results.locations);\n //draw_lines(results);\n draw_spanning_tree(results);\n\n}",
"static deserialize(json) {\n let config = json['config'] || {};\n\n let graph = new Graph(config);\n\n json['nodes'].forEach(n => {\n graph.addNode(n.id);... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
SHAPE CONTROL / Updates the GUI list, displaying shapes in model | function updateShapeList(){
var list = document.getElementById("shapeList");
list.innerHTML = "";
var i =0;
for(i=0;i<sciMonk.currentModel.shapes.length;i++){ /* <--- construction*/
var item = document.createElement("div");
item.setAttribute("onClick","inflateEditShapeV... | [
"function refactorShape(id){\r\n\tsciMonk.viewStack.pop();\r\n\tsciMonk.placementType = \"shape\";\r\n\tsciMonk.currentShape.shape = sciMonk.currentModel.shapes[id].shape;\r\n\tsciMonk.currentShape.scaledShape = sciMonk.currentModel.shapes[id].shape;\r\n\tsciMonk.currentShape.originalShape = sciMonk.currentModel.sh... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Texture Transform Extension Specification: | function GLTFTextureTransformExtension() {
this.name = EXTENSIONS.KHR_TEXTURE_TRANSFORM;
} | [
"function applyTextureTransform(mapDef, texture) {\n var didTransform = false;\n var transformDef = {};\n\n if (texture.offset.x !== 0 || texture.offset.y !== 0) {\n transformDef.offset = texture.offset.toArray();\n didTransform = true;\n }\n\n if (texture.rotation !== 0) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
function to create book list item | function createBookListItem(book) {
var $li = $("<li>");
$li.addClass("list-group-item hover-invert cursor-pointer list-bg-color list-item-font");
$li.html(book.id + ") " + book.title + " by " + book.author);
$li.data("bookId", book.id);
return $li;
} | [
"function createItem() {\n\t\tvar clInput = document.querySelector('#cl-item'),\n\t\t\tchecklistText = clInput.value,\n\t\t\tli = generateListitem(checklistText);\n\n\t\toptions.appendChild(li);\n\n\t\tchecklist.push(checklistText);\n\t\tupdateChecklist();\n\n\t\t//reset checklist input value to empty\n\t\tclInput.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
[MSOSHARED] 2.3.3.1.11 VtString / [MSOSHARED] 2.3.3.1.12 VtUnalignedString | function parse_VtStringBase(blob, stringType, pad) {
if(stringType === 0x1F /*VT_LPWSTR*/) return parse_lpwstr(blob);
return parse_lpstr(blob, stringType, pad);
} | [
"static string(v) { return new Typed(_gaurd, \"string\", v); }",
"function substrWithAttrCodes(pStr, pStartIdx, pLen)\n{\n\tif (typeof(pStr) != \"string\")\n\t\treturn \"\";\n\tif (typeof(pStartIdx) != \"number\")\n\t\treturn \"\";\n\tif (typeof(pLen) != \"number\")\n\t\treturn \"\";\n\tif ((pStartIdx <= 0) && (p... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Draws the Info screen. | function drawInfo(){
image(blueprint, 0, 0, imgSize, imgSize*5/9);
fill('#fff8');
rect(0, height-200, width, 200);
fill(0);
textStyle(ITALIC);
textSize(22);
var infoText = ["Use WASD directions to navigate the rooms of the house.", "Hit 'X' to return to the splash screen.", "Hit 'I' to ... | [
"function displayInfoElement()\n{\n\t//info element\n\tvar IEsquare = new createjs.Shape();\n\tIEsquare.graphics.beginStroke(\"Black\").drawRect(0, 0, 350, 46);\n\tIEsquare.x = 325;\n\tIEsquare.y = 0;\n\tIEsquare.name = \"IEsquare\";\n\tstage.addChild(IEsquare);\n\tupdateInfoText();\n}",
"showInfo() {\n let sp... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
== Helpers == Check if a directionality value is a Strong one | function isStrong(dir) {
return dir === LTR || dir === RTL;
} | [
"function assertStudentDirection(direction) {\n if (![\"incoming\", \"outgoing\"].includes(direction)) {\n throw(\"Invalid student direction \\\"\" + direction + \"\\\".\");\n }\n}",
"isDirection(direction) {\n let sorting = this.context.listStore.getSorting();\n return sorting.fieldId ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sort the lectures according to date | function sortLectures(arr) {
return arr.sort((a,b) => DateTime.fromFormat(a.date, 'yyyy-MM-dd hh:mm') - DateTime.fromFormat(b.date, 'yyyy-MM-dd hh:mm'));
} | [
"function sortNotes(){\n notesList.sort(function(a,b)\n {\n if(a.date < b.date)\n return 1;\n if(a.date > b.date)\n return -1;\n if(a.date == b.date)\n {\n if(a.id < b.id)\n return 1;\n if(a.id > b.id)\n retu... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
click mouse to draw blue blocks | function mouseClicked() {
var size = random(10, 40);
drawMondrianblue(mouseX, mouseY, size);
} | [
"function blueSquare() {\n if(mouseX >= 425 && mouseX <= 775 && mouseY >= 425 && mouseY <= 775 && mouseIsPressed) {\n fill(128, 179, 255);\n } else {\n fill(0, 100, 205);\n }\n rect(width/2 + displacement, height/2 + displacement, 350, 350);\n}",
"function mouseclicks()\n{\n //mouse makes yellow dot\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates a `CssSelector` given a tag name and a map of attributes | function createCssSelector(tag, attributes) {
const cssSelector = new CssSelector();
cssSelector.setElement(tag);
Object.getOwnPropertyNames(attributes).forEach((name) => {
const value = attributes[name];
cssSelector.addAttribute(name, value);
if (name.toLowerCase() === 'class') {
... | [
"function parseSimpleCssSelector(selector) {\n\t\tconst errorMessage = `Unexpected syntax '${selector}'`\n\t\tconst tagMatch = /^\\s*([a-z-]*)(.*)$/i.exec(selector)\n\t\tconst tag = tagMatch[1] || undefined\n\t\tconst attributes = {}\n\t\tconst partsRegex = /([.:#][\\w-]+|\\[.+?\\])/gi\n\t\tconst addAttribute = (na... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This method creates the configuration context that is to be sent to the RPC. Most of the context is the same for every RPC call and can be obtained from the configuration. But some items are specific to the RPC call. This adds in the items that are specific to the RPC call. | function _createRpcConfigVprContext(config, vistaId) {
var siteConfig = config.vistaSites[vistaId];
var rpcConfig = _.clone(siteConfig);
rpcConfig.context = 'HMP SYNCHRONIZATION CONTEXT';
return (rpcConfig);
} | [
"function _createNewRequest(parentContext) {\n var parentResponse = parentContext.response;\n \n var context = parentContext[SERVER.Factory].createContext();\n var response = context.response;\n\n parentContext[SERVER.Factory].mergeCapabilities(context, parentContext);\n\n context[SERVER.SessionId] = parentC... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
The client name that was specified via the `userPoolClientName` property during initialization, throws an error otherwise. | get userPoolClientName() {
if (this._userPoolClientName === undefined) {
throw new Error('userPoolClientName is available only if specified on the UserPoolClient during initialization');
}
return this._userPoolClientName;
} | [
"function UserPoolClient(props) {\n return __assign({ Type: 'AWS::Cognito::UserPoolClient' }, props);\n }",
"function getUsername(clientId) {\n return userList[clientId].username;\n }",
"static fromUserPoolClientId(scope, id, userPoolClientId) {\n class Import extends core_1.Resourc... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Set new goal function Input: User ID, Goal ID Output: Returns user ID that added a new goal | async function setNewGoal(userID, goalID) {
// Error check
let cleanUser = checkStr(userID);
let cleanGoal = checkStr(goalID);
let userObj, goalObj;
try {
goalObj = ObjectId(cleanGoal);
userObj = ObjectId(cleanUser);
} catch (e) {
throw e;
}
const userCollection = await Users;
const goalCo... | [
"async function setGoals({calGoal, minGoal}, username){\n\n await User.updateOne({\"_id\":username}, {$set: {\"caloriegoal\":calGoal, \"minutegoal\":minGoal}});\n return await User.findOne({\"_id\": username});\n\n}",
"function SetFunnelGoal( idSite ){\n piwik.api({\n method: \"Goals.addGoal\",\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Implementation of atob() according to the HTML and Infra specs, except that instead of throwing INVALID_CHARACTER_ERR we return null. | function atob(data) {
// Web IDL requires DOMStrings to just be converted using ECMAScript
// ToString, which in our case amounts to using a template literal.
data = `${data}`;
// "Remove all ASCII whitespace from data."
data = data.replace(/[ \t\n\f\r]/g, "");
// "If data's length divides by 4 leaving no r... | [
"function getHTMLFromResponseBody(buffer, contentType) {\n var _contentType$split = contentType.split(/;\\s*/);\n\n var _contentType$split2 = _toArray(_contentType$split);\n\n var mimeType = _contentType$split2[0];\n\n var typeOptions = _contentType$split2.slice(1);\n\n // Pick charset from content type\n if ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
find module by exports | function getModuleByExports(exportModule, req = require) {
let ks = Object.keys(req.cache);
let i = ks.length;
while (--i) {
let key = ks[i];
let mod = req.cache[key];
if (mod.exports === exportModule) {
return mod;
}
}
return null;
} | [
"function moduleExportsCircularRequireTest() {\n Duktape.modSearch = function (id, require, exports, module) {\n print('modSearch:', id);\n\n if (id === 'test1/foo') {\n // The module.exports assignment is immediately visible to test1/bar.\n return 'module.exports = function a... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
var myAccount; var totalBill = 0; var appleNumber = 0; var orangeNumber = 0; var bananaNumber = 0; | function makeBill() {
let appleNumber = parseInt(document.querySelector('#apple').value) * 10;
let orangeNumber = parseInt(document.querySelector('#orange').value) * 15;
let bananaNumber = parseInt(document.querySelector('#banana').value) * 7;
let totalBill = parseInt(document.querySelector("#bill")... | [
"function countTotalBill() {\n\t\t\tinstantObj.orderDetailsObj.orderValue = instantObj.noOfTshirtMWI*13 + instantObj.noOfShirtMWI*13 + instantObj.noOfJeansMWI*16 \n\t\t\t\t\t+ instantObj.noOfTrouserMWI*13 + instantObj.noOfLungiDhotiMWI*16 + instantObj.noOfSuitsBlazerMWI*31\n\t\t\t\t\t+ instantObj.noOfKurtaMWI*19 + ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return a selection that does not partially select any atomic ranges. | function skipAtomicInSelection(doc, sel, bias, mayClear) {
var out;
for (var i = 0; i < sel.ranges.length; i++) {
var range = sel.ranges[i];
var newAnchor = skipAtomic(doc, range.anchor, bias, mayClear);
var newHead = skipAtomic(doc, range.head, bias, mayClear);
if (out || newAnchor != r... | [
"createRangeBySelectedCells() {\n const sq = this.wwe.getEditor();\n const range = sq.getSelection().cloneRange();\n const selectedCells = this.getSelectedCells();\n const [firstSelectedCell] = selectedCells;\n const lastSelectedCell = selectedCells[selectedCells.length - 1];\n\n if (selectedCells... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Generate a table for an array of options | function generateOptionTable(options) {
let text = dedent`\n
| Name | Type | Description |
| ---- | ---- | ----------- |
`;
Object.entries(options).forEach(([option, value]) => {
if (option.includes('-')) {
return;
}
text += `\n| ${option} | ${makeType(value)} | ${value.description} |`... | [
"tabulate(\n headers,\n rows,\n options) {\n if (!_.isArray(headers))\n TypeException(\"headers\", \"array\")\n if (!rows)\n TypeException(\"rows\", \"array\")\n if (_.any(rows, x => { return !_.isArray(x); }))\n TypeException(\"rows child\", \"array\")\n var o = _.extend({}, Kin... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
A test for the Tropo Hangup object. | function hangupTest(expected) {
var tropo = new TropoWebAPI();
tropo.hangup();
return runTest(TropoJSON(tropo), expected);
} | [
"setBakingTime() {}",
"function buzz(){\n connectFactory.buzzBuzzTrial(buzzerRound);\n $rootScope.$emit(rootScopeEvents.buzzTriggered);\n }",
"function setupTimer(end) {\n\tvar interval = setInterval(function() {\n\t\tvar now = moment.utc();\n\t\tif (now > end) {\n\t\t\t// time's up... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Set the window height to another element | function setWindowHeight(element){
$(element).height( getWindowHeight() );
} | [
"setHeight() {\n this.$().outerHeight(this.$(window).height() - this.get('fixedHeight'));\n }",
"function setHeight(elem1, elem2) {\n\tvar height = elem2.height()\n\telem1.css('height', height); \n}",
"set requestedHeight(value) {}",
"function height2(){\n var h = $( window ).outerHeight(true); // ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Display the output of the Right content block. | function displayRightContentOutput() {
return (
<div
key="content-block"
className="content-block-content content-block-right"
style={ { textAlign: props.attributes.alignmentRight } }
>
{ props.attributes.contentRight }
</div>
);
} | [
"function displayRightContentOutput() {\n\t\t\treturn (\n\t\t\t\t<div\n\t\t\t\t\tkey=\"content-block\"\n\t\t\t\t\tclassName=\"content-block-content content-block-right\"\n\t\t\t\t\tstyle={ { textAlign: props.attributes.alignmentRight } }\n\t\t\t\t>\n\t\t\t\t\t{ props.attributes.contentRight }\n\t\t\t\t</div>\n\t\t\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
CONCATENATED MODULE: ./node_modules/underscore/modules/result.js Traverses the children of `obj` along `path`. If a child is a function, it is invoked with its parent as context. Returns the value of the final child, or `fallback` if any child is undefined. | function result_result(obj, path, fallback) {
path = _toPath_toPath(path);
var length = path.length;
if (!length) {
return modules_isFunction(fallback) ? fallback.call(obj) : fallback;
}
for (var i = 0; i < length; i++) {
var prop = obj == null ? void 0 : obj[path[i]];
if (prop === void 0) {
... | [
"function walkJSON (obj, func, options = {}) {\n const traverse = (obj, curDepth, path, key) => {\n if (curDepth && key && !options.finalPathsOnly) func.apply(this, [key, curDepth, path])\n if (!obj) {\n if (options.finalPathsOnly) func.apply(this, [key, curDepth, path])\n return // Bail on falsey ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sets up all shadows. | setupShadows() {
//setup shadows
this.shadowGenerator1 = new BABYLON.ShadowGenerator(2048, this.light1);
this.shadowGenerator1.useExponentialShadowMap = true;
this.shadowGenerator1.usePoissonSampling = true;
} | [
"initShadows($MIRROR, $SHADOWS_PANEL, _SOC_DATA) {\n const $mirror_content = $($MIRROR.contents());\n console.debug(\n \"Mirror is loaded: width[%s], height[%s]\",\n $mirror_content.width(),\n $mirror_content.height()\n );\n\n // Set width and height for ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Update the UI whenever `ctrl.focusIndex` is updated | function handleFocusIndexChange (newIndex, oldIndex) {
if (newIndex === oldIndex) return;
if (!getElements().tabs[ newIndex ]) return;
adjustOffset();
redirectFocus();
} | [
"focusControl() {\n if (!this.showFocus || !this.focusActive) return;\n [].forEach.call(this.focusList, (item, index) => {\n item[`on${this.focusEvent}`] = () => {\n //Prevent repeated slide switch\n if (this.defaultIndex === index) return;\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
method that hides two cards | function hide(card1, card2){
//hide the cards
card1.removeClass("open show");
card2.removeClass("open show");
//reset opened cards list
openedCards = [];
} | [
"function hideCards() {\n\tcards.forEach(card => {\n\t\tcard.classList.add(\"hidden\");\n\t})\n}",
"function hideCard(card) {\n // get a list of all cards\n\n let cardArray = ['lbValue','kgValue','ozValue','gmValue'];\n\n \tfor(var i= 0;i < cardArray.length; i++) {\n \t\tif(cardArray[i] == card) {\n \t\t\tlet ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
handleReceivedPopupData: set the local data equal to received data so it can be passed around in the module show the component | function handleReceivedPopupData(data) {
console.log('handleVisitedPopupShown');
// reset local data on popup activated
currentUser = {};
currentRestaurant = {};
// set local data equal to received data from showing popup via click
currentUser = data.user;
currentRestaurant = data.rest... | [
"function handleDataResponseMsg(aMsg) {\n\n // Show the data.\n divDataItem0.innerHTML = aMsg.Item0;\n divDataItem1.innerHTML = aMsg.Item1;\n divDataItem2.innerHTML = aMsg.Item2;\n divDataItem3.innerHTML = aMsg.Item3;\n}",
"function receiveWindowMessage(evt) {\n if (evt) {\n // For now we h... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
================================================================================ Get Device Uplink ================================================================================ | async function deviceUplink() {
const input = await getSerial();
const temp = [];
for (const x of input) {
const result = await meraki.DevicesController.getNetworkDeviceUplink(x)
const data = await result
temp.push(data)
}
// return temp.length
return temp
} | [
"function Network_deviceOverview(obj) {\n var item = UCapCore.findDevice({uid:obj.uid, did:obj.did});\n item = UCapCore.devices[obj.uid][item];\n var picture = (!item[3]) ? \"default\" : item[3];\n $('#profileCol .profilePic').attr('src', 'images/avatars/' + picture + '.jpg');\n $('#user-uid').val(ob... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Multiplexing emitter. These emitters reuse the same streams (both readable and writable) for all messages. This avoids a lot of overhead (e.g. creating new connections, reissuing handshakes) but requires the underlying transport to support forwarding message IDs. | function StatefulEmitter(ptcl, readable, writable, opts) {
MessageEmitter.call(this, ptcl, opts);
this._readable = readable;
this._writable = writable;
this._connected = !!(opts && opts.noPing);
this._readable.on('end', onEnd);
this._writable.on('finish', onFinish);
this.once('eot', function () {
deb... | [
"function configureEmitter(emitter){\n emitMessage = emitter;\n}",
"function pipeMessage(client, inputName, msg) {\n client.complete(msg, printResultFor(\"Receiving message\"))\n\n if (inputName === \"input1\") {\n const message = msg.getBytes().toString(\"utf8\")\n if (message) {\n const outputMs... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Constructs object for loading assets | constructor() {
if (!AssetLoader.instance) {
AssetLoader.instance = this;
this.loadedImages = [];
this.preloadImages();
}
return AssetLoader.instance;
} | [
"function loadAssets() {\n\t//setup a global, ordered list of asset files to load\n\trequiredFiles = [\n\t\t\"src\\\\util.js\",\"src\\\\setupKeyListeners.js\", //misc functions\n\t\t\"src\\\\classes\\\\Enum.js\", \"src\\\\classes\\\\Shape.js\", \"src\\\\classes\\\\MouseFollower.js\" //classes\n\t\t];\n\t\n\t//manua... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sets up triggers for the experiment including event listeners | setupTriggers() {
this.triggers.forEach((trigger) => {
trigger.on('TRIGGERED', () => this.enrollIfTriggered());
trigger.setup();
});
} | [
"function trigger() {\n $el.data(\"pat-inject-autoloaded\", true);\n inject.onTrigger.apply($el[0], []);\n return true;\n }",
"initHostInteractions(){\n\n }",
"setEventListeners() {\n this.on('edit',this.onEdit.bind(this));\n this.on('pane... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Same example as loopAndPrint, except using an IFFE to wrap the setTimeout in order to ensure the anonymous function passed into setTimeout has the correct index. Note: 'i' is passed into the IFFE and the parameter is 'index', to show that the parameter name can be changed within the function signature. | function loopAndPrintWithIFFE() {
var i;
var count = 4;
for (i = 0; i < count; i++) {
(function(index) {
setTimeout(function() {
console.log('loopAndPrintWithIFFE - setTimeout %o', index);
}, 1000);
}(i));
}
} | [
"function loop() {\n for (var i = 0; i < 5; i++) {\n setTimeout(() => {\n console.log(i);\n }, i * 1000);\n }\n}",
"function counter2() {\n for (let i = 0; i < 5; i++) {\n setTimeout(() => {\n console.log(i);\n }, i * 1000);\n }\n}",
"function runForLoop(text, delay) {\n // code goes ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
change the dynamic status of currect object status can only be changed when the selected object is not a spline control object, nor an autobbox | function toggleDynamic()
{
if (INTERSECTED && readOnly != 1) {
if (INTERSECTED.name.dynamic == 1 && INTERSECTED.name.dynamicIdx==-2) {
alert('Cannot change dynamic status of automatically generated bounding boxes');
return;
}
if (INTERSECTED.name.dynamic == 1 && splineCurves[INTERSECTED.name.dynamicSeq]!=u... | [
"function changeVisibilitybyTime(time){\n\t// if current selected object is on the spline \n\tif (INTERSECTED) {\n\t\t// detach object if the spline has autoboxes for clear view \n\t\tif (INTERSECTED.name.dynamic == 1 && splineIsAutoBoxed[INTERSECTED.name.dynamicSeq]==1){ \n\t\t\tlabels[currentIdx].name.level_min =... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Description Increase data.ready_dependency by one If data.ready_dependency is equal number of dependency service then push it to ready_types | async _update_ready_dependency(type, ready_types) {
let neighbours = this._service_graph.neighbours(type)
for (let neighbour of neighbours) {
let v = this._service_graph.vertex(neighbour)
v.data.ready_dependency += 1
if (v.data.ready_dependency === neighbour.dependen... | [
"async _index_service_graph(instances, ready_types) {\n for (let type of this._types) {\n let v = this._service_graph.vertex(type)\n\n v.data = {\n ready_dependency: 0\n }\n for (let dependency of type.dependency) {\n if (instances.has... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Thrown when the grammar contains an error. | function GrammarError(message) {
this.name = "GrammarError";
this.message = message;
} | [
"error() {\n throw new Error('Invalid syntax');\n }",
"function _noSearchTermError() {\n\tthrow new Error('A search term is required, for example \"javascript\"');\n}",
"error(errorCode) {\n throw new Error(errors[errorCode] || errorCode);\n }",
"function onXMLLintComplete (error, stdout, stderr... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
[Function name]f_CloseWebsocket [Description]function to close a websocket connexion [inputs]fWS : websocket object concerned for closing [jQuery]No | function f_CloseWebsocket(fWS)
{
// Check fWS object is defined and exists
if (fWS != "undefined")
{
fWS.close();
f_RADOME_log('Websocket "'+ fWS.name+ '" has been closed')
}
} | [
"function wsCloseConnection(){\n\twebSocket.close();\n}",
"function stop_ws() {\n if (CLIENT) {\n userDisconnectFlag = true;\n CLIENT.disconnect();\n }\n}",
"function endWebSocketConnection(ws, code, message) {\n try {\n console.log('Terminating socket');\n ws.end(code, message);\n }... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Display an alert containing the inputted address if user presses enter | function searchAddress(keyPress) {
if (keyPress.keyCode === ENTER_KEY) {
var address = document.getElementById('address-input').value;
//Set the input address to use in the main page
localStorage.setItem('inputAddress', address);
window.location.assign("main.html");
}
return false;
} | [
"function confirmAdress() {\n var address = document.getElementById(\"address\").value\n var addressc = document.getElementById(\"addressC\").value\n\n if (address != addressc) { //if address and addressc values are not the same, alert\n alert(\"The addess entered does not match\");\n return... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
ATI: This functioni should be called when our paddle is touched. When that happens we assume the role of master and set a timer to ignore incoming SYNC messages that have the master flag set. See the header notes. | function localPaddleTouched()
{
// Our paddle was touched. We are now master so update that flag.
g_i_am_master_flag = true;
// Publish a SYNC message now.
publishSyncMessage();
// Set the flag that tells us to ignore the master flag on incoming SYNC messages
// for a short while (See the he... | [
"wait() {\n on (EPass ePass) : \n\t\t{\n\t\t\tif( m_eTeleportType == TELEPORT_DEFAULT )\n\t\t\t{\n\t\t\t\tif (m_penTarget!=NULL && m_bActive) \n\t\t\t\t{\n\t\t\t\t\tif (m_bPlayersOnly && !IsOfClass( ePass.penOther, &CPlayer_DLLClass)) {\n\t\t\t\t\t\tresume;\n\t\t\t\t\t}\n\t\t\t\t\tTeleportEntity(ePass.penOth... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
build the sibling nodes of specific node | _buildSiblingNode(nodeChart, nodeData, callback) {
let that = this,
newSiblingCount = nodeData.siblings ? nodeData.siblings.length : nodeData.children.length,
existingSibligCount = nodeChart.parentNode.nodeName === 'TD' ? this._closest(nodeChart, (el) => {
return el.nodeName === 'TR';
}).c... | [
"function create_right_sibling(node)\n{\n if (node === null) \n {\n return;\n }\n \n var numberOfChildren = node.children.length;\n \n var queue = [];\n for (var i=0; i < numberOfChildren ; i++)\n {\n if (node.children[i].right === null && node.children[i+1])\n {\n node.children[i].right = n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
RadarChart(".s30", r_he_calls.dataset[0], radarChartOptions, overall_he[0], "he/she", words_he[0]) | function drawRadar(data, overall, pronouns, theword, extras) {
for (i = 0; i < data.length; i++) {
var p = ".s3-" + i;
RadarChart(p, data[i].dataset[0], data[i], radarChartOptions, overall[i], pronouns, theword[i], extras[i]);
}
} | [
"function drawRadarChart(canvas, container, data) {\n let tooltipTemplate = \"<%if(label)\\u007B%><%=label%>: <%}%><%=value%>%\";\n let ctx = canvas[0].getContext(\"2d\"),\n opts = {populateSparseData:true, tooltipTemplate: tooltipTemplate},\n chart = new Chart(ctx).Radar(data, opts);\n ch... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Retrieves the raw pixel coordinates of a mouse click | function getRawCoords(e){
var mousePos = canvas.getBoundingClientRect();
var coords = {
x : e.clientX - mousePos.left,
y : e.clientY - mousePos.top
}
return coords;
} | [
"function canvas_mouse_coords(event, element) {\n var rcoords = relative_mouse_coords(event, element);\n // Assume that the CSS object-fit property is \"fill\" (the default).\n var xscale = element.width / element.offsetWidth;\n var yscale = element.height / element.offsetHeight;\n return {x: rcoords... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Start 2 Player game | function start2Player() {
$("#NASAScore h2").first().html("NASA Score");
$("#USSRScore").show();
$("#USSRMover").css("visibility","visible");
is2Player = true;
startGame();
} | [
"function startNewGame(){\n\ttoggleNewGameSettings();\n\tnewGame();\n}",
"function startGame() {\n removeWelcomePage();\n createGamePage();\n createCards();\n}",
"startGame() {\r\n this.generateInitialBoard();\r\n this.printBoard();\r\n this.getMoveInput();\r\n }",
"function gameSta... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
API method unpacks inputCode into numbers. Format is vert, hori, skill (3 chars) | unpack(inputCode) {
return [dirInputMap[inputCode[0]], dirInputMap[inputCode[1]], parseInt(inputCode[2])];
} | [
"function runIntCode(n) {\r\n // reads the file, recording the data as a string\r\n var input = fs.readFileSync('5.txt').toString();\r\n\r\n // turns the string into an array of ints.. i miss list comprehension\r\n var intcode = [];\r\n var i = 0;\r\n for (i = 0; i < input.split(',').length; i++) ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns true if the given JSX element matches the given component type. NOTE: This function only checks equality of `displayName` for performance and to tolerate multiple minor versions of a component being included in one application bundle. | function isElementOfType(element, ComponentType) {
return (element != null &&
element.type != null &&
element.type.displayName != null &&
element.type.displayName === ComponentType.displayName);
} | [
"function isElementOfType(element, Component) {\n var _element$props;\n\n if (element == null || ! /*#__PURE__*/React.isValidElement(element) || typeof element.type === 'string') {\n return false;\n }\n\n const {\n type: defaultType\n } = element; // Type override allows components to bypass default wrap... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
int hashable_getRandomBytes(unsigned char dest, int nbytes) | function h$hashable_getRandomBytes(dest_d, dest_o, len) {
if(len > 0) {
var d = dest_d.u8;
for(var i=0;i<len;i++) {
d[dest_o+i] = Math.floor(Math.random() * 256);
}
}
return len;
} | [
"function randomBytes(numberBytes) {\n return crypto.randomBytes(numberBytes).toString('base64');\n}",
"function random_with_replacement(bitLength) {\n if (bitLength == null) {\n bitLength = bytes * 8;\n }\n\n var r = random_bit();\n for (var i = 1; i < bitLength; i++) {\n r *= 2;\n r += random_bit(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |