query stringlengths 9 34k | document stringlengths 8 5.39M | negatives listlengths 19 20 | metadata dict |
|---|---|---|---|
Parameters: url string containing the url to convert Returns: string containing the converted url to match the protocol of the current document | function convertToCurrentProtocol(url)
{
if(url && url.replace)
{
url = url.replace(/http[s]?:/i, document.location.protocol);
}
return url;
} | [
"function urlAdjust(url, fp) {\r\n\t\treturn fp && url.indexOf('//') == 0 ? protocolForFile + url : url;\r\n\t}",
"function processUrlTemplate(url, document_ = document) {\n const scriptUrl = currentScriptUrl(document_);\n if (scriptUrl) {\n url = url.replace('{current_host}', scriptUrl.hostname);\n url =... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
here the i in this loop gives me only the number of the index, but not actually the content of the position. this is why I have to change it to boldSelect[i]) | function getBold_items(){
for (let i = 0; i < boldSelect.length; i++){
boldWords.push(boldSelect[i].textContent);
} console.log(boldWords);
} | [
"function index_after_formatting(position) {\n\t var start = position === 0 ? 0 : position - 1;\n\t var command_len = $.terminal.length(command);\n\t for (var i = start; i < command_len - 1; ++i) {\n\t var substr = $.terminal.substring(command, 0, i);\n\t ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
get sum of points column NB: uses Q.defer as this is an async call, eventually we should implement it everywhere | function getPointSum(){
var deferred = $q.defer();
db.transaction(function(tx){
tx.executeSql('SELECT sum(points) AS sumPoints FROM activities', [], function(tx,results){
var tot = results.rows.item(0).sumPoints;
deferred.resolve(tot);
});
... | [
"function getCategoryTotalPoints(category){\n let htmlPath = \" > td.possible.points_possible\"; //HTML path to get to the total points within the table data (td)\n return sumTablePortion(htmlPath, category);\n}",
"function getTotalPoints() {\n\tvar totalPoints = window.currentBuild.traits.line1.total\n\t\t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns true if the provided property is a Placeholder component from Belle. | function isPlaceholder(reactElement) {
return (0, _isComponentOfType2.default)(_Placeholder2.default, reactElement);
} | [
"isEmpty(patternProperty) {\n if ((patternProperty = \"\")) {\n return true;\n } else {\n return false;\n }\n }",
"placeholderHidden() {\n return !!(this.labels.length > 0 || this.value);\n }",
"check(abstract) {\n let resolved_abstract = this.resolveAbstract(abstract);\n if ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
instantiates selector, which is first called in Engine.js before init() | function startLoad() {
selector = new Selector();
} | [
"createSelector() {\n\t\t// Add a selector icon and scales it\n\t\tthis.selector = this.add.image(32, 32, 'selector');\n\t\tthis.selector.alpha = 0;\n\n\t\t// Listen to mouse movement\n\t\tthis.input.on('pointermove', function (pointer) {\n\t\t\t// Grabs mouse position & divide by 64 (To get index of array)\n\t\t\t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Remove this entity from the game world completely, and allow it to be GCed. Any specific destruction functionality should be added to onDestroy, which is called from this method. | destroy() {
// Prevent multiple destruction of entities.
if (this._destroyed === true) return;
this._destroyed = true;
this.onDestroy();
} | [
"function Cleanup_Entities() {\n\tfor(var k in game.ents) {\n\t\tif(game.ents[k].remove) {\n\t\t\t// Entity should clean up its own game.ents index when remove is called\n\n\t\t\t// It's important not to forcably remove from game.ents in case \n\t\t\t// to do a cleanup for some reason after its removal is signaled\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
funcion encargada de crear un icono con el url y size pasados como parametro | function iconsMaker(url, size) {
var icon = L.icon({
iconUrl: url,
iconSize: [size, size],
iconAnchor: [22, 94],
shadowAnchor: [4, 62],
popupAnchor: [-3, -76]
});
return icon;
} | [
"function GoogleThumbSetSizes(level, startI, tn, data, kind ) {\r\n var sizes=['xs','sm','me','la','xl'];\r\n \r\n for(var i=0; i<sizes.length; i++ ) {\r\n tn.url[level][sizes[i]]=data.media$group.media$thumbnail[startI+i].url;\r\n if( kind == 'image' ) {\r\n tn.width[level][si... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Walks entirety of an html node's downstream tree and returns Set of nodes it finds. root is node | null found is Set of matching nodes | function crawlNode(root, found = new Set()) {
const predicate = (node) => node && node.tagName === 'VIDEO'
if (!root || !root.childNodes) {
return found
}
if (predicate(root)) {
found.add(root)
}
return Array.from(ro... | [
"function findAndAdd(n, matches) {\n\tif (! n || ! n.parentNode) return;\n\tif (! matches) matches = function(n) { return true; };\n\tvar df = document.createDocumentFragment();\n\tcollectNodes(n, matches, df);\n\t// for (var i=0; i<df.childNodes.length; i++) {\n\t//\tconsole.log(df.childNodes[i]);\n\t// }\n\tn.par... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Adds the rating buttons to posts where the most received rating is known | function addRatingButtons( ratings )
{
var postLinkSections = document.getElementsByClassName( "postlinking" );
var icons = { "agree": "tick", "disagree": "cross", "funny": "funny2", "winner": "winner", "zing": "zing", "informative": "information", "friendly": "heart", "useful": "wrench", "optimistic": "rainbow... | [
"function populateRatingElements(selector, value)\n {\n selector.children(base.options.elementType).each(function()\n {\n if (IsNullOrEmpty(value) || $(this).data(\"data-count\") > value)\n {\n $(this).css(base.options.ratingCss);\n }\n else\n {\n $(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Put film photo on overlay | function showFilm(item) {
var displayPoster = item.children("img").attr("src");
$('#slideShow').attr("src", displayPoster);
//Use movie ID to look up plot
var displayID = item.children("p").first().text();
var displayTitle = item.children("h3").text();
var displayYear = item.children("p").last().text();
... | [
"function addOverlay() { \n imgOverlay.setMap(map);\n}",
"function loadPredefinedPanorama( ) {\n\tvar evt=window.event;\n\tevt.preventDefault();\n var div = document.getElementById('container');\n\tvar PSV = new PhotoSphereViewer({\n\tpanorama: 'house.jpg',\n container: div,\n\t\ttime_anim: false,\n\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Internal `_.pick` helper function to determine whether `key` is an enumerable property name of `obj`. | function keyInObj(value, key, obj) {
return key in obj;
} | [
"function isObjectAssignable(key) {\n return typeof key === 'string' || typeof key === 'number' || typeof key === 'symbol';\n}",
"function hasProps(keys, x) {\n if(!isFoldable(keys)) {\n throw new TypeError(err)\n }\n\n if(isNil(x)) {\n return false\n }\n\n var result = keys.reduce(\n every(hasKe... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
the callback function to be run when the response comes in. this callback assumes a chunked response, with several 'data' events and one final 'end' response. | function callback(response) {
var result = ''; // string to hold the response
// as each chunk comes in, add it to the result string:
response.on('data', function (data) {
result += data;
});
// when the final chunk comes in, print it out:
response.on('end', function () {
console.log('r... | [
"function handleEnd(dataChunked) {\n\t\t\t\ttry {\n\t\t\t\t\tcontent = JSON.parse(dataChunked);\n\t\t\t\t\tcallback(content);\n\t\t\t\t} catch(ex) {\n\t\t\t\t\tthrow new Error(ex);\n\t\t\t\t}\n\t\t\t}",
"onXHRComplete(inName, inResponse) {\n\t\tconsole.debug(`Loaded raw audio data for '${inName}', doing decode...... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
instantiatePopper Creates the instance of a popper and repositions it by calling updating state.data with the new position data returned by the create() and update() callbacks | instantiatePopper() {
const modifiers = {
offset: {
offset: this.props.offsets
}
};
this._popper = new PopperJs(this._tooltipTriggerRef, this._tooltipPopupRef, {
placement: this.props.placement,
modifiers,
onCreate: data => this.setState({ data }),
onUpdate: data ... | [
"function attachPopper(anchor, element) {\n if (popper !== null) {\n popper.destroy();\n }\n\n popper = new Popper(anchor, element, {\n placement: 'auto-start',\n modifiers: {\n preventOverflow: {\n enabled: true,\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
The value of the current property is always the final element of this.stack. | getValue() {
return getLast(this.stack);
} | [
"popValue() {\n let size = this.stack.pop().size;\n this.write(\"[-]<\".repeat(size));\n }",
"peek(){\n\n if(!this.top){\n return 'Stack is empty.';\n\n }\n try{\n return this.top.value;\n } \n catch(err){\n return 'Stack is empty.';\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Jump to the bottom of a node. | function scrollToBottom(node) {
node.scrollTop = node.scrollHeight - node.clientHeight;
} | [
"function scrollToBottom () {\n endRef.current.scrollIntoView({ block: 'end', behavior: 'smooth' })\n }",
"scrollToBottom() {\n this.tableBodyNode.scrollTop = this.tableBodyNode.scrollHeight;\n }",
"function scrollToBottom() {\n $('#messages-bottom')[0].scrollIntoView();\n }",
"function scro... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Call from Flex if subtitle upload was failed | function setSubtitleUploadFailedFromFlex(jobHash) {
console.log("Subtitle upload faile");
$("#Uploaded_subtitle_" + jobHash).val("0");
} | [
"function changeBackgroundVideoFileError(message) {\r\n changeBackgroundVideoContentError(message, liveBackgroundType);\r\n}",
"function changeBackgroundFlixerVideoFileErrorToPage(message) {\r\n changeBackgroundVideoContentError(message, flixelBackgroundType);\r\n}",
"onAudioLoadError(e) {\n //swal(\"a... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Checks the status of MTA services. (only subway rn.) First checks a local cache of the data. Fetches the status via html scraping, if cache expired or unavailable. | function checkStatus() {
return new Promise((resolve, reject) => {
getStatusFromCache()
.then(function(data) {
resolve(data);
})
.catch(function(err) {
resolve(scrapeStatus());
});
});
} | [
"function scrapeStatus() {\n return new Promise((resolve, reject) => {\n request(mtaStatusUrl, (err, response, responseHtml) => {\n if (err) {\n reject(err);\n }\n\n const $ = cheerio.load(responseHtml);\n\n let results = {\n subway... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
show node in table or show success message | function showNodeOrMessage() {
var update = false;
status.collection.forEach(function (item) {
if (item.get("id") === newNode.get("id")) {
item.set(newNode.attributes);
update = true;
}
});
if (!update) {
... | [
"function showNodeData(d) {\n var object ={};\n object.name = d.name.toString(); // transform to string or it will show and array\n object.type = d.type;\n object.solvers = d.solvers;\n object.status = d.status;\n\n var ppTable = prettyPrint(object);\n document.getElementById('d6_1').innerHTML ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function to edit a subshape. | function show_shape_edit(shape_key, subshape_index) {
let div, i;
let dom_element = (subshape_index == 0) ? data_editor.dom.edit : data_editor.dom.edit2;
DOM.removeChilds(dom_element, true);
DOM.cdiv(dom_element, null, "edit_title", "SubShape " + subshape_index);
if(subshape_index in data_editor.d... | [
"function editShapes(shapes, editPart) {\n for (var i=0, n=shapes.length; i<n; i++) {\n shapes[i] = editShapeParts(shapes[i], editPart);\n }\n}",
"function refactorShape(id){\r\n\tsciMonk.viewStack.pop();\r\n\tsciMonk.placementType = \"shape\";\r\n\tsciMonk.currentShape.shape = sciMonk.currentModel.shapes[id... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
highlight the map marker for a particular station... | function highlightStationMap(station) {
console.log(station);
m = locData.get(station).marker;
m.setMap(null);
m.icon = highlightedMapIcon;
m.setMap(map);
} | [
"function highlight(lat,lng,year,title=null){\r\n\tsetMapOnAll(null);\r\n\tvar index = [lat,lng];\r\n\tx = (year/2) + 350;\r\n\tmovehair(x);\r\n\tvar marker = new google.maps.Marker({\r\n position: new google.maps.LatLng(lat, lng),\r\n title: title,\r\n map: map,\r\n icon... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
TODO: Rename to make it clear that this is used to check if account can be created and that it throws. requireAccountNotExists? | async checkNewAccount(accountId) {
if (!this.isLegitAccountId(accountId)) {
throw new Error('Invalid username.');
}
// TODO: This check doesn't seem up to date on what are current account name requirements
// TODO: Is it even needed or is checked already both upstream/downst... | [
"async shouldRequestAccountName() {\n return false;\n }",
"async function maybeCreateAccount(\n near,\n masterAccountId,\n accountId,\n accountPK,\n initBalance,\n contractPath\n) {\n if (!(await accountExists(near, accountId))) {\n console.log('Account %s does not exist creating it.', accountId)\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
StructuredHeadingsManager ========================= A heading structure management object that makes it easier for a user to structure the headings in a document by simplifying the user interface and adding features such as heading numbering. | function StructuredHeadingsManager(options, wym) {
var shm = this;
options = jQuery.extend({
headingIndentToolSelector: "li.wym_tools_indent a",
headingOutdentToolSelector: "li.wym_tools_outdent a",
enableFixHeadingStructureButton: false,
fixHeadingStructureButtonHtml: String() ... | [
"function headingRule(n) {\n\t var type = MarkupIt.BLOCKS['HEADING_' + n];\n\t return HTMLRule(type, 'h' + n);\n\t}",
"function tocSetupHeadingClasses() {\n\n\tfunction getDepth(element, currentDepth=0) {\n\t const elemParent = tocGetParent(element);\n\t if (elemParent) {\n\t\treturn getDepth(elemPare... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Keydown event for edit controls | function SEC_onEditControlKeyDown(event){SpinEditControl.onEditControlKeyDown(event);} | [
"function SEC_onEditControlKeyUp(event){SpinEditControl.onEditControlKeyUp(event);}",
"function ODBInlineEditKeydown(event, p, path, bracket) {\n var keyCode = ('which' in event) ? event.which : event.keyCode;\n\n if (keyCode == 27) {\n /* cancel editing */\n p.ODBsent = true;\n p.inEdit = fals... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
A basic binding to value, our base class | function Binding(value){
this.value= value;
if(value){
value._binding = this;
}
} | [
"updateBoundVariable(value) {\n let binddatavalue = this.binddatavalue;\n // return if the variable bound is not static.\n if (this.datavaluesource && this.datavaluesource.execute(DataSource.Operation.IS_API_AWARE)) {\n return;\n }\n else if (this.datavaluesource && !th... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
renderNavigationBar Pass props to the React Native Router Flux NavBar | static renderNavigationBar(props) {
return <NavBarWithProps {...props}/>;
} | [
"render(){\n return(\n <div className=\"bar-item\" style={navBarItemStyle}>\n {this.props.children}\n </div>\n );\n }",
"function renderNav() {\n var page = 'pages/menu';\n getPage(page, false, navContainer, false);\n }",
"render()... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Transform a `:try` type to a `:maybe` value. | function maybe(t) /* forall<a> (t : try<a>) -> maybe<exception> */ {
return (t._tag === 1) ? Just(t.exception) : Nothing;
} | [
"function maybe_3(m, nothing) /* forall<a> (m : maybe<a>, nothing : a) -> a */ {\n return $default(m, nothing);\n}",
"function maybe_6(b) /* (b : bool) -> maybe<()> */ {\n return (b) ? Just(_unit_) : Nothing;\n}",
"function Maybe(value){ \n this.value = value;\n }",
"function maybe_7(i) ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Inverse Operation Handlers Computes and displays the transpose of a matrix. | handleTranspose() {
const matrix = this.getMatrices(this.getSelectValue("transpose"));
if (matrix !== null) {
const transpose = matrix.transpose();
this.displayResults("Transpose", matrix, "=", transpose);
}
} | [
"handleInverse() {\n const matrix = this.getMatrices(this.getSelectValue(\"inverse\"));\n if (matrix !== null) {\n const inverse = matrix.inverse().last();\n if (inverse.equals(matrix)) {\n this.displayResults(\"Inverse\", matrix, \"=\", \"This matrix is not invertible.\");\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Renders the AWS CloudFormation properties of an `AWS::AppMesh::VirtualNode.BackendDefaults` resource | function cfnVirtualNodeBackendDefaultsPropertyToCloudFormation(properties) {
if (!cdk.canInspect(properties)) {
return properties;
}
CfnVirtualNode_BackendDefaultsPropertyValidator(properties).assertSuccess();
return {
ClientPolicy: cfnVirtualNodeClientPolicyPropertyToCloudFormation(prop... | [
"function cfnVirtualGatewayVirtualGatewayBackendDefaultsPropertyToCloudFormation(properties) {\n if (!cdk.canInspect(properties)) {\n return properties;\n }\n CfnVirtualGateway_VirtualGatewayBackendDefaultsPropertyValidator(properties).assertSuccess();\n return {\n ClientPolicy: cfnVirtual... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
ToLL function to compute Latitude and Longitude given UTM Northing and Easting in meters Description: This member function converts input north and east coordinates to the corresponding Northing and Easting values relative to the defined UTM zone. Refer to the reference in this file's header. Parameters: north (i) Nort... | function ToLL(north,east,utmZone)
{
// This is the lambda knot value in the reference
var LngOrigin = DegToRad(utmZone * 6 - 183)
// The following set of class constants define characteristics of the
// ellipsoid, as defined my the WGS84 datum. These values need to be
// changed if a different dataum is us... | [
"function getLongitude(input) {\n // we know input is validated so we know we can go from North/South to the end\n var search = input.search(/[NS]/);\n\n var longitude = \"\";\n if (search == -1) {\n longitude = input.substr(input.search(' '));\n } else {\n longitude = input.substring(search + 1);\n }\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Not done yet. I want add it so this assertresultlength can take parameters besides a number, equals, greater than, small than. | testAssertResultLength() {
} | [
"function testRecordLength(that, test) {\n\n // get records length from the w2ui's grid record\n var w2uiRecordLength = casper.evaluate(function (gridName) {\n return w2ui[gridName].records.length;\n }, that.grid);\n\n\n // Check w2ui records length match with length with api ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Pre: array of message objects Post: null Purpose: prints out messages for user in chat | function printMessages( /*Array<Object>*/ arr) {
arr.map(msg => {
if (msg[1] === 'ALL' || msg[0] === window.username && msg[1] === window.username) {
print(msg[3], msg[0], msg[2] * 1000);
if (!document.hasFocus()) {
new Notification(`New Message from ${msg[0]}`, {
... | [
"function showchats(target, context) {\r\n var viewer = context.username;\r\n\r\n var i = 0;\r\n while (i <= viewerObj.length) {\r\n if (viewerObj[i] == viewer) {\r\n sendMessage(target, context, context.username + ' has chatted ' + chatObj[i] + ' times!');\r\n console.log(\"vi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Getting the next number for a hexagon | function getNextNumber (numberCount, hexagonIndex, robberIndex) {
if (hexagonIndex === robberIndex) {
return '' // Desert tile has no number, robber starts on desert
}
var random = Math.floor(Math.random() * numberCount.length)
var toReturn = numberCount[random]
numberCount.splice(random, 1)
return toRe... | [
"function positionHexagon() {\r\n //CANTIDAD DE HEXAGONOS\r\n var espacio = [1, 1, 1]; //Cantidad de exagonos en una linea\r\n\r\n //POSICION DE HEXAGONOS \r\n hexagon = document.querySelectorAll(\"li.hexagon\");\r\n width_hexagon = parseInt($(hexagon[0]).css(\"width\"));\r\n separation = 2; //Dis... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
b % w , q = b / w :: BigNat > BigNat > Word > Word | function h$ghcjsbn_quotRem_bw(q, b, w) {
h$ghcjsbn_assertValid_b(b, "quotRem_bw");
h$ghcjsbn_assertValid_w(w, "quotRem_bw");
var a = h$ghcjsbn_tmp_2a;
h$ghcjsbn_toBigNat_w(a, w);
/* if(w === 0) {
a[0] = 0;
} else if(w > 0 && w <= GHCJSBN_MASK) {
a[0] = 1;
a[1] = w;
} else {
a[0] = 2;
a[... | [
"function inWord(bit) {\n return Math.floor((bit | 0) / 32);\n }",
"function hs_wordToWord64(low) {\n return [0, low];\n}",
"static uint104(v) { return n(v, 104); }",
"static uint80(v) { return n(v, 80); }",
"function __div64(q, r, u, v) {\n var m = u.countSignificantDigi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
builds model tree recursively | function _buildModelTreeRec(node) {
instanceTree.enumNodeChildren(node.dbId, function (childId) {
var childNode = null;
if (createNodeFunc) {
childNode = createNodeFunc(childId);
} else {
node.children = node.children || [];
childNode = {
... | [
"deserialiseTree($scope) {\n\n var models = {\n folders: {\n\n }\n };\n\n _.forEach(this.folders, _.bind(function(folder, i) {\n var folderId = folder.id;\n\n models.folders[folderId] = _.filter(this.documents, {'folderId':\n folder.id});\n\n // tree.push({\n // id: i... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Transform a unit spec with composite mark into a normal layer spec. | function normalize(
// This GenericUnitSpec has any as Encoding because unit specs with composite mark can have additional encoding channels.
spec, config) {
var mark = mark_1.isMarkDef(spec.mark) ? spec.mark.type : spec.mark;
var normalizer = normalizerRegistry[mark];
if (normalizer) {
return norma... | [
"function convertSpec(spec) {\n // get data\n let baseData = convertBaseSpec(spec.baseSpec);\n let alignType = spec.alignType ? AlignType[spec.alignType] : AlignType.Center;\n let extraOffset = spec.extraOffset ? Point.from(spec.extraOffset) : new Point(0, 0);\n let ad = {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Includes the JavaScript file located at 'jsFilePath' | function includeJs (jsFilePath) {
var js = document.createElement("script");
js.type = "text/javascript";
js.src = jsFilePath;
document.body.appendChild(js);
} | [
"function includeJS(file_path){ \r\n var j = document.createElement(\"script\");\r\n j.type = \"text/javascript\";\r\n j.onload = function(){\r\n lib_loaded(file_path);\r\n };\r\n j.src = file_path;\r\n document.getElementsByTagName('head')[0].appendChild(j); \r\n}",
"function addJs( sr... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
findUnconnectedPreds(label) Returns the position of the excluded predicate or 1 if it is not found. label = predication label to compare against the unconnectedPreds list for the current summarization schema. | function findUnconnectedPreds(label) {
for (var j = 0; j < selection.summarization.unconnectedPreds.length; j++) {
if (selection.summarization.unconnectedPreds[j] == label) {
return j;
}
}
return -1;
} | [
"function getAppearedLabels(){\n\tvar arr = [] \n\tfor (var i = 0; i<labels.length; i++) {\n\t\tarr.push(labels[i].name.label);\n\t}\n\tvar appearedLabelsUnsort = arr.filter( onlyUnique );\n\t// manually add \"treeSphere\" and \"treeCube\" as their names are saved as \"vegetation\"\n\tappearedLabelsUnsort.push('tre... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
The sequenceid is incremented with each packet and may wrap around. It starts at 0 and is reset to 0 when a new command begins in the Command Phase. | _resetSequenceId() {
this.sequenceId = 0;
this.compressedSequenceId = 0;
} | [
"nextMessageId() {\n this.messageId += 1;\n return this.messageId;\n }",
"function sequenceNo(frame) {\n return frame.attr(\"id\");\n}",
"function getNextPID() {\n DropballEntityPIDInc = DropballEntityPIDInc + 1;\n return DropballEntityPIDInc;\n }",
"getID() {\r\n return th... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns a random p5 color | static randomP5Color(hasRandomAlpha: boolean = false): $FlowIgnore {
return w.color(Color.randomRGBATuple(hasRandomAlpha));
} | [
"function randomColorGenerator() {\n\t\treturn Math.floor(Math.random() * backgroundColors.length);\n}",
"static Random() {\n return new Color3(Math.random(), Math.random(), Math.random());\n }",
"function colorTarget() {\n let colorPicked = Math.floor(Math.random() * colors.length);\n retur... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function to update cursor position in the dom | function updateCursorPosition(left, top) {
cursor.style.left = `${left}px `;
cursor.style.top = `${top}px`;
cursor.scrollIntoView({
behavior: "smooth",
block: "center",
inline: "center",
});
} | [
"__refreshCursor() {\n var currentCursor = this.getStyle(\"cursor\");\n this.setStyle(\"cursor\", null, true);\n this.setStyle(\"cursor\", currentCursor, true);\n }",
"function resetCursorPos(element) {\n element.selectionStart = 0;\n element.selectionEnd = 0;\n }",
"updateCar... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Whether any dimension in gO has a dynamic size | function hasDynSize(gO) {
for (var d = 0; d < gO.numDims; d++) {
if (gO.dimDynSize[d]) {
logMsg("has dyn size");
return true;
}
}
return false;
} | [
"isFull() {\n return this.size == this.maxSize;\n }",
"isFull() {\r\n\t\treturn (this.emptyCells.size() == 0);\r\n\t}",
"function allocAnyDynamicGrid(mO, fO, sO) {\r\n\r\n var out_id = 0; // grid id of output grid\r\n\r\n var gId = sO.allGridIds[out_id];\r\n var gO = fO.allGrids... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function ready() creates an object which stores the respective number of wins, losses, and draws. Also, it adds an event listener to each of the images which calls evaluateChoice(playerChoice, scoreboard) and passes "rock", "paper", or "scissors" depending on the image that's clicked. Precondition: The webpage's fully ... | function ready()
{
// Create an object that'll store the number of wins, losses, and draws, respectively.
const scoreboard =
{
wins: 0,
losses: 0,
draws: 0
};
/*
Add an event listener to each of the choices that'll pass a respective string
value to evaluate... | [
"function evaluateChoice(playerChoice, scoreboard)\n{\n // Create a variable that'll store the cpu's choice.\n let cpuChoice = generateCPUChoice(); // Stores \"rock\", \"paper\", or \"scissors\"\n\n // Evaluate whether both choices result in the player winning, losing, or drawing.\n switch (playerChoice... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
get module by package id like require(id) | function getModuleByID(id, requireIfNotExists, req = require) {
if (id === '.') {
return getMainModule(id);
}
return getModuleByFile(req.resolve(id), requireIfNotExists, req);
} | [
"function createRequire(requirer) {\n return function require(id) {\n // Make sure an id was passed.\n if (id === undefined) {\n throw new Error(\"can't require module without id!\");\n }\n\n // Built-in modules are cached by id rather than URL, so try to find the\n // module to b... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates the arcgis.events collection by constructing event objects using the raw response objects from the arcgis.raw collection. | function createEventsFromRaw() {
return new Promise((resolve, reject) => {
const query = {};
const sourceDbUrl = WILDFIRE_CONFIG.PRIMARY_MONGODB_URL;
const sourceDbName = "arcgis";
const sourceCollectionName = "raw";
const outputDbUrl = WILDFIRE_CONFIG.PRIMARY_MONGODB_URL;
... | [
"events() {\n return new OpenFDADrugEvents(this.api);\n }",
"function collectAllEvents() {\n // A set for all calendar events displayed on the UI.\n // Each element in this set is a Json string. \n allEventJson = new Set(); \n \n const eventList = document.getElementById('new-event-list');\n \n //... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Visit a parse tree produced by PlSqlParserrename_column_clause. | visitRename_column_clause(ctx) {
return this.visitChildren(ctx);
} | [
"function _renameColumn(){\n self._visitingAlter = true;\n var table = self._queryNode.table;\n var result = [\"EXEC sp_rename '\"+\n self.visit(table.toNode())+'.'+self.visit(alter.nodes[0].nodes[0])+\"', \"+\n self.visit(alter.nodes[0].nodes[1])+', '+\n \"'COLUMN'\"\n ];\n self._visitingAl... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
EventItem This is an item that wraps a ZeitgeistItemInfo, which is in turn created from an event as returned by the Zeitgeist DBus API. | function EventItem (event, multi_select, journal_layout) {
this._init (event, multi_select, journal_layout);
} | [
"constructor() { \n \n OrderItemInformationEvent.initialize(this);\n }",
"function Game_ItemEvent() {\n this.initialize.apply(this, arguments);\n}",
"function onItemDetails(event) {\n // We want this to happen in a calendar window.\n var wm = Components.classes[\"@mozilla.org/appshell/... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This function updates the end date based on the event that is passed in | updateEnd(event) {
this.setState({
startDate: this.state.startDate,
endDate: event.target.value
});
this.props.updateDate(event.target.value, 'end');
} | [
"function recurrencend(event)\r\n{\r\n var rec_end = a.valueof(\"$comp.rec_end\");\r\n\r\n // Automatische Erkennung, was gewollt ist\r\n if (rec_end == \"\")\r\n {\r\n if (a.valueofObj(\"$comp.rec_end_count\") != \"\")\r\n rec_end = \"Endet nach Anzahl Terminen\";\r\n else if (... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
move the task from the tasks done list back to the to do list | moveTaskBack(task) {
const index = this.state.tasksDone.indexOf(task);
this.state.tasksDone.splice(index, 1);
this.state.toDoTasks.unshift(task);
this.setState({toDoTasks: this.state.toDoTasks,
tasksDone: this.state.tasksDone
})
} | [
"moveToTasksDone(task) {\n if (task !== \"\") {\n this.state.tasksDone.push(task);\n const index = this.state.toDoTasks.indexOf(task);\n this.state.toDoTasks.splice(index,1);\n this.setState({\n toDoTasks: this.state.toDoTasks,\n tasksDone: this.state.tasksDone\n })\n }\n }",
"funct... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
The canvas where the pages are drawn When the application is opened, creates the thumbnails for every file and renders them on the main page | async function createThumbnails() {
//Hide thumbnails to show all of them at the same time and display loading icon
document.getElementById('thumbnails').style.visibility = "hidden";
document.getElementById('loading').style.display = "block";
for (let fileIdx = 0; fileIdx < files.length; fileIdx++) {
... | [
"function renderImages() {\n\t\t$('.landing-page').addClass('hidden');\n\t\t$('.img-round').removeClass('hidden');\n\t\tupdateSrcs();\n\t\tcurrentOffset+=100;\n\t}",
"function paginateCanvas(){\n\tcreateDev=\"\";\n\t$(\"#configContent\"+pageCanvas).css(\"cursor\",\"default\");\n $(\"#Magnify\").attr(\"title\",... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
search for a role by query input | findByq(req, res) {
return Role
.findAll({
where: {
$or: [
{ role: { $ilike: `%${req.query.q}%` } }
]
}
})
.then(response => res.status(200).send(response))
.catch(error => res.status(400).send(error));
} | [
"function findRole(roleID) {\n let cost = 0;\n let roleName = \"\";\n\n db.findOne({ guildID: guildID, buyableRanks: { $elemMatch: { roleID: roleID } } }, (err, exists) => {\n if (err) console.log(err)\n if (exists) {\n cost = (exists... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
create a new instrument | function createNewInstrument(name){
// make new oscillator and gain nodes
var newGain = new initGain();
var newOscillator = new initOscillator(newGain);
newGain.connect(context.destination);
// create new instrument with oscillator
var newInstrument = new Instrument("new_instrument", newOscillator, newGain, [])... | [
"function Instrument (options) {\n\tvar i, waveForm, array, mod;\n\toptions = options || {};\n\n\tif (options.context) {\n\t\tthis.context = options.context;\n\t} else if (options.destination) {\n\t\tthis.context = options.destination.context;\n\t} else {\n\t\tthis.context = new AudioContext();\n\t}\n\tthis.mainGai... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
opposingPlayer Params: player 1 or 2, whoever's turn it is Returns 1 or 2, the opposing player's number | __opposingPlayer (player) {
if (player === 1) {
return 2;
}
else {
return 1;
}
} | [
"switchPlayers(){\n if(this.currentPlayer == this.player1){\n this.currentPlayer = this.player2;\n }\n else this.currentPlayer = this.player1;\n }",
"function updateNumberOfPlayers(){\n\n // this is the real number of players\n numberOfPlayers = inPlaye... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
generates a random character image based on gender, race, class. | function randomImage() {
// plugs in to the local storage
var gender = localStorage.getItem('charGender');
var race = localStorage.getItem('charRace');
var classDisplay = localStorage.getItem('charClass');
// display which plugs into var results
var currentpicture;
// sets the image equal to the ID in the html
... | [
"function generateGender() {\n\tvar rand = Math.random();\n\tvar gender;\n\tif (rand < .5) {\n\t\tgender = 'F';\n\t}\n\telse {\n\t\tgender = 'M';\n\t}\n\treturn gender;\n}",
"function gen_character(params) {\n\t//add character generation code here\n}",
"function randomAvatar() {\n currentColor = floor(random... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
2. Write a function called starWarsString, which accepts a number. You should then make an AJAX call to the Star Wars API ( ) to search for a specific character by the number passed to the function. Your function should return a promise that when resolved will console.log the name of the character. | function starWarsString(num) {
return new Promise(async function(resolve, reject) {
var characterData = await $.getJSON(`https://swapi.co/api/people/${num}`); // return data of character
var filmData = await $.getJSON(characterData.films[0]); // return data of first film they starred in
var planetData = await $.... | [
"async function fetchCharacter() { //async permet un comport. asynchrone basé sur des promesses, évitant ainsi les chaînes de promesses.\n try {\n const api = await fetch('https://character-database.becode.xyz/characters');\n const data = await api.json();\n console.log(data)... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
========================================================================== Insert string s in the dictionary and set match_head to the previous head of the hash chain (the most recent string with same hash key). Return the previous length of the hash chain. IN assertion: all calls to to INSERT_STRING are made with cons... | function INSERT_STRING() {
ins_h = ((ins_h << H_SHIFT) ^ (window[strstart + MIN_MATCH - 1] & 0xff)) & HASH_MASK;
hash_head = head1(ins_h);
prev[strstart & WMASK] = hash_head;
head2(ins_h, strstart);
} | [
"findInsertIndexInLine(char, line) {\n let left = 0;\n let right = line.length - 1;\n let mid, compareNum;\n\n if (line.length === 0 || char.compareTo(line[left]) < 0) {\n return left;\n } else if (char.compareTo(line[right]) > 0) {\n return this.struct.length;\n }\n\n while (left + 1... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Base interface for progress events. | function HttpProgressEvent() { } | [
"function onProgress(e) {\n if (video.buffered.length > 0)\n {\n var end = video.buffered.end(0),\n start = video.buffered.start(0);\n load_bar.setAttribute(\"width\", Math.ceil((end - start) / video.duration * 100).toString());\n }\n}",
"seek(position) {\r\n if (this.isSeeking)\r\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
spreadStr(spread: object) Returns a clean string with the spread's stats Format: HP / ATK / DEF / SPA / SPD / SPE | function spreadStr(spread)
{
return spread[0] + '/' + spread[1] + '/' + spread[2] + '/' + spread[3] + '/' + spread[4] + '/' + spread[5];
} | [
"function format(string, vars) {\n\tif (vars) {\n\t\tfor (var k in vars) {\n\t\t\tstring = string.replace(new RegExp('\\\\{' + k + '\\\\}', 'g'), vars[k]);\n\t\t}\n\t}\n\treturn string;\n}",
"function stirvify(string) {\n // let newString = string.slice(0,7) === \"Strive\"? string: \"Strive \"+ string\n\n retur... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
CONTROLS SECTION / Update the maze style from light to dark | function updateMazeStyle(isLight) {
clearCanvas(); /* Clear the Canvas first */
if (isLight) {
lineClr = 'rgba(0,0,0,0.5)';
} else {
lineClr = 'rgba(255,255,255,0.5)';
}
drawcells(); /* Redraw the cells */
} | [
"function resolveMaze(){\n tryMaze(positionFixe);\n traceRoad(chemin_parcouru,\"color2\");\n traceRoad(tabVisite);\n\n}",
"function updateStyle() {\r\n\tif (settings.darkThemeSettings) {\r\n\t\t//dark theme colors\r\n\t\troot.style.setProperty(\"--background-color\", \"#0F0F0F\");\r\n\t\troot.style.setPr... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
function to adjust time when time warping and taking courses in school | function adjtime(tim) {
if (player.STEALTH) player.updateStealth(-tim);
if (player.UNDEADPRO) player.updateUndeadPro(-tim);
if (player.SPIRITPRO) player.updateSpiritPro(-tim);
if (player.CHARMCOUNT) player.updateCharmCount(-tim);
// stop time
if (player.HOLDMONST) player.updateHoldMonst(-tim);
if (player.... | [
"calcTime() {\n const numIng = this.ingredients.length;\n const periods = Math.ceil(numIng/3);\n this.time = periods * 15;\n }",
"_addTime () {\r\n this._totalTime += (this._limit - this._timeLeft)\r\n }",
"function updateScore() {\n\t\t\t// Score rule: pass level n in t seconds get ((100 * n)... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This function will clear Filter Panel | function clearFilterPanel() {
"use strict";
// Clear Search term
$(".filterSearchText").val("");
// Clear Clients
$(".refinerClient .refinerRowLink:last a").click();
$(".refinerClient .filterOkButton:first > .tileOk").click();
// Clear PG
$(".refinerPG .refinerRowLink:last a").click();... | [
"function clearConditionFilter(){ \n\t\tconditionFilter = true;\n\t\tdocument.getElementById(\"filterField\").value = \"\"; \n\t}",
"function clearFilters() {\n tbody.html(\"\");\n init(data)\n}",
"clearAllFilters() {\n this.currentFilters = []\n\n each(this.filters, filter => {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This function validates interest rate field | function validateIntRate(errorMsg) {
var tempIntRate = document.mortgage.intRate.value;
tempIntRate = tempIntRate.trim();
var tempIntRateLength = tempIntRate.length;
var tempIntRateMsg = "Please enter Interest Rate!";
if (tempIntRateLength == 0) {
errorMsg += "<p><mark>Interest rate field: ... | [
"function validateTaxableIncome() {\n var taxableIncome = document.TaxCalculator.taxableIncome.value;\n var regex = /[0-9]|\\./;\n \n if (taxableIncome === \"\" || taxableIncome === \"0.00\" || taxableIncome === \"0\") {\n errorMessage += \"Please Enter your Taxable Income. \\n\";\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
failureReporter inputs the arguments to the property that failed tries number of times inputs were tested before Failure | function failureReporter(inputs, tries) {
var self = getInstance(this, failureReporter);
self.inputs = inputs;
self.tries = tries;
return self;
} | [
"function failureReporter(inputs, tries) {\n const self = getInstance(this, failureReporter);\n self.inputs = inputs;\n self.tries = tries;\n return self;\n}",
"errorMsg (title, expected, actual) {\n console.log(colors.red(`FAILED ${title.toUpperCase()}`))\n\n if (arguments.length === 4) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Removes unwanted formatting from Hue chat messages | function hue_clean_chat_message(message) {
return message.replace(/\=?\[dummy\-space\]\=?/gm, '');
} | [
"function messageData(user, text){\n text = text.replace(':)', '\\uD83D\\uDE00')\n text = text.replace(':(', '\\uD83D\\uDE41')\n text = text.replace(':o', '\\uD83D\\uDE2E')\n return{\n user, \n text,\n time: moment().format('h:mm a')\n }\n}",
"function convertMessages(data) {\n let slice = data.sli... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
FUNCTION: extUtils.getLoopVarNestLevel DESCRIPTION: Retrieve the level of nested loops in which variable occurs ARGUMENTS: param param name levelToParamList hash table to match loop parameters with associated nested loop. RETURNS: numbered level or 1 if not found | function extUtils_getLoopVarNestLevel(param, levelToParamList)
{
for (var level in levelToParamList)
{
// Note levelToParamList[level] may have been emptied or made null to clean
// out the parameter list for the associated level.
for (var i = 0; levelToParamList[level] && i < levelToParamList[level].... | [
"get depth() {\n let d = 0;\n for (let p = this.parent; p; p = p.parent)\n d++;\n return d;\n }",
"function getDepth(page_id) {\n\t\t\tif(!page_id || page_id < 1) return 0;\n\t\t\tconsole.log(page_id);\n\t\t\tvar depth = 0;\n\t\t\tvar parent_id = parents[page_id];\n\t\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
CODING CHALLENGE 77 Create a function that filters out an array to include numbers who only have a certain number of digits. | function filterDigitLength(arr, num) {
const a = arr.filter(x => x.toString().length === num);
return a;
} | [
"function filterNumbers(inputArray) { //step one\n var numberBucket = []; //step two\n\n inputArray.forEach(function(item) { //step three for each loop\n if (typeof item === \"number\"){ //step four, conditional statement\n numberBucket.push(item)\n }\n });\n return numberBucket... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
create funcion "record" to store to db on pending with readwrite | function saveRecord(record) {
const transaction = db.transaction(["pending"], "readwrite");
// object store for pending db data to be accessed
const store = transaction.objectStore("pending");
console.log("store")
// adds the record with the store
store.add(record);
} | [
"newRecord() {}",
"createRecord(store, type, record) {\n this.logToConsole(OP_CREATE_RECORD, [store, type, record]);\n let data = {};\n let serializer = store.serializerFor(type.modelName);\n serializer.serializeIntoHash(data, type, record, { includeId: true });\n return this.asyncRequest(OP_CREATE... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Filter the AMI instances we want. | instanceFilters() {
const filters = [
{
Name: "instance-state-name",
Values: ["running", "stopped"]
}
];
return filters;
} | [
"function queryBuoyInstances() {\n server.getBuoyInstances().then(function(res) {\n vm.buoyInstances = res.data.buoyInstances;\n formatBuoys();\n }, function(res) {\n gui.alertBadResponse(res);\n });\n }",
"async function listIns... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Update resourse list order query from filter | updateResourceOrder(filter) {
let orderQuery = `&ordering=${filter}`;
if (filter === 'most_likes' || filter === 'most_tried') {
orderQuery = `&${filter}=-resource`;
}
this.setState(
{
ordering: orderQuery,
activeFilter: filter
... | [
"refreshData(newSearchTerm, newSortBy, newIsAscending) {\n this.updateDataFilters(newSearchTerm, newSortBy, newIsAscending);\n const { searchTerm, sortBy, isAscending } = this.dataFilters;\n const data = this.state.transactions.filtered(\n 'serialNumber BEGINSWITH[c] $0',\n searchTerm,\n );\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Calculate the active crown fire spread rate at head [Ractive] (ft+1 min1) given the corresponding standard fuel model 10 spread rate at head. This is the crown fire spread rate per Rothermel (1991), and which Scott & Reinhardt term `Ractive` | function rActive (fm10ros) {
return 3.34 * fm10ros
} | [
"function backingSpreadRate (rosHead, eccent) {\n return rosHead * divide(1 - eccent, 1 + eccent)\n}",
"function betaSpreadRate (betaHead, rosHead, eccent) {\n let rosBeta = rosHead // Calculate the fire spread rate in this azimuth\n // if it deviates more than a tenth degree from the maximum azimuth\n\n if (... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Title: drawSymbol Arguments: ctx Canvas element symbol Character to draw fc offset cx x coordinate cy y coordinate ch Character size Purpose: Draws a specific symbol | function drawSymbol( ctx, symbol, fc, cx, cy, cw, ch ) {
ctx.beginPath();
switch ( symbol ) {
case "0":
ctx.moveTo(cx+fc,cy+(ch*0.333333));
ctx.arc(cx+(cw/2),cy+(cw/2),(cw/2)-fc,deg2rad(180),0, false);
ctx.arc(cx+(cw/2),(cy+ch)-(cw/2),(cw/2)-fc,0,deg2rad(180), false);
ctx.closePath();
break;
case "1... | [
"function drawSymbol(p2, dist, dip, dipaz)\n{\n\n\t//draw the point with dip/dip azimuth\n\tvar dipF = Math.floor(dip);\n\tvar dipAzF = Math.floor(dipaz);\n\n\tdipF = dipF.toString();\n\tdipAzF = dipAzF.toString();\n\n\tif(dipF.length == 1)\n\t{\n\t\tdipF = \"0\" + dipF.toString();\t\n\t}\n\tif(dipAzF.length == 2)\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
When a DAQ changes out, there signals that disappear and get recreated. Technically they're not the same as previous. However, sometimes it makes sense to reattach plotted signals to underlying signal objects by using the referenced name. | rectifySignalReferencesByName(){
this.plottedSignalsMap.forEach((ps, sigName) => {
var newSig = this.signalFromNameCallback(sigName);
if(newSig != null){
ps.signal = newSig;
}
});
} | [
"signal() {\n const active = this.combiner.shouldBeActive(this.emitters);\n this._setIsActive(active);\n }",
"function optionChanged(subjectid) {\n barPlot(subjectid);\n bubblePlot(subjectid);\n updateinfo(subjectid);\n gaugeplot(subjectid);\n \n}",
"swapChart() {\n swapElements(this.da... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Maps the data from a Testcase object to the UI. The UI currently uses jQuery and Bootstrap to display the data. | function mapCaseJsonToUi(data){
//
// This gives me ONE object - The root for test cases
// The step tag is the basis for each step in the Steps data array object.
//
var items = [];
var xdata = data['step'];
if (!jQuery.isArray(xdata)) xdata = [xdata]; // convert singleton to array
//console.log("xdata =" ... | [
"function testcasePopulateTestcaseList(projectId){\n $('.field-project-id').val(projectId);\n $.ajax({\n url : endpoint+'?action=testcases&subaction=getallbyprojectid&id='+projectId,\n method: 'GET'\n }).done(function(response){\n // console.log(response);\n if(response != undef... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets a specific version of a badge by name. | getVersion(name) {
return new ChatBadgeVersion_1.ChatBadgeVersion(this._data.versions[name]);
} | [
"async getVersionInfo({ state, getters, commit }, {\n repoType, repoName, chartName, versionName\n }) {\n const key = `${ repoType }/${ repoName }/${ chartName }/${ versionName }`;\n let info = state.versionInfos[key];\n\n if ( !info ) {\n const repo = getters['repo']({ repoType, repoName });\n\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
given a predecessor and a string, find the required matches we only need the successor as a parameter so that we can add it to the return value without that, we can't be certain which replacement goes with which successors | _match(predecessor, suc, stringMatch) {
/*
[
{
startIndex: 1, //Inclusive
endIndex: 2, //Exclusive
successor: "some string"
},
{
startIndex: 2,
endIndex, 4,
successor: "other string"
}
]
*/
//NOTE - predecessors have 2 restricted characters; '<' and '>' - These are used f... | [
"function getFront(mainStr,searchStr)\r\n{\r\n var foundOffset=mainStr.indexOf(searchStr);\r\n if(foundOffset==-1)\r\n return null;\r\n return mainStr.substring(0,foundOffset);\r\n}",
"function getAutoComplete(sub,stringlist) {\n if (stringlist.length===0) { return \"-1\"; }\n var res=stringl... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
AVE SCORES This function will go through all the unique playerIDs in the main scoreboardhistory and calculate the average score and store the pair of ID and aveScore in a object within the array. hopefully this won't blow up this time but I promise it will work... don't give me that look I've learned from my mistakes! ... | function aveScores(){
uniquePlayerIDCheck();
/*
Yes yes I know this is a bad way to do it, but for now we just want to make sure we are not adding to the list again and this is quite a light program so we don't care too much about recalcuating the whole list again. So for now, we clear out the list and start over.
... | [
"function removePlayer(){\n\n\tvar exiledPlayer = document.getElementById(\"deletePlayer\").value;\n\nvar i = scoreBoardHistory.length\n\nwhile(i--){\n\tif (scoreBoardHistory[i].playerID == exiledPlayer){\n\t\tscoreBoardHistory.splice(i,1);\n\t}\n}\n//scoreBoardHistory.push({\"playerID\": exiledPlayer, \"score\": -... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns the number of attached views. | get viewCount() {
return this._views.length;
} | [
"getNumberOfImagesLoaded(){\n\t\treturn this.loadedImages.length;\n\t}",
"function getNumberOfTablegroups(){\n // Take the contents of the view\n var originalView = tabsFrame.fileContents;\n \n // Convert it into an object\n var myView = new Ab.ViewDef.View();\n var myConverter = new Ab.ViewDef.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Set the pomodoro items ,that has status 'none', status 'failed' | fillRemainedPomodoros(){
for(let i = 0; i < this.data.pomodoros.length; i++){
if(this.data.pomodoros[i].status === "none")
this.data.pomodoros[i].status = "failed";
}
this.data.estimationUsed = this.data.estimationTotal;
this.data.isActive = false;
... | [
"completeAllItems() {\n this.items.forEach(item => {\n item.status = 'Completed';\n item.finishedAt = Date.now;\n });\n }",
"setEstimation(data){\r\n let index;\r\n\r\n this.data.pomodoros.find((pomodoro, i) => {\r\n if(pomodoro.status === \"none\"){... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
CODING CHALLENGE 417 Create a function that takes an array of students and returns an array of their top notes. If student does not have notes then let's assume their top note is equal to 0. | function getStudentTopNotes(students) {
return students.map(x => Math.max(...x.notes, 0));
} | [
"function leader (array){\n\tvar max = array[0];\n\tvar newarr=[];\n\tfor ( var i =0 ; i<array.length;i++){\n\t\tif (max>array[i+1]){\n\t\t\tnewarr.push(array[i])\n\t\t}\n\t\ti++\n\t\tif(array[i]>array[i+1]){\n\t\t\ti++\n\t\tnewarr.push(array[i+1])\n\t}\n\t}\n\t\treturn newarr\n}",
"function mostProlificAuthor(au... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
check whether a task is ready (does it pass all the checks) | function testReady(task) {
return (task.checks || []).reduce(function(memo, check) {
return memo && check(pc, task);
}, true);
} | [
"__isReady() {\n return this.allRequiredStanzasProcessed;\n }",
"function checkTasksState() {\n var i, j, k, listTasks = Variable.findByName(gm, 'tasks'), taskDescriptor, taskInstance,\n newWeek = Variable.findByName(gm, 'week').getInstance(self), inProgress = false,\n listResources =... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Generate the examplebegin indices; shuffle them randomly. | generateExampleBeginIndices_() {
// Prepare beginning indices of examples.
this.exampleBeginIndices_ = [];
for (let i = 0;
i < this.textLen_ - this.sampleLen_ - 1;
i += this.sampleStep_) {
this.exampleBeginIndices_.push(i);
}
// Randomly shuffle the beginning indices.
tf.u... | [
"generateExampleBeginIndices_() {\n // Prepare beginning indices of examples.\n this.exampleBeginIndices_ = [];\n for (\n let i = 0;\n i < this.textLen_ - this.sampleLen_ - 1;\n i += this.sampleStep_\n ) {\n this.exampleBeginIndices_.push(i);\n }\n console.log('exampleBeginIndi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets squares attacked or defended by a bishop on `square`, given `occupied` squares. | function bishopAttacks(square, occupied) {
const bit = SquareSet.fromSquare(square);
return hyperbola(bit, DIAG_RANGE[square], occupied).xor(hyperbola(bit, ANTI_DIAG_RANGE[square], occupied));
} | [
"function revealSquare(classList) {\n // Set selected square\n const enemySquare = computerGrid.querySelector(`div[data-id='${shotFired}']`);\n const obj = Object.values(classList);\n // If selected square's class list contains \"explosion\" or \"miss\" and the game is not over already ->\n if (!enem... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Register the given Angular Service Worker script. If `enabled` is set to `false` in the given options, the module will behave as if service workers are not supported by the browser, and the service worker will not be registered. | static register(script, options = {}) {
return {
ngModule: ServiceWorkerModule,
providers: [provideServiceWorker(script, options)],
};
} | [
"function initServiceWorker() {\n if ('serviceWorker' in navigator) {\n navigator.serviceWorker\n .register('../service-worker.js')\n .then(function() { console.log('ServiceWorker Registered');\n }, function(err) {\n console.log('ServiceWorker registration f... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
NOT FINISHED Dictionary iterator: work your way through the entries of my custom dictionary object. DictionaryIterator constructor: takes errors object and the dictionary to iterate through. | function DictionaryIterator(objErrors, objDictionary) {
if (objErrors != gstrPrototype) {
//Set up error-handling:
this.module = "Iterator";
var strRoutine = "DictionaryIterator";
var strAction = "";
setErrorsObj(this, objErrors, strRoutine);
try {
//Dictionaries are really just smart arrays, so
//c... | [
"function PostorderIterator(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 PostorderIterator",
"function PreorderIterator(objErrors, objRoot) {\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Functions dealing with OnScreens check if feed from myURL is present on screen | function checkOnScreen(myURL){
HeadingArray = getOnScreenHeadingArray();
URLArray = getOnScreenURLArray();
var i = URLArray.indexOf(myURL);
if( i != -1 ){
alert("Already exists OnScreen with heading: "+HeadingArray[i]+" .");
return true;
}
} | [
"function loadOnScreen(){\n\tHeadingArray = getOnScreenHeadingArray();\n URLArray = getOnScreenURLArray();\n\t\n\tfor(var i = 0; i<HeadingArray.length; i++)\n\t getFeed(HeadingArray[i],URLArray[i]);\n}",
"function checkURL()\n{\n if (/\\bfull\\b/.test(location.search)) toggleMode();\n if (/\\bstatic\\b/.t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Public: Registers new middleware middleware A generic pipeline component function Returns nothing. | register (middleware) {
this.stack.add(middleware)
} | [
"function registerMiddleware(middleware, options) {\n if (typeof middleware === 'string') {\n middleware = restify[middleware](options);\n }\n else {\n middleware = middleware.bind(virgilio);\n }\n this.log.trace('Adding middleware.');\n server.use(mid... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Fenetre javascript de confirmation de suppression d'un compte | function confirme_suppression_compte(objet,id)
{
if (confirm("Souhaitez vous supprimer cet identifiant : "+objet))
window.location="comptes_del.php?id="+id;
} | [
"function confirmerSuppression() {\n let n = new Noty({\n text: 'Confirmer la demande de suppression ',\n layout: 'center', theme: 'sunset', modal: true, type: 'info',\n animation: {\n open: 'animated lightSpeedIn',\n close: 'animated lightSpeedOut'\n },\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Set the font on a CanvasRenderingContext2d based on the CSS font for the canvas, the requested size, and whether we want something monospaced. | function canvas_set_font(ctx, size, monospaced) {
var s = window.getComputedStyle(onscreen_canvas);
// First set something that we're certain will work. Constructing
// the font string from the computed style is a bit fragile, so
// this acts as a fallback.
ctx.font = `${size}px ` + (monospaced ? "... | [
"setFont(font) {\n this.ctx.font = font;\n }",
"_restyleCanvas() {\n this._canvas.getContext('2d').font = \"\".concat(BubbleStyle.FONT_SIZE, \"px \").concat(BubbleStyle.FONT, \", sans-serif\");\n }",
"function _loadFont(fontname){\n var canvas = document.createElement(\"canvas\");\n //Setting th... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Calls the openCalendar function, but providing the id of the iFrame so that the objects may be correctly initialized. The name of the calendar instance object is assumed to be unchanged in the iFrame | function atgCalendar_openCalendarIFrame(iFrameId) {
var iFrameObject = atgCalendar_findElementById(iFrameId);
if (iFrameObject != null) {
iFrameObject.contentWindow.atgCalendar_openIFrame(iFrameId);
}
} | [
"function openCalendarAtPosition( xpos, ypos, contextString ) {\n\n var calwindow = window.open( \"html/calendar.htm?context=\"+contextString , \"cdccalendar\", \"toolbar=no,status=yes,top=\"+ypos+\",left=\"+xpos+\",outerWidth=203,outerHeight=236,width=190,height=183,scrollbars=auto,resizable=yes,menubar=no,locati... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This sample demonstrates how to Creates or updates a network security group in the specified resource group. | async function createNetworkSecurityGroupWithRule() {
const subscriptionId = process.env["NETWORK_SUBSCRIPTION_ID"] || "subid";
const resourceGroupName = process.env["NETWORK_RESOURCE_GROUP"] || "rg1";
const networkSecurityGroupName = "testnsg";
const parameters = {
securityRules: [
{
name: "r... | [
"async function createNetworkSecurityGroup() {\n const subscriptionId = process.env[\"NETWORK_SUBSCRIPTION_ID\"] || \"subid\";\n const resourceGroupName = process.env[\"NETWORK_RESOURCE_GROUP\"] || \"rg1\";\n const networkSecurityGroupName = \"testnsg\";\n const parameters = {};\n const credential = new Defaul... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates the checkboxes dynamically | createCheckboxes() {
const checkboxes = [];
for (const option in this.props.const.option) {
checkboxes.push(
<Checkbox
key={this.props.const.option[option]}
name={this.props.const.option[option]}
activeCheckbox={this... | [
"function addCheckboxes() {\r\n\r\n //table ids where to find clickabe elements\r\n var tableIds = ['#ID-macroTable', '#ID-conditionTable', '#ID-tagTable'];\r\n //corresponding click element classes (different in each table)\r\n var clickClasses = ['.ACTION-clickMacro', '.ACT... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns true if reached target position | reachedTargetPosition() {
if (this.target !== undefined) {
let targetCenter = this.getTargetCenter();
let ownCenter = this.getCenter();
// console.log(ownCenter);
// console.log(targetCenter);
var distance = Phaser.Math.Distance.Between(
... | [
"hasReachedDestination() {\r\n\t\tvar destinationTiles = this.levelGrid.getDestination();\r\n\t\tfor (var i = 0; i < destinationTiles.length; i++) {\r\n\t\t\tvar destinationRow = destinationTiles[i].row;\r\n\t\t\tvar destinationColumn = destinationTiles[i].column;\r\n\t\t\tif ( this.currentTileRow === destinationRo... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get list of brands from list of products | function getBrandsFromProducts (products) {
return [...new Set(products.map(product => product.brand))];
} | [
"function requestUniqueBrands(req, res){\n Product.distinct(\"brandName\", function(err, response){\n res.send(JSON.stringify(response));\n });\n}",
"function compareBrandsToCatalog(popularItems, catalogItems) {\n // get string values from catalog brands\n var brandsInCatalog = [];\n for (va... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
for error prompt when wrong pin entered | function errorPrompt(msg) {
$('#oldPin').val('');
$('#pinError').show();
$('#pinError').html(msg);
setTimeout(() => {
$('#pinError').hide();
}, 3000);
} | [
"function isValid(){\n if((''+pin) === userInput && tries !== 0){\n reset('all');\n triesLeft.innerText = '';\n notifyMatched.display = 'block';\n }\n else if(tries === 0){\n triesLeft.innerText = 'No more tries left';\n reset('all');\n notifyNotMatched.display = 'block';\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Iterates over the arrows collection hiding each arrow | hide () {
foreach(arrow => arrow.hide(), this.arrows)
} | [
"show () {\n foreach(arrow => arrow.show(), this.arrows)\n }",
"fadeIn () {\n foreach(arrow => arrow.fadeIn(), this.arrows)\n }",
"positionate () {\n foreach(arrow => arrow.positionate(), this.arrows)\n }",
"clear () {\n this.arrows = []\n }",
"function updateArrows() {\n game.globals.arrow... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Internal functions / Minify directory | function minifyDir(from, to) {
// init `to` directory
del.sync(to, {force:true});
mkdir(to);
// process
iterateFiles(from, function (filename) {
var extname = filename.match('\.[a-zA-Z0-9]*$')[0];
var basename = path.basename(filename);
var destdir = path.join(to, path.dirname(filename.replace(fr... | [
"function optimizeMore() {\r\n recursive(buildDir, function (err, files) {\r\n files.forEach(function(file) {\r\n if(/.css$/.test(file)) {\r\n fs.writeFileSync(file, new CleanCSS().minify(fs.readFileSync(file).toString()).styles);\r\n } else if(/.handlebars/.test(file)) {\r\n fs.unlinkSy... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get the toast by id, given it's in the DOM, otherwise returns null | function getToast(toastId, _ref) {
var containerId = _ref.containerId;
var container = getContainer(containerId);
if (!container) return null;
var toast = container.collection[toastId];
if (typeof toast === 'undefined') return null;
return toast;
} | [
"function getEl(id) {\n return document.getElementById(id) || document.getElementsByClassName(id)[0] || document.getElementsByTagName(id)[0] || null;\n}",
"function GetElement(id) {\n\treturn document.getElementById(id);\n}",
"function fltFindNativeElement(id) {\n //getElementsByTagName('flt-platform-view')... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
The AspectRatio component provides a `ratio` prop that will be used to specify the aspect ratio that the children you provide will be displayed in. This is often useful alongside our grid components, or for media assets like images or videos. | function AspectRatio({
as: BaseComponent = 'div',
className: containerClassName,
children,
ratio = '1x1',
...rest
}) {
const className = cx(
containerClassName,
`${prefix}--aspect-ratio`,
`${prefix}--aspect-ratio--${ratio}`
);
return (
<BaseComponent className={className} {...rest}>
... | [
"applyAspectRatioAttributes_() {\n if (!this.element.hasAttribute('aspect-ratio')) {\n return;\n }\n setImportantStyles(this.element, {\n '--aspect-ratio': this.element\n .getAttribute('aspect-ratio')\n .replace(':', '/'),\n });\n }",
"setCanvasRatio() {\n const canvasE... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
given partial request, fill it in from defaults, and return request and signature to send. if nonce is not explicitly specified, read it from forwarder | async function makeRequest(web3, req, defaultRequest, chainId, forwarderInstance) {
var _a;
const filledRequest = {
request: Object.assign(Object.assign({}, defaultRequest.request), req.request),
relayData: Object.assign(Object.assign({}, defaultRequest.relayData), req.relayData)
};
// u... | [
"function NewCredRequest(sk , IssuerNonce , ipk , rng ) {\n\t// Set Nym as h_{sk}^{sk}\n\tlet HSk = ipk.HSk\n\tlet Nym = HSk.mul(sk)\n\n\t// generate a zero-knowledge proof of knowledge (ZK PoK) of the secret key\n\n\t// Sample the randomness needed for the proof\n\tlet rSk = RandModOrder(rng)\n\n\t// Step 1: Firs... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Comparaison de deux objets TimeRanges | function compareTimeRanges(t1, t2) {
if (!t1 || !t2 || t1.length != t2.length) {
//Si l'un des objets n'existe pas ou si leurs longueurs diffèrent, on renvoie false
return false;
} else {
for (let i = 0; i < t1.length; i++) {
//Comparaison de chacun des éléments... | [
"function handleTimeRanges() {\n //Calculate extent of each time scale.\n defineFullTimeRanges.call(this);\n\n //Set initial range of each time scale.\n defineInitialTimeRanges.call(this);\n\n //Sync time range variables given initial time scale.\n syncTimeRanges.call(this)... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
output: the number of friday the 13ths in that year. loop through all 12 months of the year and count how many times the the 13th day of the month is a friday. algorithm: 1. create a count variable set to 0 2.iterate through the months of the year, start with 0, go to 11 3.get the day of the month that falls on the 13t... | function fridayThe13ths(year) {
var date = new Date(year, 0, 13);
var count = 0;
var i;
for (i = 0; i < 12; i++) {
date.setMonth(i);
if (date.getDay() === 5) {
count += 1;
}
}
return count;
} | [
"function lastDayIsFriday(initialYear, endYear = initialYear) {\n let count = 0;\n // if(endYear < initialYear || !endYear|| !initialYear){\n // initialYear === endYear;\n // }\n for (let year = initialYear; year <= endYear; year++) {\n for (let months = 0; months <= 11; months++) {\n let date = ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |