query stringlengths 9 34k | document stringlengths 8 5.39M | negatives listlengths 19 20 | metadata dict |
|---|---|---|---|
Render monthly programs table HTML from JSON. | function monthly_json_to_programs_html(data) {
var html = "";
var len = data.programs.length;
for (var i = 0; i < len; i++) {
var program = data.programs[i];
html += "<tr class=\"event_row visible_event\">";
html += "<td></td>";
html += "<td><a class=\"history_link\" title_id=\"" + ... | [
"function monthly_json_to_programs_caption(data) {\n var scheduled_dur = 0;\n var recorded_dur = 0;\n var media_dur = 0;\n var live_dur = 0;\n var len = data.programs.length;\n for (var i = 0; i < len; i++) {\n var program = data.programs[i];\n\n scheduled_dur += program.scheduled_durati... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Read a uint24 from a buffer starting at the given offset. | function readUInt24BE(
buffer,
offset
) {
const val1 = buffer.readUInt8(offset) << 16;
const val2 = buffer.readUInt8(offset + 1) << 8;
const val3 = buffer.readUInt8(offset + 2);
return val1 | val2 | val3;
} | [
"static uint24(v) { return n(v, 24); }",
"static bytes24(v) { return b(v, 24); }",
"function shift (buffer, offset) {\r\n validate(buffer);\r\n\r\n for (var channel = 0; channel < buffer.numberOfChannels; channel++) {\r\n var cData = buffer.getChannelData(channel);\r\n if (offset > 0) {\r\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
import PostDetails from "./postDetails"; | function PostDetailsMain() {
return (
<div>
<div className="row mt-5">
<h3 className="text-align-center text-dark font-weight-bold">Post Data</h3>
</div>
<table className="table mt-5">
<thead className="thead-dark">
<tr>... | [
"componentDidMount() {\n fetch(`/api/posts/${this.props.match.params.postid}`)\n .then((resp) => resp.json())\n .then((data) => {\n store.dispatch({\n type: types.GET_POST_SUCCESS,\n posts: data,\n });\n })\n .catch(error => {\n con... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Both existingCostArr and runnningCostArr are in descending order return 0 if they equals return 1 if existingCostArr runnningCostArr | function compareArrays(existingCostArr, runnningCostArr) {
let index = 0;
while (true) {
let existingCost = existingCostArr[index], runnningCost = runnningCostArr[index];
if (existingCost === undefined && runnningCost === undefined)
return 0;
else if (... | [
"function check(arr) {\n\tconst a = [...new Set(arr.map((x, i) => x < arr[i + 1]).slice(0, -1))];\n\tif (a.length > 1) return 'neither';\n\tif (a[0]) {\n\t\treturn 'increasing';\t\n\t} else {\n\t\treturn 'decreasing';\n\t}\n\n}",
"sortTotalCostsDescend() {\n this.visitedSquares.sort(function(a,b) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Copyright (C) 2001,2002,2003,2004,2005 Michael Foster Distributed under the terms of the GNU LGPL OSI Certified File Rev: 3 / Note: These may not work in Safari v1.2. Reference: Thanks Rob :) / xTableRowDisplay() bShow if true show the row, else hide it sec ID or element reference of table, tHead or tBody nRow zerobase... | function xTableRowDisplay(bShow, sec, nRow)
{
sec = xGetElementById(sec);
if (sec && nRow < sec.rows.length) {
sec.rows[nRow].style.display = bShow ? '' : 'none';
}
} | [
"function displayTable() {\r\n displayOnly(\"#tableOfContents\");\r\n traverseAndUpdateTableHelper();\r\n prepareText(heirarchy.tree[0].sections[0].id);\r\n activePart = 0;\r\n iconEventListeners();\r\n settingsEventListeners();\r\n scrollEventListener();\r\n}",
"function toggle_display(idname)\n{\n\tobj =... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create chainable isRequired validator Largely copied directly from: | function createChainableTypeChecker(validate) {
function checkType(isRequired, props, propName, componentName) {
componentName = componentName || '<<anonymous>>';
if (props[propName] == null) {
if (isRequired) {
return new Error('Required prop \'' + propName + '\' was not specified in \'' +... | [
"function isRequiredPropType(path) {\n return (0, getMembers_1.default)(path).some(member => (!member.computed && member.path.node.name === 'isRequired') ||\n (member.computed && member.path.node.value === 'isRequired'));\n}",
"function setupRequired() {\n var short = $attrs['checkReq... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Set a `hndler` that is always called when the `action` finishes (either normally or with an exception). Note that `onexit(handler,action) == finally(action,handler)`. | function on_exit(hndler, action) /* forall<a,e> (hndler : () -> e (), action : () -> e a) -> e a */ {
return _bind_on_exit(hndler, action);
} | [
"function _new_handlerx( effect_name, reinit_fun, return_fun, finally_fun,\n branches0, handler_kind, handler_tag, wrap_handler_tag)\n{\n // initialize the branches such that we can index by `op_tag`\n // regardless if the `op_tag` is a number or string.\n const branches = new Array(branch... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
to validate time Compare to get Greatest of Integers. this method returns, 1 if int1 is Greater 0 if equal 1 if int2 is Greater | function greatestOfInts(int1, int2) {
try {
var variable1 = parseInt(int1);
var variable2 = parseInt(int2);
return variable1 > variable2 ? 1 : variable1 == variable2 ? 0 : -1;
} catch (ex) {
alert("Enter only Integers")
return -2;
}
} | [
"function larger() \n{\n\tvar num1 = parseInt(document.getElementById(\"firstint\").value)\n\tvar num2 = parseInt(document.getElementById(\"secondint\").value)\n\tnum1 > num2 ? document.write(num1) : document.write(num2)\n\t\n}",
"function maxOfTwoNumbers(a, b) {\n if (a > b) return a;\n else return b;\n}",
"... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Using the height of the map image, calculates the number of tiles tall the map is and returns a subsection of the rowNames array of that size. Called every 250 ms for the first 5 seconds the app is open. | function calcNumRows(){
var map = document.getElementById('map');
if(map != null){
var height = map.naturalHeight; //calculate the height of the map
//height -= 16;
height = height / 16;
var temp = [];
for(var i = 0; i < height; i++)
temp... | [
"nTiles(params) {\n return Object.keys(params.style.sources).map(source => {\n return getTiles(params.bounds, params.minZoom, ((params.style.sources[source].tileSize < 512) ? (params.maxZoom + 1) : params.maxZoom)).length\n }).reduce((a, b) => { return a + b }, 0)\n }",
"function calcTileExtents() {\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Add the theme styling to the page | async addTheme(){
//If there is no page styling already
if(!document.querySelector('.eggy-theme') && this.options.styles){
//Create the style tag
let styles = document.createElement('style');
//Add a class
styles.classList.add('eggy-theme');
//... | [
"function setupTheme() {\n var theme = interactive.theme;\n\n if (arrays[\"a\" /* default */].isArray(theme)) {\n // [\"a\", \"b\"] => \"lab-theme-a lab-theme-b\"\n theme = theme.map(function (el) {\n return 'lab-theme-' + el;\n }).join(' ');\n } else if (theme) {\n theme = 'lab-... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
use current system time, in milliseconds, to generate random number 0999 | function getRandomNum() {
let time = new Date();
return time.getMilliseconds();
} | [
"generateTimeSlept()\r\n {\r\n var time = Math.floor((Math.random() * 1) + 1)\r\n console.log(time)\r\n }",
"function generateTimestamp() {\n let currentTime = 1513196237428;\n let threeMonths = 7776000000;\n return currentTime + Math.round(Math.random() * threeMonths);\n}",
"function ran... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Determine whether the given properties match those of a `VirtualGatewayAccessLogProperty` | function CfnVirtualGateway_VirtualGatewayAccessLogPropertyValidator(properties) {
if (!cdk.canInspect(properties)) {
return cdk.VALIDATION_SUCCESS;
}
const errors = new cdk.ValidationResults();
if (typeof properties !== 'object') {
errors.collect(new cdk.ValidationResult('Expected an obj... | [
"function CfnVirtualGateway_VirtualGatewayLoggingPropertyValidator(properties) {\n if (!cdk.canInspect(properties)) {\n return cdk.VALIDATION_SUCCESS;\n }\n const errors = new cdk.ValidationResults();\n if (typeof properties !== 'object') {\n errors.collect(new cdk.ValidationResult('Expect... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
volume_type computed: true, optional: false, required: false | get volumeType() {
return this.getStringAttribute('volume_type');
} | [
"set ConeVolume(value) {}",
"function ComputeVolumeFromWeightAndType(volumeOutput, weightInput, typeInput) {\n LinEqComputeMfromYandX.call(this, volumeOutput, weightInput, typeInput);\n}",
"getVolume() {\r\n return this._muted ? 0 : this._volume;\r\n }",
"function Volume(props) {\n r... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Purpose assign different styles to different levels in the tree sectionno: something like 3.2.4; indicates position in tree dotcnt: sometimes the caller needs to make an adjustment, for example, when painting a header for the succeeding level Method just count the dots in the section number. | function pickstyle ( sectionno, dotcnt ) {
var i, rval;
if( sectionno == undefined ) {
sectionno = "0";
--dotcnt;
}
while((i = sectionno.indexOf( "." ) ) > 0 ) {
dotcnt++;
sectionno = sectionno.substr( i + 1 );
}
switch (dotcnt) {
case 0:
rval = "tt-level1"
break;
case 1:
rval = "tt-level2... | [
"function showLevels() {\n nodes.forEach(node => {\n node.color = Colorlvl[node.lvl - 1];\n });\n recharge();\n}",
"assignLevel(node, level) {\n node.level = level;\n if (level+1 > this.depth) {\n this.depth++;\n } \n for (let i = 0; i < node.children.length; i++) { ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns true if the given object is an instance of ContainerPolicy. This is designed to work even when multiple copies of the Pulumi SDK have been loaded into the same process. | static isInstance(obj) {
if (obj === undefined || obj === null) {
return false;
}
return obj['__pulumiType'] === ContainerPolicy.__pulumiType;
} | [
"static isInstance(obj) {\n if (obj === undefined || obj === null) {\n return false;\n }\n return obj['__pulumiType'] === AppServicePlan.__pulumiType;\n }",
"static isInstance(obj) {\n if (obj === undefined || obj === null) {\n return false;\n }\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
If exportNames contains only one string, then singleExportName is that string. In all other cases, it is undefined. | get singleExportName() {
return this._singleExportName;
} | [
"get exported() {\n return this.exportNames.size > 0;\n }",
"function splitExportAs(exportAs) {\r\n return exportAs ? exportAs.split(',').map(function (e) { return e.trim(); }) : [];\r\n }",
"isSimpleExportVar() {\n let tokenIndex = this.tokens.currentIndex();\n // expo... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Checks the localstorage and shows Cookie banner based on it. | function initializeCookieBanner() {
let isCookieAccepted = localStorage.getItem("cc_isCookieAccepted");
if (isCookieAccepted === null) {
localStorage.clear();
localStorage.setItem("cc_isCookieAccepted", "false");
showCookieBanner();
}
if (isCookieAccepted === "false") {
showCookieBanner();
}
} | [
"function GetAllCookies() {\n \n if (document.cookie === \"\") {\n document.getElementById(\"cookies\").innerHTML = (\"<p style='color: #ff0000;padding-bottom: 15px;'>\" + \"There are no cookies on this page!\" + \"</p>\");\n \n } else {\n docu... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Select saved payment if there is one. | function restoreSelectedPayment() {
const savedPayment = localStorage.getItem(config.paymentKey);
if (savedPayment) {
const isSelected = $option => $option.val() === savedPayment;
$(DOM.paymentOptions).each((_, el) => {
$(el).attr('checked', isSelected($(el)));
});
} else {
... | [
"function selectSavedPaymentInstrument() {\n $(document).on('click', '.saved-payment-instrument', function (e) {\n e.preventDefault();\n $('.saved-payment-security-code').val('');\n $('.saved-payment-instrument').removeClass('selected-payment');\n $(this).addClass('selected-payment');... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
1000 milliseconds Flips the currently clicked cell. | function flipCell() {
// Run flip from style.css for the clicked cell (this)
this.classList.toggle('flip');
flippedCell = this;
cellColor = flippedCell.dataset.color;
outcome(cellColor);
} | [
"function toggleSnakeCell(x, y) {\n cellDiv(x, y).toggleClass('snake');\n}",
"function flipX() {\n\t/// TODO:\n}",
"clickHandler() {\n // Show Flip Animation\n this.setState({ flip: true }, () => {\n setTimeout(() => {\n this.setState({ flip: false });\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Order iterator: Abstract. It is passed the root object, and uses the other, structurespecific objects of that root to iterate. OrderIterator constructor: takes in errors object and root object of tree to iterate. | function OrderIterator(objErrors, objRoot) {
if (objErrors != gstrPrototype) {
//Set up error-handling:
this.module = "Iterator";
this.init(objErrors, objRoot);
} //end if this isn't a prototype
} //end constructor PreorderIterator | [
"function PreorderIterator(objErrors, objRoot) {\n\tif (objErrors != gstrPrototype) {\n\t\t//Set up error-handling:\n\t\tthis.module = \"Iterator\";\n\t\tthis.init(objErrors, objRoot);\n\t} //end if this isn't a prototype\n} //end constructor PreorderIterator",
"function PostorderIterator(objErrors, objRoot) {\n\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Delete form fields Loaded by ajax in child forms or parent forms echo CHtml::link('Cancel', '', array('onClick' => 'delete_fields(this, 3, "grand_parent", "check_child"); return false;')) Last parameter check_child is used to hide grand parent if that check_field class is found in grand parent) | function delete_fields(elm, num_of_parents, grand_parent, check_child)
{
parent = jQuery(elm).parent();
// last_parent_child=jQuery(parent).children().last();
// if(jQuery(last_parent_child).attr("class")=="attachment_index_class")
// {
// delete_attachments(last_parent_child);
... | [
"function CtrlDeleteAllFieldsInOneCoupon(){\n addNewCouponFlag = 0; // we are not allowed to add new coupon\n UICtrl.deleteAllFieldsInOneCoupon();\n UICtrl.fieldsClickable();\n UICtrl.hideNextCouponButton();\n // jackpotCtrl.removeCoupon((UICtrl.getExpandedCoupon()).id); //we sho... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Show about window if it's not already open. | function showAboutWindow() {
if (aboutWindowOpen) {
return;
}
aboutWindow = new BrowserWindow({
webPreferences: {nodeIntegration: true},
maxWidth: 1920,
maxHeight: 1080,
minWidth: 500,
minHeight: 320,
width: 500,
height: 320
});
aboutWi... | [
"function show() {\n if (settings.shown) return;\n win.show();\n settings.shown = true;\n }",
"function ShowAboutWindow(p_open) {\r\n if (!Begin(\"About Dear ImGui\", p_open, ImGuiWindowFlags.AlwaysAutoResize)) {\r\n End();\r\n return;\r\n }\r\n Text(`Dear ImGu... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function: componentDidUpdate Arguments: None Defenition: Checks if the user is authenticated. If the user is not authenticated they are redirected to login. Returns: None | componentDidUpdate() {
if (!this.props.user.is_authenticated)
this.props.history.push("/login");
} | [
"async handleRedirectCallback () {\n this.loading = true\n try {\n this.user = await this.oidcClient.signinRedirectCallback()\n this.isAuthenticated = true\n } catch (e) {\n this.isAuthenticated = false\n this.error = e\n } finally {\n this.lo... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Assert that `_injectImplementation` is not `fn`. This is useful, to prevent infinite recursion. | function assertInjectImplementationNotEqual(fn) {
ngDevMode &&
assertNotEqual(_injectImplementation, fn, 'Calling ɵɵinject would cause infinite recursion');
} | [
"function not(f){\n return function(){\n // console.log(arguments);\n \n var result = f.apply(this,arguments);\n return !result;\n };\n}",
"static checkCallbackFnOrThrow(callbackFn){if(!callbackFn){throw new ArgumentException('`callbackFn` is a required parameter, you cannot capture results without ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Throws an ExpressionChangedAfterChecked error if checkNoChanges mode is on. | function throwErrorIfNoChangesMode(creationMode, checkNoChangesMode, oldValue, currValue) {
if (checkNoChangesMode) {
var msg = "ExpressionChangedAfterItHasBeenCheckedError: Expression has changed after it was checked. Previous value: '" + oldValue + "'. Current value: '" + currValue + "'.";
if (cre... | [
"function checkUnsavedChanges()\n{\n\tif(store.dirty)\n\t\t{\n\t\tif(confirm(config.messages.unsavedChangesWarning))\n\t\t\tsaveChanges();\n\t\t}\n}",
"function checkExpressionAnalysisMode(node) {\n return t.ifStatement(markMemberToNotBeRewritten(t.memberExpression(nonRewritableIdentifier('self'), nonRewritabl... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Change target url of letsplaybtn to a url of the selected game | function selectgame(targeturl){
//Before selecting the game we need to know which teams are going to play it, and show them in the modal
//get all teams from Database and make the right buttons out of them, eventually in the future different games need different teams
db_call('get','all_teams',getteams);
... | [
"function selectteam(targeturl){\n //get target from link in lets play button\n var target = document.getElementById(\"lets-play-btn\").getAttribute(\"href\");\n\n //if team is not set already add it to target url\n if (target.indexOf(\"&team=\") == -1){\n document.getElementById(\"lets-play-btn\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Close Block Settings pane | close() {
this.nodes.wrapper.classList.remove(BlockSettings.CSS.wrapperOpened);
/** Clear settings */
this.nodes.toolSettings.innerHTML = '';
this.nodes.defaultSettings.innerHTML = '';
/** Tell to subscribers that block settings is closed */
this.Editor.Events.emit(this.events.closed);
} | [
"function closeSettings() {\n let settingsTab = document.querySelector(\".settings\");\n settingsTab.style.display = \"none\";\n }",
"settingsClose() {\n\t\tdocument.getElementById('settingsPopup').style.display = \"none\";\n\t\tdocument.querySelectorAll('button.settings').forEach((element)=>{ element.disa... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function for counting of primes in k seconds | function countPrimes(data, callback) {
var kwork = parseInt(data.k);
var num = data.n;
var count = data.c;
if(isNaN(kwork)) {
return false;
}
setTimeout(function() {
// Get Primes
var prevTime = (new Date()).getTime();
var status = 1;
while(1)
{
var curTime = (new Da... | [
"function sumOfNPrime(num) {}",
"function primeTime (num){\n\tvar SqrRtNum = Math.sqrt(num);\n\tvar primeNum = true;\n\tfor(var i=2 ; i<SqrRtNum ; i++){\n\t\tif(num%i === 0){\n\t\t\tprimeNum = false;\n\t\t\tbreak;\n\t\t}\n\t}\n\treturn primeNum;\n\n}",
"function getPrimes(num) {\n var a = [...Array(num + 1).ke... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
TODO: POST To Update Template By Id | function _updateTemplateById(req, res, next) {
var templateId = req.params.id;
if (!COMMON_ROUTE.isValidId(templateId)) {
json.status = '0';
json.result = { 'message': 'Invalid Template Id!' };
res.send(json);
} else {
var templateObject = {
'type': req.body.type... | [
"editDisplayTemplate (templateId, key, value) {\n console.log('editDisplayTemplate:', templateId, key);\n let user = Auth.requireAuthentication();\n \n // Validate the data is complete\n check(templateId, String);\n check(key, String);\n check(value, Match.Any);\n \n // Get the display te... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
flowinclude name: string; id: string; users: Array; log: Array; | constructor(name/*: string */) {
this.name = name;
this.id = toId(name);
this.users = [];
this.log = [];
} | [
"constructor() { \n \n FlowLog.initialize(this);\n }",
"function FlowLog(props) {\n return __assign({ Type: 'AWS::EC2::FlowLog' }, props);\n }",
"_emitQueryLogs(json={}){\n this.app.service('query_logs').emit('logs',json) ;\n }",
"logAPI(apiName, uniqueID){\n logg... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function name :getHousingVacancy Parameters: countyid: elementId; | function getHousingVacancy(countyid, elementId) {
if (typeof countyid === "undefined") {
countyid = document.getElementById('selectCounty').value;
}
if (window.XMLHttpRequest) {
var xmlhttp = new XMLHttpRequest();
} else {
var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
... | [
"function getHouseholdDetails(){\n\n let household_population_data = {};\n\n census_data.households.forEach((ele)=>{\n if(household_population_data.hasOwnProperty(ele.county) === false){\n household_population_data[ele.county] = {};\n \n household_population_data[ele.co... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Collapses a panel with the given id. Has no effect if the panel is already collapsed or disabled. | collapse(panelId) { this._changeOpenState(this._findPanelById(panelId), false); } | [
"_collapsePanel(panel) {\n panel.expanded = false;\n }",
"async collapse() {\n if (await this.isExpanded()) {\n await this.toggle();\n }\n }",
"collapsableId(){\n return Template.thought_panel.fn.collapsableId();\n }",
"_expandPanel(panel) {\n panel.expanded ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Rechazar la orden de trabajo | rechazarOrden(){
var promesa = Api.rechazarOrden({//Orden cancelada por el técnico
id_orden_trabajo:this.state.datosOrden.id_orden_trabajo,
obs_devolucion :this._obs_devolucion.value
});
promesa.then(valor => {
this.props.getOrdenes();
this.modal... | [
"function get_trabajoActual() {\n fct_MyLearn_API_Client.get({ type: 'Proyectos', extension1: 'Curso', extension2: $routeParams.IdTrabajo.trim() }).$promise.then(function (data) {\n $scope.trabajoActual = data;\n });\n }",
"function registroAnterior(){\n if (posicion>0){... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sets the current selected knowledge point according to the given index | function setSelected(index) {
selected = points[index];
console.log('selected knowledge point');
console.dir(selected);
chapter = selected.chapter;
syllabus = chapter.syllabus;
} | [
"setIndex(index) {\n\t\tthis.index = index;\n\t}",
"setAt(idx, val) {\n try {\n if (idx >= this.length || idx < 0) throw new Error('Index is invalid!');\n let targetNode = this._getNode(idx);\n targetNode.val = val;\n } catch (e) {\n console.warn(e);\n }\n }",
"setAt(idx, val) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
return all lines with length 3 where field is located | function getLines (field) {
const horizontal_start = $$$$$.ceil(field / 3, 10) * 3,
vertical_start = field % 3 == 0 ? 3 : field % 3,
lines = [
[horizontal_start, horizontal_start - 1, horizontal_start - 2],
[vertical_start, vertical_start + 3, vertical_start + 6]
]
if (field ==... | [
"function wordsLongerThanThree(str) {\n // TODO: your code here \n str = str.split(\" \");\n return filter(str, function(value){\n return value.length > 3;\n });\n}",
"function extractData(begin_line_index, end_line_index, filecontent) {\n\ttext = [];\n\tborder = [];\n\ttext_temp = [];\n\tborder_... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Unsafely promote a string to a TrustedScript, falling back to strings when Trusted Types are not available. | function trustedScriptFromString(script) {
var _a;
return ((_a = getPolicy()) === null || _a === void 0 ? void 0 : _a.createScript(script)) || script;
} | [
"function sanitize(text) {\n try {\n // Si no se encuentra undefined\n if (text !== undefined && typeof text === \"string\") {\n return text.replace(/'/g, \"''\");\n }\n }\n catch (err) {\n console.error(`(sanitize): error (${err.stack})`);\n }\n return text;\n}... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Initialize the page action: set icon and title, then show. Only operates on tabs whose URL's protocol is applicable. | function initializePageAction(tab) {
if (urlIsApplicable(tab.url)) {
browser.pageAction.setIcon({tabId: tab.id, path: "icons/off.svg"});
browser.pageAction.setTitle({tabId: tab.id, title: TITLE_APPLY});
browser.pageAction.show(tab.id);
}
} | [
"function initPage(sMode) {\n bindGrid();\n setDefaultValues();\n var sPageTitle = getPageTitle();\n el(\"hdnPageTitle\").value = sPageTitle;\n el(\"lstBack\").style.display = \"none\";\n el(\"lstFirst\").style.display = \"none\";\n el(\"lstPrev\").style.display = \"none\";\n el(\"lstNext\")... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
targetGrid = $("jqGridId") rowIndex = row you want to scroll to | function scrollToRow(targetGrid, rowIndex) {
var rowHeight = 23; // rowheight
var index = jQuery(targetGrid).getInd(id);
jQuery(targetGrid).closest(".ui-jqgrid-bdiv").scrollTop(rowHeight * index);
} | [
"function scrollToSelectedRow(gridSelector) {\r\n var gridWrapper = document.querySelector(gridSelector);\r\n if (gridWrapper) {\r\n var selectedRow = gridWrapper.querySelector(\"tr.k-state-selected\");\r\n if (selectedRow) {\r\n selectedRow.scrollIntoView();\r\n }\r\n }\r\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
buildContent the callback functions take an xsl stylesheet in the first parameter and the xml document in the second | function buildContent(xslDoc, xmlDoc, sectionVal) {
var xsltProcessor, resultDocument ;
xsltProcessor = new XSLTProcessor();
xsltProcessor.importStylesheet(xslDoc);
xsltProcessor.setParameter(null,"sectionVal",sectionVal);
resultDocument = xsltProcessor.transformToFragment(xmlDoc, document);
// 'slide up, cle... | [
"function buildMenu(xslDoc, xmlDoc) {\n\tvar xsltProcessor, resultDocument ;\n\txsltProcessor = new XSLTProcessor();\n\txsltProcessor.importStylesheet(xslDoc); \n\tresultDocument = xsltProcessor.transformToFragment(xmlDoc, document);\t\n\t\n\t// 'slide up, clear, and append'\n\t$(\"#content\").slideUp(\"slow\", fun... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Find measurement based on timstamp | function findNearest(time, callback){
for(i = 0; i < timestamps.length; i++)
if (timestamps[i] > time){
callback(measurments[i]);
break;
}
} | [
"function get_record_by_timestamp(timestamp) {\n var records = app_state.data.records;\n var min_t = records[0].timestamp;\n var max_t = records[records.length - 1].timestamp;\n\n if (timestamp < min_t || timestamp > max_t) {\n console.warn('Timestamp out of range');\n return null;\n }\n\n // If we have... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Search for a query string inside a node property | function stringSearch(key, searchQuery, node, path, treeIndex) {
return "function" == typeof node[key] ? String(node[key]({
node: node,
path: path,
treeIndex: treeIndex
})).indexOf(searchQuery) > -1 : "object" === _typeof(node[key]) ? getReactEleme... | [
"function extPart_getWhereToSearch(partName)\n{\n return dw.getExtDataValue(partName, \"searchPatterns\", \"whereToSearch\");\n}",
"function search_location_property(parent)\n{\n if (parent.type!='MemberExpression' || !parent.property || parent.property.type!='Identifier') return false;\n var property_name... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
update user by token varify | async function updateByToken(token, newData) {
try {
if (!token) throw 'token is missing';
if (!newData) throw 'new data is missing';
const found = await jwt.verifyToken(token);
// const { first_name, last_name, active } = newData; //TODO
// const res = await UserModel.findByIdAndUpdate(found._i... | [
"updateToken(email, token, date) {\n return this.findOneAndUpdate(\n { email },\n {\n $set: { resetPasswordToken: token, resetPasswordExpires: date },\n },\n );\n }",
"put(data, callback) {\n const id =\n typeof data.payload.id === 'string'\n && data.payload.id.trim().len... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Derivative Function/Algorithm Pt. 1 | function derive(){ // Fills Arrays of 1sd Derivative Coordinates
var m = 0; // Slope!
//console.clear(); // For Debug.
//console.log("Derivative Points:"); // For Debug.
// Find the Slope at Every Point of the Function
for(i=0;i<xPoints.length;i++) {
m =(yPoints[i+1]-yPoints[i])/(xPoints[i+1]-xPoints[i]); // C... | [
"function firstDerivative(){ // Derivative Algorithm Pt. 2\n\tif(ftc.checked==true) \n\t\tGraphButton();\n\tftc.checked=false;\n\tif(firstDer.checked) {\n\t\t// Reset Derivative Points\n\t\tderX = [];\n\t\tderY = [];\n\t\t\n\t\t// Derive & Graph\n\t\tderive();\n\t\tPointGraph(derX, derY, \"red\");\n\t}\n\telse\n\t\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Check if newPoint's id matches any id's in masterList | function PointInMaster(newPoint, masterList) {
for(var i=0; i < masterList.response.feedMessageResponse.messages.message.length; ++i) {
if(masterList.response.feedMessageResponse.messages.message[i].id === newPoint.id)
return true;
}
return false;
} | [
"checkID(id){\n for (var i = 0; i < this.player_list.length; i++) {\n if (this.player_list[i].id == id) {\n return true;\n }\n }\n return false;\n }",
"function checkIfDuplicate(favList,checkPokemon){\n var check = false;\n favList.forEach(function (pokemon) {\n if(pokemon.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Dynamic Skinning success call back function | function dynamicSkinningSuccess(resp){
kony.print(resp);
} | [
"function success(text){\n return SUCCESS_COLOUR + BRIGHT + 'Complete! : ' + RESET_COLOUR + SUCCESS_COLOUR + text + RESET_COLOUR;\n}",
"onRender() {}",
"function setJumbo(response){\n\t\t\t$(\".myName\").append('<center><a class=\"navbar-brand\" href=\"#\" id=\"myname\"><b>'+response.name+'</a>');\n\t\t $(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This function initialises the settings for the window course group and students list require a numbered array, called $scope.groups.groupList For fast processing, and quick tracking of previously encountered course groups, we will use an associative array, groupIndex, which links course group reference to the appropria... | function init() {
Course.enrolments(entity.customExam.courseId).then(function(response) {
groupIndex = [];
for (var index in response.data) {
student = response.data[index];
if (student._completionStatus.id === 1) { // Only want to inc... | [
"function loadGroups(that) {\r\n if (that.config.groups !== undefined) {\r\n $.each(that.config.groups, function (index, value) {\r\n //Group reducing function by Size\r\n if (that.config.groups[index].context === \"context:reduce\") {\r\n that.idxG... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sync Module Queries other master servers for their known game servers, adds their response to our game servers's synced list. Behaviour :: TCP ACTIVE Receives a Unreal Engine 1 Master Server address and fetches it's current known server list, updating our knownGameServersSynced hash. | function syncWithKnownMasterServer(server){
var VALIDATION = '\\gamename\\' + server.game +'\\location\\0\\validate\\OPNSRCUP\\final\\'; // Validation answer
var QUERYREQST = '\\list\\gamename\\' + server.game + '\\final\\' // Query for games list
var conn = new tcp.Socket();
conn.setTimeout(100... | [
"function syncWithAll(){\r\n for(var svr of knownMasterServers){\r\n syncWithKnownMasterServer(svr);\r\n }\r\n}",
"updateHostList() {\n\t\tlet joinableGames = new Map();\n\t\tfor (var [socketID, game] of this.games) {\n\t\t\tif (game && !game.isPlaying && game.players.length < Game.maxPlayers) {\n\t\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Set time picker to hour/minute/type | function setTimePicker(timePicker, hour, minute, type){
// Set hour
$(timePicker).find('select.hour').val(zeroPad(hour, 2));
// Set minute
$(timePicker).find('select.minute').val(zeroPad(minute, 2));
// Set AM/PM
$(timePicker).find('select.ampm').val(type);
} | [
"function setTimeHandlers(field){\n \n $(field).on({\n \n // On focus...\n \n 'focus': function(event){\n \n // Remove validation\n \n $(this).removeClass('invalid');\n \n // If empty, set to 12:00AM\n \n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
appends divs to container | function appendDivs(rows){
var boxsize = $(".container").width()/(rows);
//$(".boxes").width(boxsize+"px");
//$(".boxes").height(boxsize+"px");
for(var i=0;i<rows*rows;i++){
$(".container").append($('<div class="boxes"></div>'));
}
$(".boxes").height(boxsize);
$(".boxes").width(boxsize);
} | [
"function populateGalleryContainer(arr) {\r\n for (var i = 0; i != arr.length; i++) {\r\n galleryContainer.appendChild(arr[i]);\r\n //console.log(galleryContainer);\r\n };\r\n }",
"function createDivs(problemObject) {\n\n var i, j;\n var div = '';\n for (i = 0; i < prob... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
modify time stamp of npm package.json. | function update_package_file_version() {
const package_file_path = library_base_directory + 'package.json';
let package_file_content = CeL.read_file(package_file_path).toString()
// version stamp
.replace(/("version"[\s\n]*:[\s\n]*")[^"]*(")/, function (all, header, footer) {
return header + CeL.version +... | [
"async function update_package_jsons() {\n const pkg = JSON.parse(fs.readFileSync(\"./package.json\"));\n pkg.version = NEW_VERSION;\n const pkg_json = `${JSON.stringify(pkg, undefined, 4)}\\n`;\n fs.writeFileSync(\"../package.json\", pkg_json);\n const packages = {};\n for (const ws of pkg.worksp... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
update the object's matrix state with the current object's matrix and reset all transformation matrices | function updateMatrixState() {
objMatrixState.copy(obj.matrix);
//reset all matrices because the state has been updated
translateMatrix.makeTranslation(0, 0, 0);
rotateMatrix.identity(); //not really needed
scaleMatrix.makeScale(1, 1, 1);
notchCounter = 0;
quatState.copy(gizmosR.quaterni... | [
"resetTransform() {\n _wl_object_reset_translation_rotation(this.objectId);\n _wl_object_reset_scaling(this.objectId);\n }",
"function mResetMatrix() {\n resetMatrix();\n mPage.resetMatrix();\n}",
"toggleProjectionMatrixHandInPlace() {\n const m = this._m;\n m[8] *= -1;\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Hides the url bar inside mobile devices | function hideUrlBar() {
if (window.location.hash.indexOf('#') == -1) {
window.scrollTo(0, 1);
}
} | [
"function hideAddressBar() {\n window.scrollTo(0, 1); //hide address bar\n}",
"quickHideAddressBar() {\n const self = this;\n\n window.addEventListener( \"load\",function() {\n setTimeout(function(){\n window.scrollTo(0, window.pageYOffset + 1);\n }, 0);\n });\n window.addEventListen... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Randomly gets a class from the list. | function getClass(){
var classes = ['barbarian', 'monk', 'fighter', 'paladin', 'rogue', 'ranger',
'bard', 'wizard', 'warlock', 'sorcerer', 'cleric', 'druid'];
return classes[Math.floor((Math.random() * classes.length) + 1)-1];
} | [
"function pickRandomFrom(list) {\n return list[Math.floor(Math.random() * list.length)];\n }",
"function getRandomPiece() {\r\n let types = [I,O,L,J,T,S,Z];\r\n return new types[Math.floor(Math.random() * types.length)]();\r\n}",
"function getRandomElement() {\n let element = surprises[Math.floor(Mat... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
end interface "class": CVietString | function CVietString(str) {
this.value = str;
this.keymode = initKeys();
this.charmap = initCharMap();
this.ctrlchar = '-';
this.changed = 0;
this.typing = typing;
this.Compose = Compose;
this.findCharToChange = findCharToChange;
return this;
} | [
"function objj_string(string) {\n\treturn new _CPString2.default(string);\n}",
"static string(v) { return new Typed(_gaurd, \"string\", v); }",
"function StringUtils() {}",
"function RTCElement_setElementString(elmStr)\n{\n this.elementString = elmStr;\n}",
"function sc_substring(s, start, end) {\n retu... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return true if there is a room or a possible room already at the given position | roomOrPossibleExists(position, rooms, possibles) {
var result = false;
for (var i = 0; i < rooms.length; i++) {
if (rooms[i].position[0] === position[0] && rooms[i].position[1] === position[1]) {
result = true;
break;
}
}
for (i = 0... | [
"function isThereADoorToGoToRoom (handlerInput, room){\n const sessionAttributes = handlerInput.attributesManager.getSessionAttributes();\n \n // get the doors in the currentRoom\n const currentRoomDoors = sessionAttributes.gamestate.currentRoom.elements.doors\n \n var canGo = false;\n \n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sets the given auth token into the browser's cookie. Does nothing if the token is null. | function setAuthToken(token) {
if (token) {
$.cookie(cookieName, token, {path: '/', domain: 'kbase.us', expires: 60});
$.cookie(cookieName, token, {path: '/', expires: 60});
}
} | [
"function setHeaderWithToken() {\n var cookie = $.cookie(\"accessToken\");\n\n $(document).ajaxSend(function (event, jqxhr, settings) {\n jqxhr.setRequestHeader('Authorization', 'bearer ' + cookie);\n });\n }",
"setAccessToken(token) {\n localStorage.setItem('accessToken', token);\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Given an IFD (Image File Directory) start offset returns an offset to next IFD or 0 if it's the last IFD. | function getNextIFDOffset(dataView, dirStart, bigEnd){
//the first 2bytes means the number of directory entries contains in this IFD
var entries = dataView.getUint16(dirStart, !bigEnd);
// After last directory entry, there is a 4bytes of data,
// it means an offset to next IFD.
... | [
"function GetPosition(elementRef, direction, iconDimension, calendarDimension) {\n\tvar position = 0;\n\tvar offset = 0;\n\tvar element = elementRef;\n\t\n\twhile (element) {\n\t\toffset = element[\"offset\" + direction];\n\t\tposition += offset;\n\t\telement = element.offsetParent;\n\t}\n\t\n\tif (iconDimension &&... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns the last opened sidenav extra menu identifier. | getLastOpenedSidenavExtra() {
return this._sidenavExtra.last;
} | [
"function DDLightbarMenu_GetTopItemIdxOfLastPage()\n{\n\tvar numItemsPerPage = this.size.height;\n\tif (this.borderEnabled)\n\t\tnumItemsPerPage -= 2;\n\tvar topItemIndex = this.NumItems() - numItemsPerPage;\n\tif (topItemIndex < 0)\n\t\ttopItemIndex = 0;\n\treturn topItemIndex;\n}",
"function getLastVisitedListI... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
An event that is emitted when a [text document](TextDocument) is disposed. | get onDidCloseTextDocument() {
return vscode.workspace.onDidCloseTextDocument;
} | [
"get onDidOpenTextDocument() {\n return vscode.workspace.onDidOpenTextDocument;\n }",
"dispose() {\n this.context = null;\n\n // remove all global event listeners when component gets destroyed\n window.removeEventListener('message', this.sendUpdateTripSectionsEvent);\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
used to recursively generate demesnes based on population | generateDemesnes(popCount = 0, demesnes = []) {
const { measurements } = this.defaults;
const multiplier = 1.3;
let maxPop = popCount * 0.7;
let demesne;
// generate duchy
if (popCount >= (measurements.getMaxSize('duchy') * multiplier)) {
if (maxPop > measurements.getMaxSize('duchy')) {
... | [
"evolvePopulation(pop) {\n let newPopulation = new Population(pop.size(), false);\n\n // Keep our best individual if elitism is enabled\n let elitismOffset = 0;\n if (this.elitism) {\n newPopulation.saveTour(0, pop.getFittest());\n elitismOffset = 1;\n }\n\n // Crossover population\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
adds restaurant to the visited list and updates database | function addVisitedRestaurant(name, date, cuisine, city) {
// add to front of array so keep in date order
// for (var i = 0; i < visitedRestaurants.length; i++) {
// console.log("Before " + i + " " + JSON.stringify(visitedRestaurants[i]));
// }
visitedRestaurants.unshift({
name: name,
... | [
"function updateRestaurantList(dataList) {\n restaurants = {};\n allRests =[];\n for (i = 0; i < dataList.length; i++) {\n restaurant = JSON.parse(dataList[i]);\n restaurants[restaurant.id] = restaurant;\n }\n if(selfpos != undefined){\n displayRoute(JSON.parse(dataList[0]));\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function for telling there's not enough players | static needPlayers() {
alert('There\'s not enough players in the room');
} | [
"_noMoreActivePlayers() {\n const nextActivePlayer = getNextActivePlayerFromIndex(\n this.players,\n this.activePlayerIndex\n );\n return nextActivePlayer === this.activePlayer;\n }",
"validateGamesQuantity(){\n\n const list = this.getGamesList().childNodes;\n\n if(li... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sort by the birth year from earliest to latest. | function sortByBirthDate(list) {
list.sort((a, b) => {
const aBirthYear = a._data.BirthDate.split("-")[0];
const bBirthYear = b._data.BirthDate.split("-")[0];
return aBirthYear - bBirthYear;
});
} | [
"function sortYear() {\r\n document.querySelector('#yearH').addEventListener('click', function (e) {\r\n const year = paintings.sort((a, b) => {\r\n return a.YearOfWork < b.YearOfWork ? -1 : 1;\r\n })\r\n displayPaint(year);\r\n })\r\n }",
"get sort... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
====================================================================== FUNCTION: cleanNumber (numstr, defaultvalue) INPUT: numstr (string/number) the string that will be cleaned to ensure that the value is a number (int or float) RETURN: A string containing a valid integer or float value; Returns the defaultvalue if an... | function cleanNumber(numstr, defaultvalue) {
var resultStr = "";
var decCount = 0; // number of decimal points in the string
//??? Jan 2014 ??? if (arguments.length < 2) defaultvalue = "0" //use this default value
if (arguments.length < 2) defaultvalue = "0" //use this default value
//??? Feb 2014 revert ??? ... | [
"function myParseInt(str) {\n\n var newString= str.replace(/ /g, '');\n var isFloat=newString.indexOf('.') != -1\n var isValidNumber=!isNaN(newString);\n var hasLetters=(newString.match(/[a-z]/i));\n var specialCharacters=!(/[~`!#$%\\^&*+=\\-\\[\\]\\\\';,/{}|\\\\\":<>\\?]/g.test(newString));\n \n if (isValidNumb... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Performs client side validation against the controls present in a collection line | function validateLine(collectionName, lineIndex) {
var controlsToValidate = jQuery("[name^='" + collectionName + "[" + lineIndex + "]']");
var valid = validateLineFields(controlsToValidate);
if (!valid) {
showClientSideErrorNotification();
return false;
}
return true;
} | [
"function validateAddLine(collectionGroupId, addViaLightbox) {\n var collectionGroup = jQuery(\"#\" + collectionGroupId);\n var addControls = collectionGroup.data(kradVariables.ADD_CONTROLS);\n\n if (addViaLightbox) {\n collectionGroup = jQuery(\"#kualiLightboxForm\");\n }\n\n var controlsToVa... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets the metadata for all releases. | getReleases() {
return this._releases;
} | [
"async function downloadData() {\n const releases = [];\n for (const source of sourcesOfTruth) {\n\n // fetch all repos of a given organizaion/user\n const allRepos = await fetch(\n `${baseURL}/users/${source.username}/repos${auth}`\n ).then(res => res.json());\n\n // fetch releases of every repo... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Check if the given MIME is a JSON MIME. JSON MIME examples: application/json application/json; charset=UTF8 APPLICATION/JSON application/vnd.company+json | isJsonMime(mime) {
const jsonMime = new RegExp('^(application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(;.*)?$', 'i');
return mime !== null && (jsonMime.test(mime) || mime.toLowerCase() === 'application/json-patch+json');
} | [
"function IsValidJsonString(str) {\n try {\n JSON.parse(str);\n } catch (e) {\n return false;\n }\n return true;\n }",
"function JSONChecker()\n{\n}",
"function isStringType(contentType){\n var stringTypes = ['text/plain', 'application/javascript', 'text/h... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Hides the rate charts (if they're visible) | function hideRateCharts( ) {
if ($('#search_results').is(':visible')) {
$('#search_results').slideUp(200);
}
if ($('#search_results_note').is(':visible')) {
$('#search_results_note').slideUp(200);
}
if ($('#search_results.single').is(':visible')) {
$('#search_results.single').slideUp(200);
}
} | [
"function hideChart() {\n document.getElementById('voting-chart').style.visibility = 'hidden';\n document.getElementById('voting-chart').style.display = 'none';\n}",
"function removeTrendChart() {\r\n $('.trendChartData').hide();\r\n $('#trendChartLegend').hide();\r\n $('#lineChartLegend').show();\r\n}... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Unwrap the nodes at a location from a parent node, splitting the parent if necessary to ensure that only the content in the range is unwrapped. | unwrapNodes(editor, options) {
Editor.withoutNormalizing(editor, () => {
var {
mode = 'lowest',
split = false,
voids = false
} = options;
var {
at = editor.selection,
match
} = options;
if (!at) {
return;
}
if (match == null... | [
"unwrapNodes(editor) {\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n Editor.withoutNormalizing(editor, () => {\n var {\n mode = 'lowest',\n split = false,\n voids = false\n } = options;\n var {\n at = edit... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This function determines whether the incoming string is within its maximum allowable length or not. Returns 1 when the string length is greater than maxlen Returns 0 when the string length is less than or equal to maxlen. | function isStringTooLong(str,maxlen)
{
if (str==null || str=="")
return 0;
var len = str.toString().length;
if (len > maxlen)
return 1;
else
return 0;
} | [
"function isLengthBetween(str, min, max) {\n return (str.length >= min) && (str.length <= max);\n}",
"function imposeMaxLength(Object, MaxLen)\r\n{\r\n return (Object.value.length <= MaxLen);\r\n}",
"function strLength(x){\n if (typeof x === \"string\" && x.length >= 8){\n return true;\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Add attributes to a newly created DOM node. | function addAttributes(node, attrs) {
for (var name in attrs) {
var mode = attrModeTable[name];
if (mode === IS_PROPERTY || mode === IS_EVENT) {
node[name] = attrs[name];
}
else if (mode === IS_ATTRIB... | [
"addAttribute(...args) {\n if (this.setAttribute) {\n return this.setAttribute(...args)\n } else {\n return super.setAttribute(...args)\n }\n }",
"function createNodeAndText(type, text, attributes) {\n var node = document.createElement(type);\n var child = document.createTextNode(text);\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
toggle YT volume buttons depends on player type | function toggleVolBtn() {
if (PLAYER.type=="yt" || PLAYER.type=="dm") {
$_voldownbtn.show();
$_volupbtn.show();
} else {
$_voldownbtn.hide();
$_volupbtn.hide();
}
} | [
"function change_volume_icon()\n{\n\tif(cp_mediaPlayer.muted)\n\t\t$(\".chalk_player .media_controls .volume_icon\").find(\".media_icon\").removeClass(\"glyphicon-volume-up glyphicon-volume-down\").addClass(\"glyphicon-volume-off\");\n\telse\n\t\t$(\".chalk_player .media_controls .volume_icon\").find(\".media_icon\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
SLTReelSprite Slot Machine Reel Sprite | function SLTReelSprite() {
this.initialize.apply(this, arguments);
} | [
"function renderNPCSprites(aDev,aGame)\n{\n ////this makes a temp object of the image we want to use\n //this is so the image holder does not have to keep finding image\n tempImage1 = aDev.images.getImage(\"orb\")\n tempImage2 = aDev.images.getImage(\"fireAmmo\")\t\n for (var i = 0; i < aGame.gameSp... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
You receive the name of a city as a string, and you need to return a string that shows how many times each letter shows up in the string by using an asterisk (). For example: "Chicago" > "c:,h:,i:,a:,g:,o:" As you can see, the letter c is shown only once, but wih 2 asterisks. The return string should include only the l... | function getStrings(city) {
let lc = city.split(' ').join('').toLowerCase();
let arr = lc.split('');
let noDuplicates = arr.filter(function (el, index) {
return arr.indexOf(el) === index;
});
let result = [];
noDuplicates.forEach(function (el) {
let occurances = lc.split(el).length -... | [
"function repeatChar(string,char){\n string= string.toLowerCase()\n string= string.split(\"\")\n var result = string.reduce(function(num,str){\n\nif ( str===char){\n ++num\n}return num\n\n } ,0)\n return result\n}",
"function repeatChar(str,char){\n\tvar count=0;\n\tvar str1= str.split(\"\");\n var rep = ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creating the suppsec search map of the defined fields for the url creation Reading from genericsearch form hiddesn fields | function create_supp_sec_search_parameter_MAP() {
var map = {};
var glblSearchEl = document.getElementById('globalsearch');
var glblSearchInputEls = glblSearchEl.querySelectorAll('input');
for (var i = 0; i < glblSearchInputEls.length; i++) {
if (glblSearchInputEls[i].getAtt... | [
"function create_globalsearch_Map() {\n var map = {};\n var glblSearchEl = document.getElementById('globalsearch');\n var glblSearchInputEls = glblSearchEl.querySelectorAll('input');\n\n for (var i = 0; i < glblSearchInputEls.length; i++) {\n var map_key = glblSearchInputEls[i... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Show a list of tasks grouped by a status in a modal | function showTaskStatus(status) {
return $modal.open({
templateUrl: apps_url + 'assets/sync_manager/templates/task_status.html',
controller: 'taskStatusController',
resolve: {
status: function () {
return status;
... | [
"function renderTasks(arrayOfTasks) {\n $('#taskTable').empty();\n\n arrayOfTasks.forEach(task => {\n if (task.completed == false) {\n $('#taskTable').append(`\n <tr class=\"tableRow\" data-id=\"${task.id}\">\n <td class=\"taskDataCell\">\n <div c... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Project a snapshot in place to only include specified fields | function projectSnapshot(fields, snapshot) {
// Only json0 supported right now
if (snapshot.type && snapshot.type !== json0.uri) {
throw new Error(ERROR_CODE.ERR_TYPE_CANNOT_BE_PROJECTED, 'Cannot project snapshots of type ' + snapshot.type);
}
snapshot.data = projectData(fields, snapshot.data);
} | [
"function fieldClone(field)\n{\n // first, just get a copy of the object itself\n\n var clone = Object.assign({},field); // clone ALL object fields\n\n var listFields = [\"perspective\",\"target\",\"start\",\"end\",\"targetVal\",\n\t\t \"multiplier\",\"low\",\"high\",\n\t\t \"shape... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Yield to a block located at a particular symbol location. | function YieldBlock(to, params) {
return [op('SimpleArgs', {
params,
hash: null,
atNames: true
}), op(24
/* GetBlock */
, to), op(25
/* JitSpreadBlock */
), op('Option', op('JitCompileBlock')), op(64
/* InvokeYield */
), op(40
/* PopScope */
), op(1
/* PopFrame */
)];
} | [
"function PushYieldableBlock(block) {\n return [PushSymbolTable(block && block.symbolTable), op(62\n /* PushBlockScope */\n ), op('PushCompilable', block)];\n}",
"*[Symbol.iterator]() {\n for (let wo of this.worldObjects.values())\n yield wo;\n }",
"getBlockByAddress() {\n this.server.r... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Finds a cyclic set of numbers within pStrings that satisfies the problem criteria. | function findCycle(pStrings, found, kUsed) {
if (isCyclic(found)) {
return found;
}
var lenFound = found.length;
var lenLastFound = found[lenFound-1].length;
var lenPkStrings;
var newKUsed;
var cycle;
for (var k = 0; k < 5; k++) {
if (kUsed.indexOf(k) == -1) {
... | [
"function possibileTrees(str){\n let possibilities=[]\n\n function recursive(str){\n for(let i=0;i<=str.length;i++){\n let sliced = str.slice(0,str.length-i) + str.slice((str.length-i+1), str.length)\n if(!possibilities.includes(sliced)&&sliced) pos... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
to show detail of one particular hotel given hotelID | retrieveHotel(id){
return axios.get(`${CONST_API_URL}/showHotelDetails/${id}`);
} | [
"function showHotelDetails(view, hotelView) {\n\t// render the hotel details view, passing in the hotel view so details view knows where to display from and which hotel to show\n\tview.views['hotel-details'].render(hotelView);\n}",
"retrieveReviewsForHotelById(id){\n return axios.get(`${CONST_API_URL}/show... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
function drawArc draw arrows with parameters : e1 : the outgoing state ; e2 : the incoming state ; a : the number of the automata k : the number of the arrow of this automata ; num_arc : the number of the arrow in total (to allow the displacement) coordonnees : array containing the coordinates of each arrow ; first : b... | function drawArc(texte, e1, e2, a, k, num_arc, coordonnees, first, p) {
var x = 140 + (a - 1) * 180,
y = 55 + (4 - e1) * 50 - (e2 - e1) * 25,
h = 2 + (e2 - e1) * 50,
x1, x2, x3, x4, y1, y2, y3, y4;
if (first) {
first = false;
if (k % 2 == 0) {
if (e2 < e1) {
coordonnees[num_arc... | [
"function drawArc(a, b, c) {\n const orient = b.x * (c.y - a.y) + a.x * (b.y - c.y) + c.x * (a.y - b.y);\n const sweep = (orient > 0) ? 1 : 0;\n const size = Point.distance(b, a);\n return [a.x, a.y + 'A' + size, size, 0, sweep, 1, c.x, c.y].join(',');\n}",
"arrowhead(x0, y0, x1, y1) {\n const dx = x0 - x1... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
=======================================page 5 split page base on rider========================== | function needSplitPageForPlan()//page 5 split page base on rider
{
isNeedSplit = "NO";//split data
appendPage('page5','PDS/pds2HTML/PDSTwo_ENG_Page5.html');
isNeedSplit = "YES";
appendPage('page5b','PDS/pds2HTML/PDSTwo_ENG_Page5b.html');
loadInterfacePage();//to check to hide some division... | [
"function addPages () {\n var PAGE_SIZE = 842,\n PAGE_START = 25 + 25;\n PAGE_BREAK_HEIGHT = 50,\n PAGE_BREAK_MARGIN_TOP = 50,\n PAGE_BREAK_MARGIN_BOTTOM = 100;\n console.log('addPages', $(Preview.dom).height());\n\n var pagePos = $(Preview.dom.querySelector('.akomaNtoso')).offs... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
href strip for ie6, 7 | function stripHref(href) {
return href && href.replace(/.*(?=#[^\s]*$)/, "");
} | [
"function removeUrlAnchor(url){\n return url.split('#')[0];\n}",
"function fixLinks() {\n for (var a of document.getElementsByTagName(\"a\")) {\n var href = a.href;\n if (href.baseVal) {\n var label = href.baseVal;\n if (label.includes(\"#mjx-eqn\")) {\n label = ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Disposes of all objects returned by createLights, createCamera, createShadows, createSkybox | async dispose() {
if ( this.camera ) {
this.camera.dispose();
this.camera = null;
}
if ( this.skyBox ) {
this.skyBox.dispose();
this.skyBox.material.dispose();
this.skyBox = null;
}
if ( this.light ) {
this.light.dispose();
this.light = null;
}
... | [
"destroyEffects() {\n this._magView.clear_effects();\n this._colorDesaturation = null;\n this._brightnessContrast = null;\n this._inverse = null;\n this._magView = null;\n }",
"detach() {\n this.surface = null;\n this.dom = null;\n }",
"function dispose() {\n\n if... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get the marks that would be added to text at the current selection. | marks(editor) {
var {
marks,
selection
} = editor;
if (!selection) {
return null;
}
if (marks) {
return marks;
}
if (Range.isExpanded(selection)) {
var [match] = Editor.nodes(editor, {
match: Text.isText
});
if (match) {
var [_nod... | [
"marks(editor) {\n var {\n marks,\n selection\n } = editor;\n\n if (!selection) {\n return null;\n }\n\n if (marks) {\n return marks;\n }\n\n if (Range.isExpanded(selection)) {\n var [match] = Editor.nodes(editor, {\n match: Text.isText\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Request the roster from the Google identity query service | function request_google_roster() {
var roster_elem = new xmpp.Element('iq', { from: conn.jid, type: 'get', id: 'google-roster'})
.c('query', { xmlns: 'jabber:iq:roster', 'xmlns:gr': 'google:roster', 'gr:ext': '2' });
conn.send(roster_elem);
} | [
"async getUserOrganisation() {\n let userId = await getUserId()\n if (userId != 0) {\n var url = `api/userorganisation?userId=${userId}`;\n return Method.dataGet(url, token)\n }\n }",
"static get(id){\n\t\tlet kparams = {};\n\t\tkparams.id = id;\n\t\treturn new kaltura.RequestBuilder('reach_re... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
FUNCTION THAT INSERTS A BLOCK IN THE DB | async function createBlock(block){
await DBBlock.insertMany(block);
} | [
"static insertDataIDB(tableName, data) {\n\n return DBHelper.openDB().then(function(db) {\n\n let tx = db.transaction(tableName, 'readwrite');\n let store = tx.objectStore(tableName);\n //console.log(store);\n //console.log('Inserting in IDB: ' + data);\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates the tabs for the different environments | function createTabs() {
let tabsDiv = $("#tabsDiv");
for (let i = 0; i < ENVIRONMENTS.length; i++) {
let environment = ENVIRONMENTS[i];
let link = $("<a href='#'>" + environment.text + "</a>");
link.data({"index": i});
link.on('click', newTabSelected);
tabsDiv.append(link);
}
} | [
"function createTabCtrl(meta) {\n \n }",
"function addTabs(tabs, scope) \n{\n var list = $('<ul class=\"nav nav-tabs\" role=\"tablist\"></ul>');\n var div = $('<div class=\"tab-content\"></div>');\n var active = 'active';\n $.each( tabs, function( i, name ) {\n list.append('<li class=\"nav-... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This function improves the efficiency of GitHub synchronization. It queries the database for a "lastpolled" document for each repository in the watchlist. If none exists, gitstats will pull stats for the repo since "the beginning of time"; otherwise, it will only pull stats beginning at the date indicated in the lastpo... | function get_lastpolled(repo) {
var deferred = new Promise(function(resolve, reject) {
var doc = {};
var opts = clone(optionsdb);
opts.method = 'GET';
opts.path += '/' + repo.replace(/\//g, '---');
var result = {};
result.date = '1970-01-01T00:00:00Z'; // default to e... | [
"async function fetchCommitsSinceLastRelease (repo, tag, published) {\n return await new Promise((resolve, reject) => {\n if (!tag || !published) {\n console.log('NONE:\\t \\x1b[31m%s\\x1b[0m', repo, tag, published);\n resolve();\n }\n\n https.get({\n auth: this.credentials.login + ':' + th... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
input a debuffType and set debuff | addDebuff(debuff) {
//if enemy is died no debuff
if (this.health <= 0) {
return;
}
if (debuff == debuffType.FIRE) {
this.fired = debuff;
this.debuffAnimationInit();
return;
}
// NORMAL cannot override other debuff
i... | [
"function SetDragDropPayload(type, data, cond = 0) {\r\n _ImGui_DragDropPayload_data[type] = data;\r\n return bind.SetDragDropPayload(type, data, 0, cond);\r\n }",
"function write2BleClient(type, data) {\n let obj = {\n cmdtype: type,\n cmdData: data\n };\n if (bleClientSoc... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Remove all .card elements that are marked as done. | function deleteAllDone() {
$(".card").filter(".done").remove();
} | [
"function clearCards() {\n for (let [id, card] of cards.entries()) {\n card.removeEvents(id)\n }\n $(\"#deck-display\").empty()\n cards.clear()\n idCounter = 1\n }",
"function removeFailed() {\n\n let allCards = cardsBox.children;\n for (let i = 0; i < allCards.length; i++) {\n allCards[... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Parameters for copy_text_to_clipboard text: The text to copy to the clipboard. strip_html: If there are HTML tags in the text, and this option is set, then those tags will be stripped. ('s and 's will be converted to line returns.) Return value: False if copy doesn't work. True if it does. Although, Mozilla will return... | function copy_text_to_clipboard(text, strip_html){
if (!text){
alert("No text provided to copy_text_to_clipboard to copy.");
return false;
}
if (window.clipboardData) { // Internet Explorer
try{
if (strip_html){
// You should probably use IE's innerText here instead, and set strip_htm... | [
"function copy_element_to_clipboard(element, strip_html){\n if (!element){\n alert('Element not found for copy action in copy_element_to_clipboard.');\n return false;\n }\n\n if (typeof(element.selectedIndex) != \"undefined\"){\n // select box.\n\n if (element.multiple){\n var selected_options =... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Routes are prepared into three temp files: `routesConfig`, the route config passed to reactrouter. This file is kept minimal, because it can't be codesplitted. `routesChunkNames`, a mapping from route paths (hashed) to codesplitted chunk names. `registry`, a mapping from chunk names to options for reactloadable. | function loadRoutes(routeConfigs, baseUrl, onDuplicateRoutes) {
handleDuplicateRoutes(routeConfigs, onDuplicateRoutes);
const res = {
// To be written by `genRouteCode`
routesConfig: '',
routesChunkNames: {},
registry: {},
routesPaths: [(0, utils_1.normalizeUrl)([baseUrl,... | [
"_register(config, routes, parentRoute) {\n routes = routes ? routes : this._routes;\n for (let i = 0; i < config.length; i++) {\n let { onEnter, onExit, path, outlet, children, defaultRoute = false, defaultParams = {} } = config[i];\n let [parsedPath, queryParamString] = path.sp... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Set up channel after it has been found | function setupChannel() {
// Join the general channel
generalChannel.join().then(function(channel) {
print('Joined channel as <span class="me">' + username + '</span>.', username, new Date());
});
// Listen for new messages sent to the channel
generalChannel.on('messageAdded', function(messag... | [
"createChannel() {\n\t\tlet depends = this.props.depends ? this.props.depends : {};\n\t\tvar channelObj = manager.create(depends);\n\n\t}",
"function idToChannel() {\n updateConfig()\n setTimeout(() => {\n AddChannel()\n }, 1000);\n }",
"createChannel(executeChannel = false) {... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Deteccion de los choques ballWallCollision | function ballWallCollision(){
if(ball.x + ball.radius > cvs.width || ball.x - ball.radius < 0){
ball.dx = - ball.dx;
choque.play();
}
if(ball.y - ball.radius < 0){
ball.dy = -ball.dy;
choque.play();
}
if(ball.y + ball.radius > cvs.height){
vidas-... | [
"function detectCollision() {\r\n for(let c=0; c<brickCols; c++) {\r\n for(let r=0; r<brickRows; r++) { // looping through 2 d list to check all brick objects\r\n let b = bricks[c][r];\r\n if(b.status == 1) { // status refers to if it is alive or not. 1 = alive.\r\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
For a given bucket and group, how many reqs are there? | function getReqGroupSize(bucket_id, group_id){
if (!this.is_job) return null;
var count = 0;
for (var rid in this.requirements){
var r = this.requirements[rid];
if (r.bucket_id != bucket_id || r.group_id != group_id) continue;
count++;
}
return count;
} | [
"function getCurrentReqGroup(bucket_id){\n\tif (!this.is_job) return null;\n\n\tvar group_count = this.getReqGroupCount(bucket_id);\n\n\tvar max_group_id = 1;\n\tfor (var group_id=1; group_id<=group_count; group_id++){\n\t\tvar group_size = this.getReqGroupSize(bucket_id, group_id);\n\n\t\tvar complete_count = 0;\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gnuplot version 4.6.0 short forms of commands provided by gnuplot_common.js | function DT (dt) {gnuplot.dashtype(dt);} | [
"function plot(func, atts) {\n if (atts==null) { return addCurve(board, func, {strokewidth:2});\n } else { return addCurve(board, func, atts); } \n }",
"function plot(can,ctx,x,y,xwidth,ywidth,options){\n\n}",
"function usageString(cmd, style) {\n var com = COMMANDS[cmd];\n var usage = (st... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
used to play and pause the song using a button | function togglePlaying(){
if (!song.isPlaying()){
song.loop();
song.setVolume(1);
button.html("pause");
} else{
song.pause();
button.html("play");
}
} | [
"pauseSong() {\n this.paused = true;\n pauseSpin();\n currAudio.pause();\n }",
"function playButtonSound() { \nsound.src = 'music/click.mp3'\nsound.play() }",
"function playTrack() {\n\n curr_track.play();\n isPlaying = true;\n playpause_btn.innerHTML = '<i class=\"fa fa-pause-circle fa-5x\">... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Undo/Redo code should only attach the key listener event if the undo/redo divisions are present. | function UndoRedo(e) {
var evtobj = window.event ? event : e
if (evtobj.keyCode == 90 && evtobj.ctrlKey) {
var rdAllowUndo = rdGetCookie("rdAllowUndo")
var divUndo = document.getElementById('divUndoEnabled');
if (rdAllowUndo == "True" && divUndo)
divUndo.click();
}
... | [
"function input_character_keys(key_array_index, event_type, character_key_index, key_code) {\r\n\tkey_array[key_array_index].addEventListener(event_type, function(event) {\r\n\t\tif (event_type == \"keydown\" && document.getElementById(\"mirrored_textarea\") != document.activeElement) {\r\n\t\t\tif (event.key === ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates a new FirebaseTokenVerifier to verify Firebase ID tokens. | function createIdTokenVerifier(app) {
return new FirebaseTokenVerifier(CLIENT_CERT_URL, 'https://securetoken.google.com/', exports.ID_TOKEN_INFO, app);
} | [
"function AuthToken($window){\n var authTokenFactory = {}\n\n //get the token out of local storage\n authTokenFactory.getToken = function(){\n return $window.localStorage.getItem('token')\n }\n\n //set the token or clear the token\n authTokenFactory.setToken = function(token){\n if(token)\n $window... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |