query stringlengths 9 34k | document stringlengths 8 5.39M | negatives listlengths 19 20 | metadata dict |
|---|---|---|---|
Circular Double Linked List | function CircularDoubleLinkedList() {
this.head = null;
} | [
"circularize()\r\n {\r\n if(this.isCircular())\r\n console.log('Singly linked list is already circular')\r\n else\r\n {\r\n if(this.isEmpty() || this.size == 1)\r\n { \r\n this.head.next = this.tail\r\n this.tail.next = th... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Loads all quests from a file resource. | function loadQuests(callback) {
var xobj = new XMLHttpRequest();
xobj.overrideMimeType("application/json");
xobj.open('GET', './js/quests.json', true);
xobj.onreadystatechange = function () {
if (xobj.readyState == 4 && xobj.status == "200") {
// Required use of an anonymous callback as .open will NOT return a... | [
"function loadQuestions() {\n var empty = \"[]\";\n readFile(\"questions.txt\", empty, function(err, data) {\n questions = JSON.parse(data)\n });\n}",
"function loadFile() {\n loadStrings('question.txt', fileLoaded);\n}",
"function getQuestionsArrayFromJsonFile() {\n alert(\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Shows the results of the close operation in a dialog. This will say how many review requests have been closed successfully, and will also list the number that have failed (due to access permissions or other errors). Args: successes (int): Number of successfully closed review requests. failures (int): Number of unsucces... | _showCloseResults(successes, failures) {
const $dlg = $('<div/>')
.append($('<p/>')
.text(interpolate(
ngettext('%s review request has been closed.',
'%s review requests have been closed.',
successes),
... | [
"async _closeReviewRequests(closeType) {\n try {\n const confirmed = await this._confirmClose();\n\n if (confirmed) {\n const results = await this.model.closeReviewRequests({\n closeType: closeType,\n });\n this._showCloseR... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
this func checks if arrival flight can proced to the next leg. | arrivalCanChangeLeg(flight) {
return new Promise((res, rej) => {
if (!flight) {
rej("func must get flight object!");
return;
}
if (!flight.isDeparture) {
//flight finished its current leg and is the first in line:
... | [
"async arrivalCheckAndMove(flight) {\r\n const canChangeLeg = await this.arrivalCanChangeLeg(flight);\r\n if (canChangeLeg) {\r\n this.arrivalChangeLegAsync(flight);\r\n }\r\n return canChangeLeg;\r\n }",
"departureCanChangeLeg(flight) {\r\n return new Promise((res... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates a new dispatcher instance. | createDispatcher() {
return new EventDispatcher_1.EventDispatcher();
} | [
"function createDispatcher() {\n var listeners = [];\n return {\n register: function (callback) {\n return \"\" + (listeners.push(callback) - 1);\n },\n unregister: function (id) {\n listeners[parseInt(id, 10)] = 0;\n },\n dispatch: function (payload) {... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Delete Local Tenant name: local tenant name id: local tenant id | deleteLocalTenant(name, id, callback)
{
if(!r3IsSafeTypedEntity(callback, 'function')){
console.error('callback parameter is wrong.');
return;
}
let _callback = callback;
let _error;
if(r3IsEmptyString(name, true) || r3IsEmptyString(id, true)){
_error = new Error('name(' + JSON.stringify(name) + ')... | [
"deleteLocalTenant(name, id, callback)\n\t{\n\t\tif(!r3IsSafeTypedEntity(callback, 'function')){\n\t\t\tconsole.error('callback parameter is wrong.');\n\t\t\treturn;\n\t\t}\n\n\t\tlet\t_callback\t= callback;\n\t\tlet\t_error;\n\t\tif(r3IsEmptyString(name, true) || r3IsEmptyString(id, true)){\n\t\t\t_error = new Err... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
contructor for Goat Guardian | function Guardian(guardianName, guardianLocation, guardianContact, serviceOffered, src){
this.guardianName = guardianName;
this.guardianLocation = guardianLocation;
this.guardianContact = guardianContact;
this.serviceOffered = serviceOffered;
this.guardianImage = src;
} | [
"constructor() {\n /**\n * A unique identifier to access the Guardian.\n * @type {string}\n */\n this.id = '';\n\n /**\n * The first name of the User.\n * @type {string}\n */\n this.name = '';\n\n /**\n * The postal code where the user is located.\n * @type {string}\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
function to load todo if list is found in local storage. | function loadTodo(){
if(localStorage.getItem('todoList')){
ul.innerHTML = localStorage.getItem('todoList');
deleteTodo();
}
} | [
"function loadTodo() {\n\t\tif (localStorage.getItem('todoList')) {\n\t\t\tul.innerHTML = localStorage.getItem('todoList');\n\t\t\tdeleteTodo();\n\t\t}\n\t}",
"function loadToDoLocal(todo){\n // check: if a to-do has already been Saved\n let todos;\n if(localStorage.getItem('todos') === null){\n t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
creates a csv file containing song_Id's and an array of their associated comments' foreign Keys | async function asyncSongCommentWriter() {
var songs = [];
const messages = [];
for (var i = 0; i < 100000; i++) {
const randomWordCount = Math.floor(Math.random() * 30);
const message = faker.random.words(randomWordCount);
messages.push(message);
}
/* TABLE CREATION
CREATE TAB... | [
"generateCsv(songlists) {\n var csv = '';\n var conv = new Converter();\n csv += conv.arrayToCsv(conv.struct(new Song())) + conv.csvchar + 'playlist\\n';\n songlists.forEach((songlist) => {\n songlist.songs.forEach((song) => {\n csv += conv.arrayToCsv(conv.objec... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This will be triggered when a category is checked and emits that event up to this component It will emit the event up to the home component to handle | onToggleEvent(category) {
console.log(category);
this.onToggle.emit(category);
} | [
"handleSelectedCategory(event) {\n this.selectedCategory = event.detail;\n }",
"onCategoryChange(categorySelected) {\n this.setState({\n categorySelected\n });\n if (categorySelected === null) {\n this.state.props.categoryChangeListener(-1);\n } else {\n this.state.props.categoryCha... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
A component that takes in an optional photographer object, and an optional albumID, then renders a breadcrumb link trail | function Breadcrumb({photographer, albumID}) {
return (
<ul>
<li><Link to="/"><FontAwesomeIcon icon={faHome} /></Link></li>
{
photographer
? <Fragment>
<li><FontAwesomeIcon icon={faChevronRight} /></li>
<li><Link to={`/${photographer.id}`}>{photographer.name}</L... | [
"function renderAlbum(album) {}",
"function renderAlbum(album) {\n console.log('rendering album:', album);\n\n}",
"function breadcrumbAdd( albumIdx ) {\n \n var cl=\"folder\";\n if(albumIdx == 0 ) {\n cl=\"folderHome\";\n }\n var newDiv =jQuery('<div class=\"'+cl+' oneFolder\">'+gI[albumIdx... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Used to activate the modal when a right swipe is detected | handleSwipeRight(event) {
this.setState(() => {
return { modalSwipe: !this.state.modalSwipe };
});
} | [
"swipeRight() { }",
"function onSwipeRight() {\n removeNoTransition();\n transformUi(1000, 0, 0, currentElementObj);\n if (useOverlays) {\n transformUi(1000, 0, 0, rightObj); //Move rightOverlay\n transformUi(1000, 0, 0, topObj); //Move topOverlay\n resetOverl... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Handle request to open a link from a menu selection | function openLink( selection, menuItemId, tabId, mods )
{
// Shouldn't come in here with no selection now.
if (selection.length === 0)
{
console.error("URL Link triggered with no selection");
return;
}
// In new tab?
let inTab = (menuItemId.indexOf("-in-new-tab") > 0);
// I... | [
"function openMenuItem(url, mainContent=\"main_content\"){\n\tdoGet(url, mainContent);\n\t//alert(url);\n}",
"onSelect(items) {\n const selected = items[0];\n if (selected !== undefined) {\n const route = this.state.items[selected.id].route;\n window.open(route, \"_self\");\n }\n }",
"__laun... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
I link the directive. Since we can only access the content via the transclusion function, at this point, the content has already been compiled by the time we get the clone. | function link( scope, element, attributes, _c, transclude ) {
console.log( "Container at link (html):", element.html() );
// Clone and inject the transcluded content.
transclude(
function injectLi... | [
"function getCompiledElement(){\n let compiledDirective = compile(angular.element(\n `<add-sub-item \n parent-id=\"parentId\"\n factory-name=\"MockFactory\" \n >\n <div>\n transcludedContent\n </div>\n </add-sub-item>`\n ))(scope);\n sc... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Connection object / PUBLIC The Connection element constructor. A connection joins two Network Elements Ports with a single line. This line can be a rect between two ports or can have a middle point which describes a right or left angle. Initially a connection has no middle point. The connection implementation is made u... | function Connection(port1, port2) {
if (port1.ne.id > port2.ne.id) {
this.originPort = port2;
this.destinationPort = port1;
} else {
this.originPort = port1;
this.destinationPort = port2;
}
this.originPort.setConnection(this);
this.destinationPort.setConnection(this);
this.originX = null;
this... | [
"function Connection(object1, x1, y1, object2, x2, y2) {\n this.obj1 = object1;\n this.obj1x = x1;\n this.obj1y = y1;\n this.obj2 = object2;\n this.obj2x = x2;\n this.obj2y = y2\n}",
"function writeConnection() {\n\t\tif (this.points != null) {\n\t\t\tvar line = document.createElement(\"v:polyli... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
START : Function for the Metadata Profile pages: JQUERY UI Drag and drop for metadata | function dragAndDrop() {
jQuery(function() {
var dragged;
jQuery(".draggable").draggable({
zIndex : 100,
opacity : 0.1,
cursor : "move",
axis : "y",
revert : 'invalid'
});
jQuery(".draggable").on("dragstart", function(event, ui) {
dragged = jQuery(this).attr('id') + 'DragButton';
hide_non_... | [
"function drop(event) {\n // Get the table row which was dragged\n let dragged_page = u('.drag').closest('tr');\n // Get the table row onto which the page was dropped\n let target = u(event.target.parentElement).closest('tr');\n // Insert the page before the drop target\n target.before(dragged_pag... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Calculates the max and average speeds, and adds the values to the dashboard | function calcSpeed(speeds) {
var speed = new Array(speeds.length);
for(i = 0; i < speeds.length; i++) {
speed[i] = (parseFloat(speeds[i].amount));
}
var max = Math.max(...speed);
var sum = speed.reduce((previous, current) => current += previous);
var avg = sum / speed.length;
do... | [
"function MaximumDistanceEstimator()\n{\n var previous = null;\n //var stats = new RunningStatistics();\n\n // This is used to tack the top speeds. We will\n // take the minimum max speed, assuming the others\n // are outliers due to noise or system tracking errors\n var speeds = new Array(5);\n\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Extract Javascript from given folder and return the filename complete with its directory | getJavascriptFiles(startPath,filter,callback){
const self = this;
if(self.getterIsExtracted()){ // If extraction is successful
if (!fs.existsSync(startPath)){ // If path does exist
console.log("no dir ",startPath);
return;
}
const files... | [
"function extractJsFromDir(dir, target) {\r\n var currFile;\r\n var buff ;\r\n var filesInDir = fs.readdirSync(dir);\r\n // console.log(filesInDir);\r\n for (var i = 0; i<filesInDir.length; i++) {\r\n currFile = filesInDir[i];\r\n // if directory we recurse\r\n if (fs.lstatSync(d... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Remove the connection from the socket.io collection before the user get authenticate | _forbidConnections(nsp) {
nsp.on('connect', (socket) => {
if (!socket.auth) {
debug('removing socket from %s', nsp.name);
delete nsp.connected[socket.id];
}
});
} | [
"clearSocket(){\n \n if (this.socket) {\n this.socket.destroy(); // kill client after server's response\n }\n }",
"disconnectUser_(socket) {\n\n console.log('User logged out:' + socket.id)\n\n // Remove user from onlineUsers list if it's there\n this.onlineUsers.delete(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
function that decides which fruit is closer to the left arm | function closerfruit() {
distancefruitarray = [myfruit1,myfruit2,myfruit3,myfruit4];
var a = pythagorean(myfruit1,x_cor,y_cor);
var b = pythagorean(myfruit2,x_cor,y_cor);
var c = pythagorean(myfruit3,x_cor,y_cor);
var d = pythagorean(myfruit4,x_cor,y_cor);
var distarray_l = [a,b,c... | [
"closestGate()\n {\n for (let gate of this.gates)\n {\n if (gate.x + gate.width > this.birds[0].x - this.birds[0].diameter) \n {\n return gate; \n }\n }\n }",
"getRightmostMountain() {\n let rightmostMountain = -200;\n this.mountainGroup.getChildren().forEach((mountain) =... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets the style objects on given style type. | getStyles(styleType) {
if (this.viewer) {
return this.viewer.styles.getStyles(styleType);
}
return [];
} | [
"function getStyleModulesFor(type) {\n return (type && TYPE_STYLE_MODULES.get(type)) || [];\n}",
"getStyleNames(styleType) {\n if (this.viewer) {\n return this.viewer.styles.getStyleNames(styleType);\n }\n return [];\n }",
"function getProps (type, args) {\n var select... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
returns pseudorandom id that is a unique tag for this blog, using the library hashids | id(){
if(!this.uniqueID){
var hashids = new Hashids(this.body.substring(0, this.body.length));
this.uniqueID = hashids.encode([Math.floor(Math.random() * Math.floor(1000))]);
}
return this.uniqueID;
} | [
"function generateUID(contentHash) {\n var timestamp = new Date().getTime().toString();\n return timestamp + contentHash;\n}",
"function getUniqueId() {\n // unique key : current milliseconds in base 36 concatenated with 8 random chars\n return new Date().valueOf().toString(36) + getRandomString(8);\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Send click data to the tutor (student request) | sendClick (x, y, page, selectedAnimal) {
const data = {x, y, page, selectedAnimal}
console.log(`sendClick ${data}`)
this.socket.emit('studentClick', data)
} | [
"function grant_access_click() {\n var json_dict = {};\n\n // Get the user select to extract the user's id\n select = document.getElementById(\"user-select\");\n json_dict[\"MOD_MELLON_uid\"] = select.value;\n\n // Get the patient id from the url\n json_dict[\"orthanc-id\"] = getPatientId();\n\n // construct... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Init zindex for portfolio items | function initPortfolioZIndex(){
"use strict";
if($j('.projects_holder_outer.portfolio_no_space').length){
$j('.no_space.hover_text article').each(function(i){
$j(this).css('z-index', i +10);
});
}
} | [
"function updateZindex(){\n\n // The CSS method can take a function as its second argument.\n // i is the zero-based index of the element.\n\n ul.find('li').css('z-index',function(i){\n return cnt-i;\n });\n }",
"function updateZindex(){\r\n\t\t\r\n\t\t// The CSS method c... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Oneway data binds the $columns array generated by ngTable/ngTableDynamic to the specified expression. This allows the $columns array created for the table to be accessed outside of the html table markup. | function ngTableColumnsBinding($parse) {
var directive = {
restrict: 'A',
link: linkFn
};
return directive;
function linkFn($scope, $element, $attrs) {
var setter = $parse($attrs.ngTableColumnsBinding).assign;
if (setter) {
$scope.$watch('$columns', function (... | [
"function ngTableColumnsBinding($parse) {\n var directive = {\n restrict: 'A',\n require: 'ngTable',\n link: linkFn\n };\n return directive;\n function linkFn($scope, $element, $attrs) {\n var setter = $parse($attrs.ngTableColumnsBinding).assign;\n if (setter) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
INSERT INTO lodgings SET ...; | async function insertNewLodging(lodging) {
lodging = extractValidFields(lodging, LodgingSchema);
const [ result ] = await mysqlPool.query(
"INSERT INTO lodgings SET ? ",
lodging
);
return result.insertId;
} | [
"async function insertNewLodging(lodging) {\n lodging = extractValidFields(lodging, LodgingSchema);\n const [ result ] = await mysqlPool.query(\n \"INSERT INTO lodgings SET ?\",\n lodging\n );\n return result.insertId;\n}",
"function addTour_Promotiontable(tour_id, promotion_id) {\n pool.query(\n \"... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
countChars ////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////// takes a string and a character create count holder variable loop through string and for each index, evaluate whether current character matches input character. If ... | function countChars(str, char) {
count = 0;
for (var i = 0; i <= str.length - 1; i++) {
if (str[i] === char) {
count++;
}
}
return count;
} | [
"function countChars(string, char) {\n var count = 0;\n for(let i = 0; i < string.length; i++){\n if(string[i] === char){\n count +=1;\n }\n }return count;\n \n}",
"function countChars(str,char){\n\tvar count =0\n\twhile(str !=\"\"){\n if(str[0] === char){\n \tcount++;\n }\n str = str.slice... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Value of a 3D vector property. | set vector3Value(value) {} | [
"get vector3Value() {}",
"get Vector3() {}",
"get vectorValue() {}",
"get() {\n const v3 = new PVector(this.x, this.y);\n return v3;\n }",
"get vector2Value() {}",
"get vector() {\n\n // Return the vector part of the quaternion\n return [this[1], this[2], this[3]];\n }",
"get vector4Value(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Beautiful Code, Chapter 1. Implements a regular expression matcher that supports character matches, '.', '^', '$', and ''. Search for the regexp anywhere in the text. | static match(regexp, text) {
if (regexp[0] === '^') {
return Util.match_here(regexp.slice(1), text);
}
while (text) {
if (Util.match_here(regexp, text)) {
return true;
}
text = text.slice(1);
}
return false;
} | [
"function Regexp() {}",
"match (regex) {\n return this.text.match(regex)\n }",
"function RegularExpression(){}",
"function testRegExp() {}",
"static match(regexp, text) {\n if (regexp[0] === '^') {\n return Util.match_here(regexp.slice(1), text);\n }\n while (text) {\n if (U... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Fetch the hot trends for the place (relating to the dropdown menu) Places them in the sidebar and inits the event handlers for clicks, etc. | function getGHotSearches(place) {
$.ajax({
url: 'hot',
method: 'get',
data: { geo: place },
success: function(data) {
var divs = "<div id='topTrends' class='list-group'>";
for(x in data) {
divs += "<a class='topItem list-group-item'>";
// the google icon for easy searchi... | [
"function handleTrends() {\n let w = window.innerWidth\n let trends = `div[data-testid=sidebarColumn] div:nth-last-child(2) > div:nth-child(1) ~ div[data-testid=trend]`\n\n waitForKeyElements(trends, function() {\n let $trends = $(trends)\n // move trends\n if (GM_getValue(\"opt_gt2\").leftT... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Calculates the cotangent of a value | function cot(value) {
return 1.0 / Math.tan(value);
} | [
"function getCotangent(v1, v2, v3) {\n var dV1 = vec3.create();\n vec3.sub(dV1, v1, v3);\n var dV2 = vec3.create();\n vec3.sub(dV2, v2, v3);\n var cosAngle = vec3.dot(dV1, dV2) / (vec3.len(dV1)*vec3.len(dV2));\n return cosAngle/Math.sqrt(1-cosAngle*cosAngle);\n}",
"function cot(num){\n if(isNum... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Converts a BigNumber integer value to an exponential value | bigNumberToExponent(significantDigits, forceExponentialResult) {
let value = this.numericValue;
if (value.constructor !== JQX.Utilities.BigNumber) {
value = new JQX.Utilities.BigNumber(value);
}
const numberLength = value._f;
let numericString = value.toString();
... | [
"bigNumberToExponent(significantDigits, forceExponentialResult) {\n let value = this.numericValue;\n\n if (value.constructor !== Smart.Utilities.BigNumber) {\n value = new Smart.Utilities.BigNumber(value);\n }\n\n const numberLength = value._f;\n let numericString = val... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
=============================================== Merge video fuitons start here ============================= ============================== / ====================== remove yesterday videos folders... | function removeYesterdayFolder() {
var d = new Date();
d.setMonth(d.getMonth() - 1);
let yesterday = d.getMonth() + '-' + d.getFullYear();
var dir = 'public/uploads/' + yesterday;
console.log('yesterday -------\n', yesterday)
// if (fs.existsSync(dir)){
// fs.unlinkSync(dir,function(err)... | [
"function removeAllVideos() {\n if (!confirm(\"delete all videos?\")) {\n return;\n }\n loadingProgress(1);\n setTimeout(() => {\n const toRebuild = [];\n subs.forEach((sub, i) => {\n sub.videos.forEach((vid, j) => {\n if (!subs[i].videos[j].isRemoved()) {\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Adds y axis for facebook events | function addFacebookAxis(g, y) {
let yAxis = d3.svg.axis()
.scale(y)
.orient("left");
g.append("g")
.attr("class", "y axis")
.call(yAxis);
} | [
"function ApexYAxis() { }",
"function onYAxisChange(value){\n\n}",
"function plotShowYaxisTicks( tEvent )\n{\n plotDraw( { type: \"plotShowYaxisTicks\" } );\n}",
"function drawYAxis() {\n g.selectAll(\".tasksgraph-axis--y\").remove();\n \n g.append(\"g\")\n .attr(\"class\", \"axis... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Chapter 12 After Class When Jennifer pleasures the player | function C012_AfterClass_Jennifer_PleasurePlayer() {
// The more it progresses, the faster Jennifer must go
CurrentTime = CurrentTime + 50000;
var StartCount = C012_AfterClass_Jennifer_PleasurePlayerCount;
if ((C012_AfterClass_Jennifer_PleasurePlayerCount >= 0) && (C012_AfterClass_Jennifer_PleasurePlayerCount <= ... | [
"function C009_Library_Jennifer_TestPleasurePlayer() {\n\tif ((ActorGetValue(ActorSubmission) <= -3) && (!C009_Library_Jennifer_OrgasmDone)) {\n\t\tOverridenIntroText = GetText(\"PleasureMeFirst\");\n\t\tC009_Library_Jennifer_CurrentStage = 270;\n\t}\n\tC009_Library_Jennifer_SetPose();\n}",
"function C012_AfterCl... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
bfs(): Traverse the array using BFS. Return an array of visited nodes. | bfs() {
const visitedNodes = [];
const nodeQueue = [this.root];
while(nodeQueue.length){
const currentNode = nodeQueue.shift();
visitedNodes.push(currentNode.val);
if(currentNode.left) nodeQueue.push(currentNode.left);
if(currentNode.right) nodeQueue.push(currentNode.right);
}
... | [
"bfs(node = this.root) {\n let queue = [];\n let visited = [];\n\n queue.push(node);\n\n while (queue.length) {\n node = queue.shift();\n visited.push(node.val);\n if (node.left) {\n queue.push(node.left);\n }\n if (node.right) {\n queue.push(node.right);\n }\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Copyright (c) 2018, salesforce.com, inc. All rights reserved. SPDXLicenseIdentifier: MIT For full license text, see the LICENSE file in the repo root or EXPERIMENTAL: This function provides access to the component constructor, given an HTMLElement. This API is subject to change or being removed. | function getComponentConstructor(elm) {
let ctor = null;
if (elm instanceof HTMLElement) {
const vm = getAssociatedVMIfPresent(elm);
if (!isUndefined$4(vm)) {
ctor = vm.def.ctor;
}
}
return ctor;
} | [
"function getComponentConstructor(elm) {\n let ctor = null;\n\n if (elm instanceof HTMLElement) {\n const vm = getAssociatedVMIfPresent(elm);\n\n if (!isUndefined(vm)) {\n ctor = vm.def.ctor;\n }\n }\n\n return ctor;\n } // Only set prototype for public methods and properties",
... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
removes all event listeners from the play button, except stylingChanges | function removePlayFunctions() {
play.removeEventListener("click", scrollDown);
play.removeEventListener("click", generatedGridRows);
play.removeEventListener("click", randomise);
play.removeEventListener("click", newGame);
play.removeEventListener("click", squareSize);
play.removeEventListener(... | [
"removeListenPlayButton() {\n\n this.playBtns.forEach(element => {\n element.removeEventListener('click', this.handlePlayButton, false);\n });\n\n }",
"removeListenPauseButton() {\n\n this.playBtns.forEach(element => {\n element.removeEventListener('click', this.handl... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns the canvas as an element that can be resized. This is relatively expensive. This method is deprecated, use asImageAsync instead. | asImage() {
const image = document.createElement("img");
image.src = this.canvas.toDataURL();
return image;
} | [
"ensureElement() {\n\t\tlet opts = this.options;\n\t\tlet el = opts.el;\n\t\tif (typeof el === 'string') {\n\t\t\tel = document.querySelector(el);\n\t\t}\n\t\tif (!el) {\n\t\t\tel = document.createElement('canvas');\n\t\t}\n\n\t\t// If the element that was given is not a canvas, then add a canvas to \n\t\t// it.\n\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Remove ALL Active Class From Images And Pagination Bullets | function removeAllActive(){
//Loop Through Images
sliderImages.forEach(function (img){
img.classList.remove('active');
});
//Loop Throgh Pagination Bullets
paginationsBullets.forEach(function(bullet){
bullet.classList.remove('active');
});
} | [
"function removeAllClass() {\n 'use strict';\n //loop through images\n images.forEach(function (image) {\n \n image.classList.remove('active');\n \n });\n \n paginationBullets.forEach(function (bullet) {\n bullet.classList.remove('active');\n });\n}",
"function removeAll... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
where a 0 in the returned array denotes a gap in the series. Parameters: totalPages: total number of pages page: current page maxLength: maximum size of returned array | function getPageList(totalPages, page, maxLength) {
if (maxLength < 5) throw "maxLength must be at least 5";
function range(start, end) {
return Array.from(Array(end - start + 1), (_, i) => i + start);
}
var sideWidth = maxLength < 9 ? 1 : 2;
var leftWidth = (maxLength - sideWidth * 2 - 3) >> 1;
var ... | [
"function generatePagesArray() {\n\n // The first page is always displayed\n ctrl.pages = [0];\n\n // if there are more pages than allowed, we need to exclude some pages:\n // 1 2 3 4 5 6 7 ... 15\n if (ctrl.pageData.total > ctrl.maxPagesToDisplay) {\n\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
NEW WAY FOF SORTING LIST array array tobe sorted, array must contain date as milliseconds date will used to sort the array by datye id or creation date, identify element by id to be added on the top of array after sorting | function sortByNewItemOnTop(array, date, id){
// sort by by id and get the new element
array = $filter('orderBy')(array, id);
var newItem = array[0];
array.splice(0,1);
// sort by descending date and put new item on top of the list
array = $filter('ord... | [
"function sortArray(arr) {\n arr.sort(function (a, b) {\n console.log(a.date + \" \" + b.date);\n var valA = a.date.split('-');\n var valB = b.date.split('-');\n\n const aDate = new Date(valA[2], valA[1] - 1, valA[0]);\n const bDate = new Date(valB[2], valB[1] - 1, valB[0]);\n\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Renders a Card containing information about the number of complete / incomplete todo items. | function SummaryCard({ numCompleted, numIncomplete }) {
return (
<Card title="Summary">
<p>Completed items: <strong>{numCompleted}</strong></p>
<p>Still to-do: <strong>{numIncomplete}</strong></p>
</Card>
);
} | [
"function renderTodo() {\n\n renderView(todos);\n let todoLength = todos.reduce((accu, value) => {\n return ((!value.isDone) ? accu += 1 : accu, accu);\n }, 0);\n document.querySelector('.todo-count strong').textContent = todoLength;\n clearCompleted.style.display = (todos.length) ? 'block' : 'n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns the function that persists a folder on the server. | function getPersistFolder(services) {
return function (folderInfo) {
// Variables.
var url = services.formulateVars.PersistFolder;
var data = {
ParentId: folderInfo.parentId,
FolderId: folderInfo.folderId,
FolderName: folderInfo.name
};
/... | [
"async saveFolder() {\n if (this.state.state !== 'LOADED_PINBOARD') {\n return;\n }\n let folder = this.state.folderBuffer.join('');\n if (this.state.predictedFolder !== 'undefined' && typeof this.state.predictedFolder !== 'undefined') {\n folder += this.state.predi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Random post and Recent Post by tag ver 1.0 by satankMKR/Makmur On 22 Jan 2013 Visit: /web/20130425101528 | function RandomRecenTag(b){(function(m){var j={blogURL:"",MaxPost:5,RandompostActive:true,idcontaint:"#randompost",thumbSize:100,jumlahhuruf:100,cmtext:"comments",pBlank:"/web/20130425101528/http://2.bp.blogspot.com/-D47WWjFZXdk/UP1z-A5uCuI/AAAAAAAAH98/heTBvxq49No/s1600/noimage.jpg",NoCmtext:"No Comment",tagName:false}... | [
"function loadThisTagsPosts(theTag) {\n\n theTag = theTag.replace(/_/g, ' ');\n var thisTagPosts = [];\n $.get(\"posts/posts.xml\", function(posts) {\n $(posts).find('post').each(function(i) {\n var this_post = $(this);\n // if post has tag being loaded\n this_post.find('tags').find('tag').each... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get the user name of a decoded JWT. | function userName(decodedToken) {
return jwt_1.readPropertyWithWarn(decodedToken, exports.mappingUserFields.userName.keyInJwt);
} | [
"function userName(jwtPayload) {\n return jwt_1.readPropertyWithWarn(jwtPayload, exports.mappingUserFields.userName.keyInJwt);\n}",
"function extractName(jwtToken){\n\tvar payload = jwt.decode(token);\n return payload.name;\n}",
"getUserName() {\n const claims = this.oauthService.getIdentityClaims(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
set current step text | function updateCurrentStep() {
current_step_text.innerHTML = recipe[current_step];
} | [
"function setMessage(current_step) {\n $(\"#whatIsNext\").html(step[current_step]);\n}",
"function changeStepText(){\n\t$('.step-counter').text('Step: ' + (stepNumber + 1));\t//Show current step number above drawing area\n\t\n\tif (stepNumber == 0){\n\t\t$('.btn-prev').css('visibility', 'hidden');\n\t} else{\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Method to check data length before visualization update. | checkDataLength(data) {
if (data.length <= CVE_BUBBLE_CHART_UPPER_BOUND_LIMIT) {
this.updateCveBubbleChart(modifyVisualizationData(data));
this.initializeLegends(getFormatedLegendsData(data));
} else {
this.props.dispatch(receiveNotifyAlertsResponse(BUBBLE_CHART_UPPER_BOUND_LIMIT_MESSAGE));
... | [
"function CheckDataLength(receivedData) {\n let length = receivedData.length;\n if (length < 250) {\n alert(`Sorry, we can get only Top${length} artists for ${Genre()} genre this time`);\n }\n }",
"function hasLength (data, length) {\n return assigned(data) && data.length ===... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
getInputValue(input_object) Get the value of any form input field Multipleselect fields are returned as commaseparated values (Doesn't support input types: button,file,password,reset,submit) | function getInputValue(obj) {
if ((typeof obj.type != "string") && (obj.length > 0) && (obj[0] != null) && (obj[0].type=="radio")) {
for (var i=0; i<obj.length; i++) {
if (obj[i].checked == true) { return obj[i].value; }
}
... | [
"function getSingleInputValue(obj,use_default) \n{\n\tswitch(obj.type){\n\t\tcase 'radio': case 'checkbox': return(((use_default)?obj.defaultChecked:obj.checked)?obj.value:null);\n\t\tcase 'text': case 'hidden': case 'textarea': return(use_default)?obj.defaultValue:obj.value;\n\t\tcase 'password': return((use_defau... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
method for getting admin quiz results | getQuizResults(id) {
this.setMethod('GET');
this.setAuth();
return this.getApiResult(`${Config.SESSION_API}/${id}/results`);
} | [
"function showQuizFinalResults(){\n\t\t\n\t}",
"getAdminQuizzes() {\n this.setMethod('GET');\n this.setAuth();\n delete this.options.body;\n return this.getApiResult(Config.QUIZ_API);\n }",
"getQuizList(){\n\t\tgetData(\"quizsubjectname/\",\n\t\t\t(() => {}),\n\t\t\t((res) => {\n\t\t\t\tconst quize... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Graph Helper Functions creates a scale mapping data in domain to pixels in range, with padding | function scale(type, domain, range, padding) {
var scale = null;
// modify range to allow for padding
if (range[0] > range[1]) {
range[0] -= padding;
range[1] += padding;
} else {
range[0] += padding;
range[1] -= padding;
}
if (type === 'linear') {
scale ... | [
"createScales() {\n // DOMAIN: range of values of input of data\n // RANGE: range of values of pixel space\n \n // 300px = index 20\n // this._xScale = d3.scaleLinear()\n // .domain([]) // input\n // .range([]); // output\n \n // 200px = 0... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Focus handler. Sets the focused state of particular item | _focusHandler() {
const that = this;
if (that.disabled || that._items.length === 0) {
return;
}
if (that._itemIsFocussed) {
that._selectedItem.focused = false;
}
else {
that._items[0].focused = false;
}
} | [
"handleFocus() {\n this.focused = true;\n this.updateItemList();\n\n document.addEventListener('click', this._handleClick);\n }",
"_focus(item) {\n this.$.listBox._focus(item);\n }",
"focus() {\n const item = this.focusableItem\n item && item.focus()\n }"... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
delete company: => 'Company deleted' | static async delete(handle) {
const result = await db.query(`DELETE FROM companies
WHERE handle = $1`,
[handle]);
if (result.rowCount === 0) {
throw new ExpressError(`Company ${handle} not found`, 404);
} else {
return 'Company deleted';
}... | [
"async delete(ctx){\n try{\n ctx.body = await ctx.db.Company.destroy({\n where:{\n id: ctx.params.id\n }\n })\n }catch (err){\n ctx.throw(err);\n }\n }",
"function deleteCompany() {\n console.log(\"Delete ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Enter a parse tree produced by LUFileParsernormalIntentString. | enterNormalIntentString(ctx) {
} | [
"enterParse(ctx) {\n\t}",
"enterNestedIntentNameLine(ctx) {\n\t}",
"visitNormalIntentString(ctx) {\n\t return this.visitChildren(ctx);\n\t}",
"main(){\n let argv = this.parseString.trim().split(' ');\n let directoryList = new Array();\n let fileList = new Array();\n let openFileList = new Array()... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function checkpomheightN() retrieves the POM Height value (from Add New Stem) entered by the user. The function checks to make sure that the value only contains numerics with the option of decimals. The function also constrains the value to 1.311. Save button is disabled or enabled depending on the status of the valida... | function checkpomheightN() {
pomh = document.forms["censusform"]["pomheight"].value;
if (pomh == null || pomh == "") {
return;
}
var regex = /^\d+(\.\d+)?$/
if (!new RegExp(regex).test(pomh)) {
alert("Please make sure that your POM Height only contains numerics.");... | [
"function checknpomheight() {\r\n\r\n npomh = document.forms[\"censusform\"][\"newpomheight\"].value;\r\n\r\n if (npomh == null || npomh == \"\") {\r\n return;\r\n }\r\n\r\n var regex = /^\\d+(\\.\\d+)?$/\r\n\r\n if (!new RegExp(regex).test(npomh)) {\r\n\r\n alert(\"Please make sure tha... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Format the response from SLPDB into an object. | async formatToRestObject (slpDBFormat) {
_this.BigNumber.set({ DECIMAL_PLACES: 8 })
// console.log(`slpDBFormat.data: ${JSON.stringify(slpDBFormat.data, null, 2)}`)
const transaction = slpDBFormat.data.u.length
? slpDBFormat.data.u[0]
: slpDBFormat.data.c[0]
// const inputs = transaction.... | [
"async formatToRestObject (slpDBFormat) {\n // console.log(`slpDBFormat.data: ${JSON.stringify(slpDBFormat.data, null, 2)}`)\n\n const transaction = slpDBFormat.data.u.length\n ? slpDBFormat.data.u[0]\n : slpDBFormat.data.c[0]\n\n // const inputs = transaction.in\n\n // const outputs = transac... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
call Goodreads API to get Edgar Award books | function getEdgarListJSON(shelf_name, year, category, eventCallback) {
shelf_name = shelf_name.replace(' ','+');
request.get({
url: "https://www.goodreads.com/review/list/60491294.xml?key=APIKEY&v=2&order=a&shelf=" + shelf_name
}, function(err, response, body) {
parseString(body, {explicitArray : f... | [
"static async getBook(ctx, next) {\n const market = ctx.params['market'];\n const exch1 = ctx.request.query.exch1;\n const exch2 = ctx.request.query.exch2;\n try {\n const book = await OrderBook.getOrderBook({ market, exch1, exch2 });\n return Response.success(ctx, ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This is called by the service implementation object, which is the only authority with knowledge on the true authentication status. This will e.g. get called when an authentication token expires or a user logs out, and the service implementation object concludes that we are therefore no longer authenticated. | _deauthenticate() {
/* istanbul ignore next */
if (this._type !== ServiceType.PRIVATE) {
throw new Error(
'_deauthenticate must not be called on a Local or Public Service'
);
}
if (
this._state.inState([ServiceState.READY, ServiceState.AUTHENTICATING])
) {
this._auth... | [
"function isAuthenticated() {\n return !!service.currentUser;\n }",
"function onceAuthenticated(callback) {\n if (authManager.isAuthenticated()) {\n callback();\n return;\n }\n $rootScope.$on('authenticated', () => {\n callback();\n });\n }",
"_check... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns this character''s ambient frames array or an array containing a single empty frame if it has no ambient motion. | getAmbientFrames() {
var amb;
//---------------
amb = this.ambientAnim;
if (amb) {
return amb.getAmbientFrames();
} else {
return [this.getEmptyPose()];
}
} | [
"get ambient() {\n return vec4(\n sceneProperties.ambientIntensity,\n sceneProperties.ambientIntensity,\n sceneProperties.ambientIntensity,\n 1.0\n );\n }",
"function calculateAmbient(){\n\n var color=[];\n for (i =0; i < light.length; i++){\n co... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
enter card to a player's yes array call when you know this player has this card | function enterCardToYes(yesPlayer, yesCard)
{
console.log("enter " + yesCard + " to player " + yesPlayer);
if(yesPlayer > (Np-1)) // if the input player is greater than the total number of players
{
alert("Invalid player");
return;
}
var type = cardType(yesCard); // get card type
var yesCardIndex;
switch(ty... | [
"function enterCardToNo(noPlayer, noCard)\n{\n\tconsole.log(\"enter card \" + noCard + \" to player \" + noPlayer + \" no array\");\n\tif(noPlayer > (Np-1))\t// if the input player is greater than the total number of players\t\n\t{\n\t\talert(\"Invalid player\");\n\t\treturn;\n\t}\n\tvar type = cardType(noCard);\t/... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns all the values for the key gameType, from the Ticket History Results | @action getAllGameTypesFromTicketHistoryResult() {
return this.getAllValuesForKeyFromJSONObjectArray(this.TicketHistoryAPIResult, 'gameType');
} | [
"async getHistory(key) {\n\n let ledgerkey = this.ctx.stub.createCompositeKey(this.name, State.splitKey(key));\n const resultsIterator = await this.ctx.stub.getHistoryForKey(ledgerkey);\n let results = await this.getAllResults(resultsIterator, true);\n\n return results;\n }",
"getGa... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
pop a particle from recycle bin | popRecycle () {
if (this.emittedParticles > this.maxParticles - 1) {
return null
}
++this.emittedParticles
var particle = this.recycleBin.pop()
if (particle) {
particle.reset()
this.emit('particle.recycle',
particle)
return particle
}
particle = new Pa... | [
"pushRecycle (particle) {\n\n --this.emittedParticles\n\n particle.recycled = true\n\n this.emit('particle.recycle',\n particle)\n\n this.recycleBin.push(\n particle)\n }",
"removeParticle(p) {\n\t\tfor (var i = 0; i < this.particles.length; i++) {\n\t\t\tif (p == this.particles[i]) {\n\t\t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
JD_TO_ISO Return array of ISO (year, week, day) for Julian day | function jd_to_iso(jd)
{
var year, week, day;
year = jd_to_gregorian(jd - 3)[0];
if (jd >= iso_to_julian(year + 1, 1, 1)) {
year++;
}
week = Math.floor((jd - iso_to_julian(year, 1, 1)) / 7) + 1;
day = jwday(jd);
if (day == 0) {
day = 7;
}
return new Array(y... | [
"function jd_to_iso(jd)\n{\n var year, week, day;\n\n year = jd_to_gregorian(jd - 3)[0];\n if (jd >= iso_to_julian(year + 1, 1, 1)) {\n year++;\n }\n week = Math.floor((jd - iso_to_julian(year, 1, 1)) / 7) + 1;\n day = jwday(jd);\n if (day == 0) {\n day = 7;\n }\n return new... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
createShapes: take as input the cavas configuration object and the string containing the configuration , than draws the shapes filling them with the right color | function createShapes(s_command){
var status_array_vitamins=commandToArray(s_command);
var tmp_stage = new Konva.Stage({container: 'container', width: window.innerWidth, height: CONST_HEIGHT});
var tmp_layer = new Konva.Layer({id:"main_l"});
function showShapes(array_v) {
for(var i=0;i<array_v.... | [
"function shapeConfig() {\n\n var service = this;\n\n const NODE_ID = 0;\n const SQUARE_ID = 1;\n const RECTANGLE_ID = 2;\n\n var shapes = [\n\n {\n \"id\" : NODE_ID,\n \"name\" : \"NODE\",\n \"value\" : \"Node\",\n \"src\" ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Determines whether the focus is outside fullpage.js sections/slides or not. | function isFocusOutside(e) {
var allFocusables = getFocusables(document);
var currentFocusIndex = allFocusables.indexOf(document.activeElement);
var focusDestinationIndex = e.shiftKey ? currentFocusIndex - 1 : currentFocusIndex + 1;
var focusDestination = allFocusables[focusDestinationIndex];
... | [
"function isFocusOutside(e) {\n var allFocusables = getFocusables(doc);\n var currentFocusIndex = allFocusables.indexOf(doc.activeElement);\n var focusDestinationIndex = e.shiftKey ? currentFocusIndex - 1 : currentFocusIndex + 1;\n var focusDestination = allFocusables[focusDestinationIndex];\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Determine if bot should respond to the message. | function shouldRespond(message) {
return message.type === MESSAGE && message.text;
} | [
"function respond() {\n var request = JSON.parse(this.req.chunks[0]);\n message = request.text;\n if (message.charAt(0) == '!') {\n response = run(request);\n send(response, this);\n }\n}",
"get hasReplyMessage() {\r\n return this.replyMessage !== undefined;\r\n }",
"get isReplyRequired() {\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Accept an incoming session. | accept() {
super.accept()
// Handle connecting streams to the appropriate video element.
this.session.on('track', this._onTrackAdded.bind(this))
this.session.accept({
sessionDescriptionHandlerOptions: {
constraints: this.app.media._getUserMediaFlags(),
... | [
"accept() {\n super.accept()\n // Handle connecting streams to the appropriate video element.\n this.session.on('track', this.onTrack.bind(this))\n this.session.accept({\n sessionDescriptionHandlerOptions: {\n constraints: this.app.media._getUserMediaFlags(),\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
set position to alive and update the neighbors caches. | function set(cMap, x, y, alive) {
if (cMap[x][y].alive === alive) {
return;
}
cMap[x][y].alive = alive;
cMap[x][y].modified = true;
for (var i=0; i < DIRS_LENGTH; i++) {
var dir = DIRS[i];
var nx = x + dir[0];
var ny = y + dir[1];
if (nx < 0 ||... | [
"setAlive() {\n this.currentlyAlive = true;\n this.aliveNext = true;\n }",
"function updateLiveNeighbors(grid) {\n var i, j;\n for (i = 0; i < NUM_ROWS; i++)\n {\n for (j = 0; j < NUM_COLS; j++)\n {\n grid[i][j].liveNeighbors = countLiveNe... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get n cards off the top of the deck. Optionally remove the cards | GetCards(n, remove=true) {
assert(n>0);
assert(this._index.length >= n, `can not access ${n} cards (only ${this._index.length} in deck)`);
const action = (remove) ? 'removing':'peeking';
log.debug(`Deck: ${action} ${n} cards from top of deck (of ${this._index.length})`);
const in... | [
"dealCards(n) {\n this.hands.forEach(hand => {\n for(let i = hand.cards.length; i < n; i++) {\n hand.cards.push(this.popTopCardFromDeck());\n }\n });\n }",
"takeCards(n)\n\t{\n\t\tlet cards = new Set();\n\t\tlet randomCardInDeck;\n\t\tlet randomIndexInDeck;\n\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
this is explaining createProduct, updateProduc, and deleteProduct saveProduct, modifyProduct, and destroyProduct functions are called from services/api.js respectively fetchProducts brings back all the products setState to products brings the new data we got back | createProduct(product) {
saveProduct(product)
.then(data => fetchProducts())
.then(data => {
this.setState({ products: data });
});
} | [
"function loadProducts() {\n \n productAPI\n .getProducts()\n .then((res) => setProducts(res.data))\n .catch((err) => console.log(err));\n }",
"function updateProduct () {\n\t\t\tcurrentId = productIds[currentIndex];\n \t\tvm.product = products[currentId];\n \t\tcheckWeirdImage(vm.product.e... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
return text prime factorization return 1 if input N is non positive integer or N<2 report repeated prime as repeated numbers (c) 20102016 Kardi Teknomo all rights reserved | function PrimeFactorization0(N)
{
if(isPosInteger(N) & N >=2 & N<MAXLIMIT)
{
p = 2;
txt = N + " = ";
while (N >= p * p)
{
if (N % p == 0)
{
txt += p + " * ";
N = N / p; //divide by prime number
}
else
{
p++;
}
}
txt += N;
return txt;
}
else
{
return false;
}
} | [
"function PrimeFactorization(N)\n{\n\tif(isPosInteger(N) & N >=2 & N<MAXLIMIT)\n\t{\n\t\tvar p = 2;\n\t\tvar i = 0;\n\t\tvar arr = new Array();\n\t\tvar txt = N + \" = \";\n\t\twhile (N >= p * p)\n\t\t{\n\t\t\tif (N % p == 0)\n\t\t\t{\n\t\t\t\tarr[i]=p;\n\t\t\t\tN = N / p;\t//divide by prime number\n\t\t\t\ti++;\n\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
jogadas possiveis na diagonal | function verificarJogadasDiag(player) {
let jogadas = [];
let pecasJogador = pecasJogadorB;
let pecaAdversario = "dark";
if(player == "dark") {
pecasJogador = pecasJogadorP;
pecaAdversario = "light";
}
for(let i=0; i<pecasJogador.length; i++) {
let pos = pecasJogador[i];
// conversão ... | [
"function diagonals(matrix){ \n let firstDignal = 0;\n let secDignal = 0; \n for(let i=0; i<matrix.length; i++){ \n for(let z=0; z<matrix.length; z++){ \n if(i === z) { \n firstDignal += matrix[i][z];\n } \n if(i + z === ma... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create a new panel. | createPanel(page, xStart, yStart, xGridWidth, yGridHeight) {
let newPanel = new Panel(page, xStart, yStart, xGridWidth, yGridHeight);
menuElements[page].push(newPanel);
return newPanel;
} | [
"function createPanel(){\n var panel = document.createElement('div');\n panel.classList.add('panel');\n panel.classList.add('panel-default')\n var panelBody = document.createElement('div');\n panelBody.classList.add('panel-body');\n var panelFooter = document.createElement('div');\n panelFooter... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Initializes an instance of the InMemoryStorageAdapter | function InMemoryStorageAdapter() {
// Initializing the storage object
this._storage = {};
} | [
"init() {\n this.setStorage();\n }",
"function initStorage() {\n storage.initSync();\n}",
"function InMemoryStorageService() {\r\n var _this = _super.call(this, StorageTranscoders.JSON) || this;\r\n /**\r\n * A map that serves as the underlying backing storage for this service.\r\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Add a scrolling background | setupScrollingBG() {
this.background.addChild(this.scrollingBG);
} | [
"function _createScrollBackground() {\n\n // Create scrollView from array\n this.scrollViews = [];\n this.scrollview = new Scrollview();\n this.scrollview.sequenceFrom(this.scrollViews);\n\n // Create background view and backround surface\n this.backgroundView = new View({\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
update(cells) Creates a temporary copy of the next iteration of cells. Overwrites the current iteration of cells once completed to be updated at the next frame. | function update() {
var nextIter = [];
for (i=0; i<cells.length; i++) {
nextIter.push([]);
for (j=0; j<cells[i].length; j++) {
var numNeighbors = 0;
var cell = new Cell(i*cellSize, j*cellSize);
if (i>0 && cells[i-1][j].alive) {
numNeighbors++;
}
if (i<cells.length-1 && cells[i+1][j].alive) {
... | [
"Update() {\n for (var i = 0; i < this.cellCount; i++) {\n this.cells[i].Update();\n }\n }",
"updateCells() {\n // Flatten 2D cells array to 1D array\n let cells1D = [].concat(...this.cells); \n // Calculate how many NEIGHBOURS CELL has\n cells1D.map( cell =... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Runtime helper for checking keyCodes from config. exposed as Vue.prototype._k passing in eventKeyName as last argument separately for backwards compat | function checkKeyCodes(eventKeyCode,key,builtInAlias,eventKeyName){var keyCodes=config.keyCodes[key]||builtInAlias;if(keyCodes){if(Array.isArray(keyCodes)){return keyCodes.indexOf(eventKeyCode)===-1;}else{return keyCodes!==eventKeyCode;}}else if(eventKeyName){return hyphenate(eventKeyName)!==key;}} | [
"function checkKeyCodes(eventKeyCode,key,builtInAlias,eventKeyName){var keyCodes=config.keyCodes[key] || builtInAlias;if(keyCodes){if(Array.isArray(keyCodes)){return keyCodes.indexOf(eventKeyCode) === -1;}else {return keyCodes !== eventKeyCode;}}else if(eventKeyName){return hyphenate(eventKeyName) !== key;}}",
"f... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
The default TemplateFactory which caches Templates keyed on result.type and result.strings. | function defaultTemplateFactory(result) {
let templateCache = templateCaches.get(result.type);
if (templateCache === undefined) {
templateCache = new Map();
templateCaches.set(result.type, templateCache);
}
let template = templateCache.get(result.strings);
... | [
"function defaultTemplateFactory(result) {\n var templateCache = templateCaches.get(result.type);\n if (templateCache === undefined) {\n templateCache = new Map();\n templateCaches.set(result.type, templateCache);\n }\n var template = templateCache.get(result.strings);\n i... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
prepare update is where you compute the diff for an instance. This is done here to separate computation of the diff to the applying of the diff. Fiber can reuse this work even if it pauses or aborts rendering a subset of the tree. | prepareUpdate(instance, type, oldProps, newProps, rootContainerInstance, hostContext) {
log('TODO: prepareUpdate');
//return null;
//return diffProperties(instance, type, oldProps, newProps, rootContainerInstance, hostContext);
return newProps;
} | [
"prepareUpdate(\n instance,\n type,\n oldProps,\n newProps,\n rootContainerInstance,\n hostContext\n ){\n log('TODO: prepareUpdate');\n return null;\n // return diffProperties(instance, type, oldProps, newProps, rootContainerInstance, hostContext);\n }",
"prepareUpdate(instance, type,... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Subtracts the given scalar from each element of the given 4x4 matrix. | subMat4Scalar(m, s, dest) {
if (!dest) {
dest = m;
}
dest[0] = m[0] - s;
dest[1] = m[1] - s;
dest[2] = m[2] - s;
dest[3] = m[3] - s;
dest[4] = m[4] - s;
dest[5] = m[5] - s;
dest[6] = m[6] - s;
dest[7] = m[7] - s;
dest[8]... | [
"subtract(matrix) {\r\n if (typeof (matrix) === 'number') {\r\n return this.map(x => x - matrix);\r\n }\r\n\r\n let M = matrix.elements || matrix;\r\n if (typeof (M[0][0]) === 'undefined') {\r\n M = Matrix.create(M).elements;\r\n }\r\n if (!this.isSameSizeAs(M)) {\r\n return null;\r... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns true if any mutation queue contains the given document. | function mutationQueuesContainKey(txn, docKey) {
var found = false;
return mutationQueuesStore(txn).iterateSerial(function (userId) {
return mutationQueueContainsKey(txn, userId, docKey).next(function (containsKey) {
if (containsKey) {
found = true;
}
return PersistencePromise.resolve... | [
"function mutationQueuesContainKey(txn, docKey) {\n var found = false;\n return mutationQueuesStore(txn).iterateSerial(function (userId) {\n return mutationQueueContainsKey(txn, userId, docKey).next(function (containsKey) {\n if (containsKey) {\n found = true;\n }\n\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
on change password user click | function onChangePasswordUserClick() {
gCustomerId = $(this).data('id');
$('#modal-update-password').modal('show');
} | [
"function onEditPassword() {\n app.sendAny(\"AdminChangePassword\", {\n oldPassword: self.modalOldPassword().trim(),\n newPassword: self.modalNewPassword().trim(),\n }, function(res) {\n if (!res.isError()) {\n Alert.info('Your password has been changed... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Appends a card of DRC controls and graphs to the specified parent. Args: parent The parent element index The index of this DRC component (02) lower_freq The lower frequency of this DRC component freq_label The label for the lower frequency input text box | function drc_card(parent, index, lower_freq, freq_label) {
var top = document.createElement('div');
top.className = 'drc_data';
parent.appendChild(top);
function toggle_drc_card(enable) {
toggle_card(div, enable);
toggle_one_drc(index, enable);
}
var enable_button = new check_button(top, toggle_drc_... | [
"startParentControl() {\n let _this = this;\n this.set('_delayLookingMeasurementPeriodTimer', window.setTimeout( function() {\n _this.set('_totalLookaway', 0);\n _this.set('_anyLookDuringControlPeriod', _this.get('_isLooking'));\n _this.set('_trialStartTime', new Date(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get data from a file from key | get(key, callback) {
fs.readFile('./data' + '/' + md5(key), 'utf8', (err, data) => {
if (err) callback(false);
else callback(data);
});
} | [
"getValue(filename, key) {\n if (filename in this.data && key in this.data[filename]) {\n return this.data[filename][key];\n }\n return null;\n }",
"function read(key){\r\n var fs = require('fs');\r\n fs.readFile('datastore.json', function (err, data) {\r\n if(err){\r\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
the end menu. prompts the user | function end(){
inquirer.prompt({
name: "endScreen",
type: "list",
message: "What would you like to do now?",
choices: [
"continue shopping",
"quit"
]
}).then(function(answer){
if(answer.endScreen === "continue shopping"){
store... | [
"function End() {\n var end = readline.question ('Would you like to end your purchase on this vending machine?');\n if (end == 'yes'){\n console.log('Thanks for using this vending machine, bye!');\n process.exit();\n } else if (end == 'no'){\n NoCredit();\n }else {\n YN ();\n End ();\n }\n}",
... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Content filter function, strips the extra linebreaks made by nicely formatting template code | function lineBreakFilter(content) {
return content.replace(/\n\s*\n/g, '\n')
} | [
"function removeWhitespace(template) {\r\n return template.replace(/ {2,}/mg, \"\").replace(/\\r|\\n/mg, \"\");\r\n}",
"function splitContent(rawContent) {\n var contentParts = rawContent.split(config.splitContent.character);\n var contentFormated = \"\";\n\n $.each(c... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Updates the page's offset given the scroll position. | updatePage(){
let curPage = this.options.paging.offset,
idxs = this.getFirstLastIndexes();
if (this.options.internal.oldScrollPosition === undefined){
this.options.internal.oldScrollPosition = 0;
}
let oldScrollPosition = this.options.internal.oldScrollPosition,
newPage = idxs.fi... | [
"_updatePageScrollOffset() {\n this.setScrollOffset(0, window.pageYOffset);\n }",
"_updatePageScrollOffset() {\r\n this.setScrollOffset(0, window.pageYOffset);\r\n }",
"updateScrollMagicOffset() {\n\t\tlet manualOffset = 40;\n\t\tlet offset = (window.innerHeight - this.elem.offsetHeight) / 2;\n\n\t\tif ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
End of populateContacts function NOTE: Some of this function's functionality is gathered from Appcelerator's Example Employee Directory app. This function is used to populate the Pending Contacts list from remote database. | function populatePending()
{
// Temporary array
var tempArray = null;
// Holds pending contacts
var pendingList = new Array();
// Function to use HTTP to connect to a web server and transfer the data.
var request1 = Ti.Network.createHTTPClient({
onerror: function(e){
Ti.API.debug(e.error);
alert... | [
"function getContactsList(){\n\tpopulateContacts();\n}",
"function pullContacts () {\n // Fetch contacts from server\n const url = \"/contacts\";\n fetch(url)\n .then(response => console.log(response))\n .catch((reject) => {\n console.log('reject', reject);\n });\n\n // Merge (rewrite) fetched c... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Reset product quantity to 0 | resetProductQuantity() {
this.quantity = 0;
} | [
"function resetHardwareQuantities(){\n _.each($$.products, (obj,key) => obj.quantity.val(0));\n }",
"function resetPriceQuantity() {\r\n\t$('#price').prop('value', 0);\r\n\t$('#quantity')\r\n\t\t.prop('disabled', true)\r\n\t\t.prop('value', 0);\r\n}",
"clear() {\n Array.from(self.cart.keys()).for... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates a listener and adds it to the projectKeydropdown. If a project is selected, further filter elements can be filled. | function createListener(viewIdentifier) {
function onSelectProject() {
var projectKey = document.getElementById("project-dropdown-" + viewIdentifier).value;
if (projectKey) {
conDecAPI.projectKey = projectKey;
// reset cashed settings of former project
conDecAPI.knowledgeTypes = [];
conDecGroupi... | [
"function createListener(viewIdentifier) {\n\t\tfunction onSelectProject() {\n\t\t\tvar projectKey = document.getElementById(\"project-dropdown-\" + viewIdentifier).value;\n\t\t\tif (projectKey) {\n\t\t\t\tconDecAPI.projectKey = projectKey;\n\t\t\t\tconDecFiltering.fillDropdownMenus(viewIdentifier);\n\t\t\t\tconDec... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Rollover Functions and Objects ///////////////// Rollover Object | function rolloverObject(imageReference, normalState, rolloverState, rolloverText) {
// Properties \\
this.imageReference = imageReference;
this.normalState = new Image();
this.rolloverState = new Image();
this.rolloverText = rolloverText;
this.normalState.src = normalState;
this.rolloverSta... | [
"function initSlidesRollover(){\n $slides.hover(over,out);\n\n function over(){\n spreadImages();\n }\n\n function out(){\n moveImages();\n }\n }",
"function objRollover (strOnImage, strOffImage, objProject)\r\n{\r\n\tthis.on = new Image();\r\n\tthis.off = new Image();\r\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Affiche les div de checkbox de chaque itineraire dans le panneau de controle de la carteReseau | function initialiserCheckboxReseau()
{
for (let i = 0; i < checkboxElementArray.length; i++)
{
reseauDivContent.querySelector("#allCheckboxsDiv").appendChild(checkboxElementArray[i]);
}
} | [
"function init_frm_carga_inpt_chk_panel_secundario() {\n // para cada checkbox de este tipo\n $.each($('.chk-habilitar-panel-secundario'), function (index, item) {\n var checkbox = $(item);\n\n // listener de change\n checkbox.on(\"change\", function () {\n var chkCaller = $(th... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Calls the willTransitionTo hook of all handlers in the given matches serially with the transition object and any params that apply to that handler. Returns a promise that resolves after the last handler. | function runTransitionToHooks(matches, transition) {
var promise = Promise.resolve();
matches.forEach(function (match) {
promise = promise.then(function () {
var handler = match.route.props.handler;
if (!transition.isAborted && handler.willTransitionTo)
return handler.willTransitionTo(tran... | [
"function runTransitionFromHooks(matches, transition) {\n var promise = Promise.resolve();\n\n reversedArray(matches).forEach(function (match) {\n promise = promise.then(function () {\n var handler = match.route.props.handler;\n\n if (!transition.isAborted && handler.willTransitionFrom)\n retu... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
redirects to Spotify for authorization | function authorizeSpotify() {
const state = `${Date.now()}`;
const url = `https://accounts.spotify.com/authorize?response_type=token&client_id=${encodeURIComponent(_spotify.CLIENT_ID)}&scope=${encodeURIComponent(_spotify.SCOPE)}&redirect_uri=${encodeURIComponent(_spotify.REDIRECT_URI)}&state=${encodeURIComponent(st... | [
"authenticateSpotify(res) {\r\n const state = this.generateRandomString(8);\r\n\r\n // res.cookie(stateKey, state);\r\n const scope = 'user-read-private user-read-playback-state user-modify-playback-state user-read-currently-playing'\r\n res.redirect('https://accounts.spotify.com/authorize?' +\r\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Mutable structure representing the current parse output. | function ParseOutput() {
this.lines = [ ];
this.currentLine = [];
this.currentLineListItemType = null;
} | [
"function ParseOutput() {\n this.lines = [];\n this.currentLine = [];\n this.currentLineListItemType = null;\n }",
"function ParseOutput() {\n this.lines = [];\n this.currentLine = [];\n this.currentLineListItemType = null;\n }",
"replaceoutput()... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This endpoint allows you to retrieve the block by hash (GET endpoint) | getBlockByHash() {
this.app.get("/block/hash/:hash", async (req, res) => {
if (req.params.hash) {
const hash = req.params.hash;
logger.info('hash: ' + hash);
let block = await this.blockchain.getBlockByHash(hash);
if (block) {
... | [
"getBlockByHash() {\n this.app.get(\"/stars/hash::hash\", (req, res) => {\n this.blocks.getBlockByHash(req.params.hash)\n .then(block => res.json(this._addDecodedStory(block)))\n });\n }",
"async getBlockByHash(request, h) {\n var block = await mBlockModel.BlockModel.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Populates key1 and key2 Generates encrypted messages and provides user the information they need to solve the puzzles | function populateKey() {
document.getElementById("encrypt_form").addEventListener("submit", test_encrypt);
document.getElementById("decrypt_form").addEventListener("submit", test_decrypted);
// Generate a key and initialize key1
key1 = keyGen(msg.length);
// Generate the encrypted message that the user needs to do... | [
"main_encrypt(alpha, msg, key1, key2){\n msg = sub_encrypt(alpha, msg, key1);\n msg = transcrypt(msg);\n msg = sub_encrypt(alpha, msg, key2);\n return msg;\n }",
"main_decrypt(alpha, msg, key1, key2){\n msg = sub_decrypt(alpha, msg, key2);\n msg = transcrypt(msg);\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
project_match Of all projects defined in the config file, find the projectname that matches (if it is defined.) If there is no project match then return null. | function project_match(address, type, config){
for(projectID in config.projects){
if(config.projects[projectID].enabled) {
projectName = config.projects[projectID].name;
if(address.substring(1, projectName.length + 1) == projectName) //strip leading '/'
return config.projects[projectID];
}
}
return nul... | [
"function getExactProjectMatch(namespace, project, projects) {\n let exact_match\n\n projects.filter((item) => {\n if (item.path_with_namespace == `${namespace}/${project}`) {\n exact_match = item\n }\n })\n\n return exact_match\n}",
"findProjectByTempName(tempProjectName) {\n // Is there an... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Poll the new image until the browser knows a valid height for it. Polling is limited to 5 seconds max, in case the image failed loading. | function pollImageHeight(img, imgCallback) {
var progressWidget = $('#progress_widget');
var widgetTimeout = setTimeout(function () {
progressWidget.addClass('progress');
}, 1000);
var count = 50;
var poll = setInterval(function() {
count--;
... | [
"function imageLoaded(img){\r\n\t\treturn new Promise(function(resolve,reject){\r\n\t\t\tvar checkInterval = setInterval(function(){\r\n\t\t\t\t\tif(checkImageLoaded(img)){\r\n\t\t\t\t\t\tclearInterval(checkInterval);\r\n\t\t\t\t\t\tresolve();\r\n\t\t\t\t\t}\r\n\t\t\t\t},50);\r\n\t\t});\r\n\t}",
"async imgHeight(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
get PUID's corresponding PUIDindex | function getPUIDindex(PUID) {
var PUIDindex = "";
for (var i=0;i<$("#PartitionNumA").html();i++) {
if (PUID == $("#PUIDstateStr"+"1"+i).html()) {
PUIDindex = "1" + i;
break;
}
}
for (var j=0;j<$("#PartitionNumB").html();j++) {
if (PUID == $("#PUIDstateStr"+"2"+j).html()) {
PUIDindex = "2" + j;
bre... | [
"function getUID() {\n users.sort();\n for (var i = 0; i < users.length; ++i)\n if (i < users[i]) return i;\n return i;\n}",
"function getUIDFromIndex(index){\n\tconst data = fs.readFileSync(toytagFileName, 'utf8');\n\tconst databases = JSON.parse(data);\n\tvar uid;\n\tdatabases.forEach(db => {\n\t\tif(inde... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |