query
stringlengths
9
34k
document
stringlengths
8
5.39M
negatives
listlengths
19
20
metadata
dict
empty out every timeline; kill every tween.
killAnimations() { this.timelines.forEach((timeline) => { this.killTimeline(timeline); }); this.tweens.forEach((tween) => { this.killTween(tween); }); this.timelines = []; this.tweens = []; }
[ "static removeAllTweens () {\n\t\tlet tween = Tween._tweenHead;\n\t\twhile (tween) {\n\t\t\tlet next = tween._next;\n\t\t\ttween._paused = true;\n\t\t\ttween.target && (tween.target.tweenjs_count = 0);\n\t\t\ttween._next = tween._prev = null;\n\t\t\ttween = next;\n\t\t}\n\t\tTween._tweenHead = Tween._tweenTail = nu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
mousemove Calculates how far along the slider the mouse is now, changes the color accordingly, and updates the screen. Value is clipped to [0, 1].
function mousemove(event) { if (! current_slider) return; var pct = (event.pageX - current_slider.offsetLeft) / current_slider.offsetWidth; if (pct < 0) pct = 0; if (pct > 1) pct = 1; var parts = current_slider.parentNode.id.split('-'); current_color.set(CHANNELS[parts[1]], pct); // To ma...
[ "function handleMouseMoveSlider() { \n if (!factorMouse) {\n return;\n }\n factor = slider.value; //Get slider value\n factor = factor / 100; \n console.log(factor);\n \n}", "function mouseMoved(){\n stroke(r, g, b, 120);\n strokeWeight(5);\n fill(r, g, b, 100);\n ellipse(mouseX, mouse...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
const test5 = 50;
function renderVaraibles() { var test = 20; let test1 = 30; if (test == 20) { var test4 = 40; const test5 = 60; hello = "hello"; // console.log(hello); } // console.log(hello); }
[ "function testconstant(){\n\t//d=\"test1\" error assignment to constant variable\n\tconst d=\"test1\";\n\tconsole.log(d);\n}", "function declaredConst02(){\n const myConst02 = \"07 - First Assigned value\";\n console.log(myConst02); //output: 07 - First Assigned value\n}", "function unaFuncion(){\n con...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
npm config set key value npm config get key npm config list
function config (args, cb) { var action = args.shift() switch (action) { case 'set': return set(args[0], args[1], cb) case 'get': return get(args[0], cb) case 'delete': case 'rm': case 'del': return del(args[0], cb) case 'list': case 'ls': return npm.config.get('j...
[ "function setNpmConfig(config) {\n const text = Object.keys(config).reduce((str, key) => str + `${key}=${config[key]}\\n`, '');\n writeFileSync('.npmrc', text, { encoding: 'utf8' });\n}", "setVar(key, defaultValue, providerConfig) {\n let value = defaultValue;\n if (process.env[`npm_config_${k...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
constructor & methods below ///// Constructor function for Alpha Pos System
function AlphaPos () { }
[ "function Alpha(){}", "constructor(pos,vec){\n this.pos = pos //this is still pretty uncivilized but the vector and position class are almost identical\n this.vec = vec\n this.baseSpeed = 4\n this.range = 300\n }", "constructor(lens, data, beamwidth, aiming) {\n\n\t \t // global paper \n th...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Save all information about the text node to the database
async save(index) { const work = await Work.findOne({ where: { filename: this.filename, }, }); const textNode = await TextNode.create({ index, location: this.location, text: this.text, }); await textNode.setWork(work); await work.addTextnode(textNode); return textNode; }
[ "function save() {\n $editors.find('.text').each(function () {\n $(this).closest('.fields').find('textarea').val(this.innerHTML);\n });\n }", "function saveText (txt) {\n var IMDB_DIR = Ember.$ (\"#imdbDir\").text ();\n if (IMDB_DIR.slice (-1) !== \"/\") {IMDB_DIR = IMDB_DIR...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
sets the background color of all selected cards back to white clears the user.cardSelectedStack back to empty [] removes played cards from the users hand array
function removeResetSelectedFromHand() { user.hand_fallback = user.hand; //take snapshot of hand's state before mutating hand so that in event of server post error, can reset hand for (let i = 0; i < user.cardSelectedStack.length; i++) { document.getElementById("td_" + user.cardSelectedStack[i]).remove(...
[ "function resetSelected() {\n for (let i = 0; i < user.cardSelectedStack.length; i++) {\n document.getElementById( user.cardSelectedStack[i] ).style.backgroundColor = \"white\";\n }\n user.cardSelectedStack = []; //reset\n user.cardSelectedStack_toServ = []; //reset\n}", "function clearSelected...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Stringifies the given PolicyTrapKind on the given path
function stringifyPolicyTrapKindOnPath(kind, path) { switch (kind) { case "__$$_PROXY_GET" /* GET */: return `get ${path}`; case "__$$_PROXY_APPLY" /* APPLY */: return `${path}(...)`; case "__$$_PROXY_CONSTRUCT" /* CONSTRUCT */: return `new ${path}(...)`; ...
[ "function trsdosProtectionLevelToString(level) {\n switch (level) {\n case TrsdosProtectionLevel.FULL:\n return \"FULL\";\n case TrsdosProtectionLevel.REMOVE:\n return \"REMOVE\";\n case TrsdosProtectionLevel.RENAME:\n return \"RENAME\";\n case TrsdosP...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This page can now be a functional component doesn't need to maintain its own state now. Renders a twocolumn layout. The first column displays the todo items in a list, while allowing their completed status to be toggled. The second column contains a summary of how many items are complete / incomplete.
function ToDoPage({ todos, setTodoComplete }) { const numCompleted = todos.filter(todo => todo.completed).length; const numIncomplete = todos.length - numCompleted; return ( <ColumnLayout columns="1fr 300px"> <Column> <ToDoListCard todos={todos} onSetComplete={e => set...
[ "render() {\n\n const numCompleted = this.state.todos.filter(todo => todo.completed).length;\n const numIncomplete = this.state.todos.length - numCompleted;\n\n return (\n <ColumnLayout columns=\"1fr 300px\">\n\n <Column>\n <ToDoListCard todos={this....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Extend the binding context with new custom properties. This doesn't change the context hierarchy. Similarly to "child" contexts, provide a function here to make sure that the correct values are set when an observable view model is updated.
extend (properties) { // If the parent context references an observable view model, "_subscribable" will always be the // latest view model object. If not, "_subscribable" isn't set, and we can use the static "$data" value. return new bindingContext(inheritParentIndicator, this, null, function (self, ...
[ "extend(properties, options) {\n return new KoBindingContext(INHERIT_PARENT_VM_DATA, this, null, (newContext /*, parentContext*/) => {\n Object.assign(newContext, (typeof properties === 'function') ? properties(newContext) : properties);\n }, options);\n }", "function updateContext() {...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Pairfantasyland/extend :: Pair a b ~> (Pair a b > c) > Pair a c . . `extend (f) (Pair (x) (y))` is equivalent to . `Pair (x) (f (Pair (x) (y)))`. . . ```javascript . > S.extend (S.reduce (S.add) (1)) (Pair ('abc') (99)) . Pair ('abc') (100) . ```
function Pair$prototype$extend(f) { return Pair (this.fst) (f (this)); }
[ "function Pair$prototype$concat(other) {\n return Pair (Z.concat (this.fst, other.fst))\n (Z.concat (this.snd, other.snd));\n }", "function Pair$prototype$chain(f) {\n var other = f (this.snd);\n return Pair (Z.concat (this.fst, other.fst)) (other.snd);\n }", "function Pair$prototype$c...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Maptimize.Proxy.GoogleMapgetCountry(placemark) > String placemark (Object): object representing Google Map placemark (get by calling getPlacemarks) Returns country name of a placemark. Returns an empty string if not found.
function getCountry(placemark) { return _getPlacemarkAttribute(placemark, 'CountryName'); }
[ "function google_getCountry(json) {\n return Find_Long_Name_Given_Type(\"country\", json[\"results\"][0][\"address_components\"], false);\n }", "function google_getCountry(json) {\n return Find_Long_Name_Given_Type(\"country\", json[\"results\"][0][\"address_components\"], false);\n}", "function go...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Initialize Cloudinary from the `CLOUDINARY_URL` environment variable. This function will only run under Node.js environment.
fromEnvironment() { var cloudinary_url, query, uri, uriRegex; if(typeof process !== "undefined" && process !== null && process.env && process.env.CLOUDINARY_URL ){ cloudinary_url = process.env.CLOUDINARY_URL; uriRegex = /cloudinary:\/\/(?:(\w+)(?:\:([\w-]+))?@)?([\w\.-]+)(?:\/([^?]*))?(?:\?(.+))?/; ...
[ "function initializeClientApp(){\n let ClientApp = window.purecloud.apps.ClientApp;\n let envParam = urlParams.get(ENV_QUERY_PARAM);\n\n if(!envParam){\n envParam = localStorage.getItem('clientAppEnvironment') || 'mypurecloud.com';\n }\n vonageClientApp = new ClientApp({ pcEnvironment: envPara...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
get all names form the names.csv
function getNamesFromCreditsPage() { return new Promise ((resolve, reject) => { getGithubFileContent().then((csvContent) => { csvContent.blob().then(content => { const r = new FileReader(); r.onload = () => { const blobContent = r.result; const nameArray = []; b...
[ "function getNames(csvdata){\n // 'names.csv' consists of one row of the names of all\n // candidates\n // \"names\" is an array of all the candidate names\n names = csvdata.columns;\n // \"names_obj\" will be an object in which keys are the names\n // of candidates and values are links to corresponding \n /...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
create the recording element
function createRecordingElement(file) { //container element const recordingElement = document.createElement('div'); recordingElement.classList.add('col-lg-2', 'col', 'recording', 'mt-3'); //audio element const audio = document.createElement('audio'); audio.src = file; audio.onended = (e) => ...
[ "startRecording() {\n\n\t\tconst onDataAvailable = blob => {\n\t\t\tconsole.info(\"New record available\", blob)\n\n\t\t\t// = GET URL = const url = URL.createObjectURL(blob)\n\n\t\t\t// Save file\n\t\t\tsaveAs(blob, new Date().getTime() + \".webm\")\n\t\t}\n\n\t\t// Start recording\n\t\tif(!this.isRecording) {\n\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
`compilePathPattern2(pattern, param1, param2)` takes an Express path `pattern` that must contain the two names parameters `param1` and `param2` and returns a function `match(path)` that can be called later to extract the parameters from `path` as an array with two elements. `match()` returns `null` if the match fails.
function compilePathPattern2(pat, param1, param2) { const keys = []; const rgx = pathToRegexp(pat, keys); let param1Idx = 0; keys.forEach((k, i) => { if (k.name === param1) { param1Idx = i + 1; } }); if (!param1Idx) { nogthrow(ERR_PARAM_INVALID, { reason: `Missing param \`${param1}\...
[ "function compilePathPattern1(pat, paramName) {\n const keys = [];\n const rgx = pathToRegexp(pat, keys);\n\n let paramIdx = 0;\n keys.forEach((k, i) => {\n if (k.name === paramName) {\n paramIdx = i + 1;\n }\n });\n if (!paramIdx) {\n nogthrow(ERR_PARAM_INVALID, {\n reason: `Missing param ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Callback function for get sms device
function smsDeviceRead() { try { if (smsDevice !== null) { var messageStore = smsDevice.messageStore; var getSmsMessageOperation = messageStore.getMessageAsync(smsNotificationDetails.messageIndex); // Display message when get is completed ...
[ "function onSMS(callback)\n{\n if ( !callback || typeof (callback) !== 'function' ) { return; }\n webphone_api.smscb.push(callback);\n}", "function readSMS() {\n try {\n if (smsDevice === null) {\n var smsDeviceOperation = Windows.Devices.Sms.SmsDevice.fromIdAsync(smsNotific...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
removes an interest from the "yourIntList" when the redX is clicked
function remove(rmId) { var temp = allInterests[rmId]; var rmInt = document.getElementById(rmId); rmInt.parentNode.removeChild(rmInt); allInterests[rmId].yourInt = false; allInterests[rmId].selected = false; $("#otherIntList").append('<li id="'+rmId+'" onclick="select(this)"><img class="interestImg" src="'+allI...
[ "removeInterest() {}", "function closeInterest() {\n var index = interests.indexOf($(this).parent().attr(\"data-name\"));\n interests.splice(index, 1);\n //wipe array from database and push new array to database\n usersDatabase.ref().child(\"users\").child(uid).set({ \n inte...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
where L and R are numbers from 1..6 range.Tiles are separated by the comma. Some examples of valid S chain are: 1. 14,42,31 2. 63 3. 43,51,22,13,44 Devise a function that, give a domino string, returns the number of tiles in the longest matching group within S. A matching group is a set of tiles that match and that are...
function domino(s) { var array = s.split(','); if (array.length == 0) return 0; var length = 0; var currentLength = 1; var lastRight = 0; for (const tile of array) { var da = tile.split('-'); var left = da[0]; var right = da[1]; if (left == lastRight) { currentLength++; } else { ...
[ "function findSantasFloor(str) \n{\n\tvar count = 0;\n\tfor (var i = 0; i < str.length; i++) \n\t{\n\t\tif (str.charAt(i) === \"(\") \n\t\t{\n\t\t\tcount++;\n\t\t}\n\t\telse \n\t\t{\n\t\t\tcount--;\n\t\t}\n\t}\n\treturn count;\n}", "function countIslands (mapStr) {\n\n}", "function HowManyPairs(shoes) {\n va...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns an array of all steps with order and title property
function allSteps() { return stepNodes.map(({ order, title }) => ({ order, title })); }
[ "function getSteps() {\n return [\"Delivery\", \"Payment\"];\n}", "function getSteps() {\nreturn [\"Delivery\", \"Payment\"];\n}", "static sequence(steps) {\n for (let i = 1; i < steps.length; i++) {\n steps[i].addStepDependency(steps[i - 1]);\n }\n return steps;\n }", "get...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Cached Values for : 2.0 damp_ratio osc_ps
constructor( osc=1, damp=1, damp_time=0 ){ // http://allenchou.net/2015/04/game-math-more-on-numeric-springing/ // Damp_ratio = Log(damp) / ( -osc_ps * damp_time ) // Damp Time, in seconds to damp. So damp 0.5 for every 2 seconds. // Damp needs to be a value between 0 and 1, if 1, creates critical dampin...
[ "set_damp_ratio( damping, damp_time ){ this.damping = Math.log( damping ) / ( -this.osc_ps * damp_time ); return this; }", "get PPQ() {\n return this._clock.frequency.multiplier;\n }", "get PPQ() {\n return this._clock.frequency.multiplier;\n }", "get wheelDampingRate() {}", "get dampening() {...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Send a video chat invitation to jid
function startVideoChat(gCurrChatJid) { if(gCurrChatJid==null) { alert("Please select a contact first."); return; } var jid = gCurrChatJid; // startTextChat(jid); if(gVideoChatState==VideoState.VIDEO_STATE_CONNECTING) { alert("Connecting to mixserver please wait."); return; } else if(gVideoChatSt...
[ "function sendVideoMessage(recipientId){var messageData={recipient:{id:recipientId},message:{attachment:{type:\"video\",payload:{url:SERVER_URL+\"/assets/allofus480.mov\"}}}};callSendAPI(messageData);}", "function sendVideoMessage(bot, recipientId, message, url, isNotificationDisabled) {\n var options = {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
stops the skier jumping and restores the skier to the original asset.
resetSkier () { this.isJumping =false; this.setDirection(this.direction); }
[ "killSkier(skier) {\n\t\tskier.direction = Constants.SKIER_DIRECTIONS.DIED;\n\t\tskier.y = this.y;\n\t\tskier.x = this.x;\n\t\tskier.assetName = Constants.SKIER_DIED;\n\t}", "jump() {\n this.isJumping = true;\n this.updateAsset();\n \n setTimeout(() => { this.resetSkier() }, Constants.JU...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Copyright 2009 Applied Research in Patacriticism and the University of Virginia Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at Unless required by applicable law or agreed to in writing, software dis...
function flagComment(comment_id, action_url, els, can_edit, can_delete, is_main) { var ReportDlg = Class.create({ initialize: function ( params ) { var title = params.title; var addAction = params.addAction; var dlg = null; var id='reason'; var msg = params.msg; ...
[ "function setReqForComments()\n{\n\tif (F.OBJECT_ACTION.read() == 'CNCL' || F.OBJECT_ACTION.read() =='REQ_CLR' )\n\t{\n\t F.ACTION_COMMENTS.makeRequired();\n\t}\n\telse\n\t{\n F.ACTION_COMMENTS.makeNotRequired();\n\n\t} \t\t\t\n}", "function WriteComments()\n{\n\tvar toolTip;\n\tvar html = '';\n\tdate_fld_...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Getter for the Grid Options pulled through the Grid Object
get _gridOptions() { return (this._grid && this._grid.getOptions) ? this._grid.getOptions() : {}; }
[ "get gridOptions() {\n return (this.grid && this.grid.getOptions) ? this.grid.getOptions() : {};\n }", "get _gridOptions() {\r\n return (this._grid && this._grid.getOptions) ? this._grid.getOptions() : {};\r\n }", "function TVJS_GridOptions(scope_id) {\n return WebIO.scopes[scope_id].tabl...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
add node in svg
function addNode(val,x,y) { d3.select(`#node${val-1}`).remove(); const svg = d3.select('svg'); const g= svg.append('g') .attr('id',`node${val-1}`); const c = g.append('circle') .attr('cx',`${x}`) .attr('cy',`${y}`) .attr('r',25) ...
[ "function addNode(val,x,y)\n{\n d3.select(`#node${val-1}`).remove();\n\n const svg = d3.select('svg');\n\n const g= svg.append('g')\n .attr('id',`node${val-1}`);\n\n const c = g.append('circle')\n .attr('cx',`${x}`)\n .attr('cy',`${y}`)\n .attr...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
me: subscribeToBuoys description: Subscribes a client to buoy notifications for buoys within the bounds box and updates the payload to queue up any applicable notifications. parameters: 'params' Object; contains parameters used for the function call \__ 'west', 'south', 'east', 'north' Float; latlon coordinates represe...
subscribeToBuoys(params, cb, client, ws) { // accumulator for valid buoys const results = {}; const payload = { error: null, notifications: [], }; const isWithinBounds = (buoy) => buoy.lat > params.south && buoy.lat < params.north && buoy.lon > param...
[ "checkClientSubscribed(socket, updatedBuoy) {\n const { lat, lon, height, period, name } = updatedBuoy;\n //iterate through clients\n for (let prop in boundsObj) {\n //If the updated buoy is on the client's buoy object, then update it and send the notification\n if (boundsObj[prop].buoys[updatedB...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Set accessor for the base endpoint
get baseEndpoint() { return this._baseEndpoint; }
[ "setEndpoint() {\n this.endpoint = this.getEndpoint();\n }", "set baseEndpoint(baseEndpoint) {\n this._baseEndpoint = baseEndpoint;\n if (this._baseEndpoint.startsWith('/') === false) {\n this._baseEndpoint = '/' + this._baseEndpoint;\n }\n if (this._baseEndpoint.endsWit...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Converts a Next.js style route to a regular expression that matches on pathnames (no query params or URL fragments). In general this involves replacing any instances of square brackets in a route with a wildcard: e.g. "/users/[id]/info" becomes /\/users\/([^/]+?)\/info/ Some additional edgecases need to be considered: ...
function convertNextRouteToRegExp(route) { // We can assume a route is at least "/". const routeParts = route.split('/'); let optionalCatchallWildcardRegex = ''; if (routeParts[routeParts.length - 1].match(/^\[\[\.\.\..+\]\]$/)) { // If last route part has pattern "[[...xyz]]" we pop the latest route part ...
[ "function createPathRegExps(routes){return routes.reduce((result,route)=>{// Pages with internal routing aren't just exact matches.\nconst ending=route.internalRouting?'(/.+)?$':'$';// ? because the last slash is optional\nresult[route.path]=new RegExp(`^${route.path.replace(/\\//g,'[/]')}?${ending}`);return result...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
allows for the circle to grow
function circleGrow(){ xSize = xSize + 30; ySize = ySize + 30; }
[ "grow(factor) {\n this.radius = this.radius * factor\n }", "function grow() {\n timer = setInterval(function() {\n $(\".circle\").css(\"height\", function(idx, old) {\n return parseInt(old) + parseInt(growthAmount) + \"px\";\n });\n $(\".circle\").c...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
(re)set the timer second to startSecond
_resetStartSecond(second) { this._stopTimer(); this.setState({ nowSecond: second, startSecond: second }); }
[ "function startTimer() {\n\tstartTime = sec === 0 ? new Date().getTime() : startTime;\n\n}", "function startSetTime() { \n if (t == 1) {\n sSetTime++;\n if (sSetTime > 59) { //When sSetTime reaches 1 minute it resets to 0 the mSetTime value increases by 1\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Set factory content by factory Id.
setFactoryContent(factoryId, factoryContent) { let promise = this.codenvyAPI.getFactory().setFactoryContent(factoryId, factoryContent); promise.then((factory) => { this.factory = factory; this.cheNotification.showInfo('Factory information successfully updated.'); }, (error) => { this.fact...
[ "set factory(value) {\n this._factory = value;\n this.factoryIsReady = true;\n }", "updateFactory(factoryId) {\n let promise = this.codenvyAPI.getFactory().fetchFactory(factoryId);\n\n promise.then((factory) => {\n this.factory = factory;\n this.cheNotification.showInfo('Factory information...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Return true if node is `VariableDeclaration`
function isVariableDeclaration(node) { return node.kind === ts.SyntaxKind.VariableDeclaration; }
[ "static isVariableDeclaration(node) {\r\n return node.getKind() === typescript_1.SyntaxKind.VariableDeclaration;\r\n }", "static isVariableDeclaration(structure) {\r\n return structure.kind === StructureKind_1.StructureKind.VariableDeclaration;\r\n }", "function isDeclaration(node, typescrip...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
types out the given text one character at a time
function typeText(text){ var chars = text.split(''); chars.forEach(function(char, index){ $(settings.el).delay(settings.speed).queue(function (next){ var text = $(this).html() + char; $(this).html(text); next(); ...
[ "function typeCharacter() {\n $element.html($element.html() + word[charIndex]);\n\n if (charIndex >= wordLenght-1) {\n wordCounter++;\n animateCode();\n } else {\n charIndex++;\n setTimeout(typeCharacter, 50);\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
(2) Step 2: Create a 'monster not found' error messege with virtual DOM
function notFound() { const notFoundDiv = document.createElement('div') notFoundDiv.setAttribute('class', 'p-5 not-found') const span = document.createElement('span') span.textContent = '404' const h1 = document.createElement('h1') h1.textContent = '🧟‍♂️ No Monster Found 🧟‍♂️' notF...
[ "function failedHitDomPusher() {\n missDom.text(failedHit());\n}", "function addMonsterToDom(name, age, description){\n //Grabs area of where monster info will be displayed\n const monsterContainer = document.getElementById('monster-container')\n\n //Creates elements for the monster\n const monster...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Count the significant trailing zeros on this object.
function trailingZeros(mantissa) { var zeros = 0; for (var i = mantissa.length - 1; i >= 0; i--) { var c = mantissa.charAt(i); if (c == "0") { zeros++; } else { return zeros; } } return zeros; }
[ "function trailingZeros(mantissa) {\n var zeros = 0;\n\n for (var i = mantissa.length - 1; i >= 0; i--) {\n var c = mantissa.charAt(i);\n\n if (c == \"0\") {\n zeros++;\n } else {\n return zeros;\n }\n }\n\n return zeros;\n}", "function significant_digits(s) {\n // Regular express...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Invoke the provided callback every time the keyboard height changes (when it show/hide) Note: when it invoke the first time it will listen to RNKeyboard native event
static addKeyboardListener(callback) { if (!RNKeyboard.isInitialized) { KBModule.startKeyboardListener(); eventEmitter.addListener(KEYBOARD_SIZE_EVENT_NAME, RNKeyboard.keyboardListener); RNKeyboard.isInitialized = true; } RNKeyboard.callbacks.push(callback); ...
[ "componentWillMount() {\n if (Platform.OS === \"android\") {\n this.keyboardShowListener = Keyboard.addListener(\"keyboardDidShow\", ({endCoordinates}) => {\n this.animateKeyboardHeight(endCoordinates.height, 0)\n });\n this.keyboardHideListener = Keyboard.addListener(\"keyboardDidHide\", (...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Handle submitting the form. Calls the onSubmit callback function with the height and width from the form.
handleClick() { this.props.onSubmit({height: this.state.height, width: this.state.width}); }
[ "function sizeSubmit(event) {\n makeGrid();\n // Use preventDefault to stop form from resetting height & width values\n event.preventDefault();\n}", "function formSubmission() {\n event.preventDefault();\n const height = document.getElementById('inputHeight').value;\n const width = document.getElement...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Convert human readable size to bytes
function humanToBytes(size) { var powers = {'k': 1, 'm': 2, 'g': 3, 't': 4}; var regex = /(\d+(?:\.\d+)?)\s?(k|m|g|t)?b?/i; alert(size); var res = regex.exec(size); if (res[2] !== undefined) { return res[1] * Math.pow(1024, powers[res[2].toLowerCase()]); } ...
[ "function humansizeToBytes(size) {\n\tvar obj = size.match(/(\\d+|[^\\d]+)/g), res=0;\n\tif(obj) {\n\t\tsizes='BKMGTPE';\n\t\tvar i = sizes.indexOf(obj[1][0]);\n\t\tif(i != -1) {\n\t\t\tres = obj[0] * Math.pow(1000, i);\n\t\t}\n\t}\n\treturn res;\n}", "_bytesToSize(bytes) {\r\n var sizes = ['Bytes', 'KB', 'MB...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
class for creating the animation for moving the hexes down
moveDown(amount){ var initRow = this.index.row; this.index.row+=amount; this.gameObject.setTint(this.identifier.color); this.moveData.push({ from: {x: this.gameObject.x, y:this.gameObject.y}, to: {x: this.x + ((initRow + 1)%2 * this.board.hexWidth/2), y: this.y + this.board.vertOffset} }...
[ "animate(){\n this.x += this.delta(3.1416*2.0,10);\n }", "function Animation(){}", "function MoveDownAnimation() {\n AnimationBase.call(this);\n this.curY = 0;\n}", "function transHexagon() {\n translate(0, 94);\n hexagon();\n }", "generateAnimationType() {\n switch (this.moveD...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Allowed values: "credit", "nocredit"
get credit() { return this._credit; }
[ "credit(){\n \n let name = this.data.shift();\n let creditAmount = this.data.shift();\n let account = this.store[name];\n\n // making sure account and the account cardNumber is valid\n if(account && account.cardNumber){\n account.balance = account.balance - remov...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
gets a random workout from list
function getWorkout() { var list = JSON.parse(localStorage.exercises); // parsed list of exercises var index = (localStorage.total - count) % list.length; var workoutType = list[index]; // current exercise type var ex = Workout.instances[workoutType]; // list of corresponding exercises return ex[getRandomInt(0, ex...
[ "pickWorkout() {\n if (this.rest) {\n return exercises[exercises.length - 1]; // returns rest data if this.rest is true\n } else {\n return exercises[Utility.random(exercises.length - 2, 0)]; // returns a random workout with no regard for what has already been selected. Excludes rest.\n }\n }", ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
compares two given users to check if something has changed to then update the user or not. This will prevent a large amount of unnecessary calls to the server.
function isEquivalent(User1, User2) { var User1Props = Object.getOwnPropertyNames(User1); var User2Props = Object.getOwnPropertyNames(User2); if (User1Props.length !== User2Props.length) { return false; } for (var i = 0; i < User1Props.length; i++) { var prop = User1Props[i]; ...
[ "function compareUsers(user, otherUser ){\n if (user.mail === otherUser.mail){\n return user.togglApiToken === otherUser.togglApiToken;\n }\n return false;\n}", "function equalUserRecords(user1, user2) {\r\n return user1.email === user2.email && user1.firstName === user2.firstName && user1.lastName...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Update the config with the new Electrovanne
UpdateConfig(IsTypeElectrovanne = true){ // L'éléctrovanne a ete passée en ref, this._DeviceConfig a donc été updaté automatiquement // Clear view this._DeviceConteneur.innerHTML = "" // Add texte this._DeviceConteneur.appendChild(NanoXBuild.DivText("Save config to device", null,...
[ "function updateConfig() {\n\t// get latest view config state from data viewer\n\tconst viewerConfig = viewer.save();\n\t\n\t// strip out updating, render time and style properties for clean view config compare and save\n\tdeleteProperty('updating', viewerConfig);\n\tdeleteProperty('render_time', viewerConfig);\n\t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Return all attached components in an array.
components() { const model = internal(this).model; const components = internal(model).components; return components.attached(this); }
[ "attached(entity) {\n const {entityToComponents} = internal(this);\n if (entityToComponents.has(entity))\n return Array.from(entityToComponents.get(entity).values());\n else\n return [];\n }", "getAllComponents() {\n if ( this._baseComponent ) {\n retu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create/save a new rawmaterial. POST rawmaterials
async store ({ request, response }) { return await RawMaterial.create(request.all()) }
[ "createMaterial(attributes) {\n // create & save material, refresh is not needed because result is cached\n return this.store.createRecord('material', attributes).save();\n }", "async create_study_material(data) {\n if (!data) return false;\n\n return await this.endpoint.create_study_material(d...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function to create tour guide
function createTourGuide(){ //alert("Called the function"); var name = "Calvin"; var route = elementIdArray; var routeInfo = elementInfoArray; //calvin needs func to update current location var Calvin = new tourGuide(name,route,routeInfo); currElement =0; firstIteration =0; Calvin.drawTourGuide(); var nextB...
[ "function startTour() {\r\n\r\n\tvar intro = introJs();\r\n\tintro.setOptions({\r\n\t\tshowStepNumbers: false,\r\n\t\tsteps: [\r\n\t\t\t{\r\n\t\t\t\tintro: 'Hey! This tour will help you to understand how you can use this tool for time tracking.'\r\n\t\t\t},\r\n\t\t\t{\r\n\t\t\t\tintro: 'This tool is designed to tra...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Store destination city input from user
function destinationCity() { localStorage.setItem('destination', document.getElementById("destinationCity").value); }
[ "function cityStateDestination (){\r\n city = destination.split(\",\")[0];\r\n state = destination.split(\",\")[1];\r\n}", "static setCity(e) {\n e.preventDefault();\n city = locationInput.value;\n document.querySelector(\".location\").innerText = city;\n UI.updateUI();\n }", ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
END OF 3D Cube class ===================================================================================================== 3D JSON Model class =====================================================================================================
function Object_3D_JSON(){ // instantiate a loader this._loader = new THREE.JSONLoader(); }
[ "function createModel(data) {\r\n\r\n // Define the vertices for the cube.\r\n // Each line represents one vertex \r\n // (x, y, z, u, v)\r\n var vertices = new Float32Array([ \r\n -1.0, -1.0, 1.0, 0.0, 1.0,\r\n 1.0, -1.0, 1.0, 1.0, 1.0,\r\n 1.0, 1.0, 1.0, 1.0,...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
takes SSN, a string of 9 digits and reformats as 123456789
function reformatSSN (SSN) { return (reformat (SSN, "", 3, "-", 2, "-", 4)) }
[ "function autoformatSSN(ssn) {\n\tre = /\\D/g; // remove any characters that are not numbers\n\tsocnum=ssn.value.replace(re,\"\")\n\tsslen=socnum.length\n\tif(sslen>3&&sslen<6)\n\t{\n\t\tssa=socnum.slice(0,3)\n\t\tssb=socnum.slice(3,5)\n\t\tssn.value=ssa+\"-\"+ssb\n\t}\n\telse\n\t{\n\t\tif(sslen>5)\n\t\t{\n\t\t\tss...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get user by team id
async function findByTeam(teamId) { const users = await db('users').where({ teamId }); return users; }
[ "async getTeam (user, teamId) {\n\t\tif (!teamId) {\n\t\t\tthis.log('Could not find teamId within the action payload');\n\t\t\treturn undefined;\n\t\t}\n\t\tif (user && !user.hasTeam(teamId)) {\n\t\t\tthis.log(\n\t\t\t\t'User is not a member of the team provided in slack action payload'\n\t\t\t);\n\t\t\treturn und...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
create the function to get the data for demographics
function get_demographics(id) { // read the samples.json file to get data d3.json("../data/samples.json").then((data) => { // get the metadata info for the demographics visual on the webpage var metadata = data.metadata; console.log(metadata) // filter meta data info by id an ...
[ "function gettingDemoInfo(id) {\r\n\r\n// creating json to read data\r\n d3.json(\"samples.json\").then((sampledata)=> {\r\n // getting metadata for demograph panel\r\n var metadata = sampledata.metadata;\r\n console.log(metadata)\r\n\r\n\r\n var result = metadata.filter(meta...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
crea un marker con una burbuja de texto, y una imagen personalizada
function createMarker(map,point,image, txt) { var marker = new google.maps.Marker({ position: point, map: map, icon: image }); var infowindow = new google.maps.InfoWindow({ content: txt }); google.maps.event.addListener(marker, 'click', function() { ...
[ "function createMarker(map,point,image,shape,content) {\n\n\t//create marker\n\tvar marker = new google.maps.Marker({\n\t\tposition: point,\n\t\tmap: map,\n\t\ticon: image,\n\t\tshape: shape\n\t});\n\n\t//push to markers array\n\tmarkers.push(marker);\n\n\n\t//create info window, but don't put in any content yet\n\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Takes the old boostrap file name and returns the new file name that is created via the transform from the new package name.
function getBootstrappedFileName(bootstrapFileName, newPackageName) { return bootstrapFileName.replace( getOldFilePath(), getNewFilePath(newPackageName) ); }
[ "function getNewFilePath(newPackageName) {\n return newPackageName.split('.').join('/'); \n}", "rename(newFilePath) {\n }", "rename(newFilePath) {\n fs.renameSync(this.fileObj.versions[this.versionName].path, newFilePath);\n }", "function getNewName() {\n\n\tvar docName = sourceDoc.name;\n\tvar extensio...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Declaration function constructor for 5 towers tank.
function Tank5Towers(ammo, fuel) { Tank.call(this, ammo, fuel); // heritage parameters and 'this' this.tower = 5; this.fuelConsumption = 5; this.ammoConsumption = 5; }
[ "makeTower(no_soldiers) {\n this.no_soldiers = no_soldiers;\n this.tower = 1;\n }", "constructor() {\n super();\n this._size = new Vector(40, 17);\n this._className = ItemClass.TANK;\n this._shotInterval = 800;\n this._lastShot = 0;\n this._health = 100;\n this.updateCornerPo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Build a rule from a `o` short flag, a `output [DIR]` long flag, and the description of what the option does.
function buildRule(shortFlag, longFlag, description, options) { if (options == null) { options = {}; } const match = longFlag.match(OPTIONAL); longFlag = longFlag.match(LONG_FLAG)[1]; return { name: longFlag.substr(2), shortFlag, longFlag, description, hasArgument: !!(match && match[1]), ...
[ "function build_rule(filters, short, expr, desc, callback) {\n var optional, filter;\n var m = expr.match(EXT_RULE_RE);\n if(m == null) throw OptError('The switch is not well-formed.');\n var long = m[1] || m[3];\n if(m[2] != undefined) {\n // A switch argument is expec...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Callback for getAllTablesForEmployees sets and displays locations, departments and employees
function displayEmployeePageData(tablesInput) { // Set global variables departments = tablesInput['departments']; departments.forEach(function(department) { departmentLocation[department['id']] = department['location']; departmentLocationId[department['id']] = department['locationID']; if ...
[ "function getEmployees() { Model.getAllEmployees(renderPage); }", "function viewAllEmployees() {\n printDivider();\n console.log(\"Here's an overview of all employees:\");\n connection.query(\"SELECT employee.id, employee.first_name, employee.last_name, role.title, role.salary, department.name FROM department ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Delays function by short time
function shortDelay(callback) { setTimeout(callback, 0.1); }
[ "function delay(func, wait) {\n\n}", "function runAfterDelay(delay, callback){\n \nsetTimeout(callback, delay*1000);//seconds changed to min-seconds\n}", "function ac_delay(funct,delay) {\n \t// delay before start of action\n \tsetTimeout(funct,delay);\n}", "function delay( func, wait ) {\n\t\tvar args = ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
change map center for mobile
function mapCenter (){ if (window.innerWidth > 600) {return [40, -125]} else {return [40, -98]} }
[ "function centerMap() {\r\n\t\tvar sets = $['mapsettings'];\r\n\t\tvar $this = sets.element;\r\n\t\tvar location = new Point(($this.innerWidth()/2)-(sets.resolutions[sets.zoom-1].width/2),($this.innerHeight()/2)-(sets.resolutions[sets.zoom-1].height/2));\r\n\t\tsetInnerDimentions(location);\r\n\t}", "function cen...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Step 2: Save a New Card to Airtable
function saveCard() { // 2-1 return early if either of the required fields are empty if (!this.name || !this.note) { return } // 2-2 Create the payload object as stated in Airtable's api documentation const payload = { fields: { Name: this.name, Notes: this....
[ "function saveCardForLater() {\n terminal.readReusableCard().then(function(result) {\n if (result.error) {\n // Placeholder for handling result.error\n setStatus('error - ' + result.error.message);\n } else {\n // Placeholder for sending result.paymentMethod.id to your backend.\n setStatu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates and returns the SVG
_createSVG() { return d3.select(this._container) .append('svg'); }
[ "function createSVG() {\n\t\n\t// Create svg element\n\tvar svg = document.createElementNS( ns, \"svg\");\n\n\treturn svg;\n\n}", "createSVG () {\n let ar = this.getProps().aspectRatio\n let NS = this._svgNS\n let svg = document.createElementNS(NS, 'svg')\n\n // setting up properties\n // the svg a...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
RETURN SETTINGS /////////////////////////////////////////////////////////////////////// amReturnSettings(map_id, settings) This function is called when you request settings from a map by calling this.map.getSettings() function.
function amReturnSettings(map_id, settings) { Ammap.publish('amreturnsettings', map_id, settings); }
[ "function getSettings() {\n\t\treturn data.settings;\n\t}", "getSettings (settings) {\n extend(settings, this.defaultSettings)\n this.settingsValidator(settings)\n return settings\n }", "function fetchSecuritySettings(accessPointId, settings) {\n\treturn db.query('SELECT * FROM access_point_settings W...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Test ( master > multiple ) worker confirmation feature
testMasterToWorkers() { let name = "testMasterToWorkers"; let descr = "master -> workers"; let timeout = this.timeout(1000, name); this.printTest(name, descr); t(name); this.bridge.to('*').emit(name, null, () => { clearTimeout(timeout); !tim...
[ "testWorkerToMaster() {\n /**\n * Don't run this test from\n * all other instances of\n * the worker\n */\n if ( !this.isSingle )\n {\n return;\n }\n\n let name = \"testWorkerToMaster\";\n let descr = \"worker -> master\";\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Adds a CourseEvent to the internal array of CourseEvents.
addCourseEvent(course) { this.events.push(course); }
[ "function addCourses(course){\n\t\t\tcourses.push(course);\n\t\t}", "function addEventsToCalendar(course, color) {\n var courseEvents = course.course_events;\n\n for (var i = 0; i < courseEvents.length; i++) {\n var anEvent = courseEvents[i];\n\n window.events.push({\n id: course._i...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
RCConnect connects to the user's terminal
function RCConnect() { //alert("RCTicket: " + g_szRCTicket); //..alert("UserName: " + g_szUserName); ConnectionProgressLayer.style.visibility = "visible"; RemoteControlObject.style.visibility = "hidden"; if(null != RemoteDesktopClientHost) { g_bNewBinaries = true; try { // // set screen...
[ "function RCConnect() \n{\t\t\n\tTraceFunctEnter(\"RCConnect\");\n\tDebugTrace(\"RCTicket: \" + g_szRCTicket);\n\tDebugTrace(\"UserName: \" + g_szUserName);\n\t\n\t//\n\t// BUGBUG: Hide the SALEM ActiveX control only in x86. ia64 has some issues with this\n\t// which should be resolved for B2\n\t//\n\tif(g_szPlatfo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Change the color theme of the webphone skin. It is the same as from Settings > Theme PARAMETERS theme: the integer index number of the theme. The default "Webphone" named theme is "0" "Light Blues" is "1", "Light Green" is "2" and so on.
function changetheme(theme) { if (typeof (webphone_api.plhandler) !== 'undefined' && webphone_api.plhandler !== null) return webphone_api.plhandler.ChangeTheme(theme); }
[ "set theme(value) {\n this._theme = value;\n if (value === 'light') {\n this.addClass('jp-mod-light');\n this._term.setOption('theme', Private.lightTheme);\n }\n else {\n this.removeClass('jp-mod-light');\n this._term.setOption('theme', Private...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function: pictureBehavior. Runs within the draw() loop, and changes the CSS data of the beaker, ice cubes, blocks to give it an animation.
function pictureBehavior() { if (currentStep == 0 && !blocksDropped && experimentRunning) { y *= 1.06; blockHeight -= y; $(".sit1block").css("bottom", blockHeight + "%"); $(".sit2block").css("bottom", blockHeight + "%"); if (blockHeight <= fallDist) {blocksDropped = true; y = 0.75;} else {blocksDropped =...
[ "function pictureBehavior() {\n\n\tif (currentStep == 0 && !iceDropped && experimentRunning) {\n\t\ty *= 1.06;\n\t\ticeHeight -= y;\n\n\n\t\tif (iceHeight <= fallDist) {iceDropped = true; y = 0.75;} else {iceDropped = false;}\n\n\t} else if (experimentRunning) {\n\n\t}\n}", "async function drawPicture() {\n //...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create an action sheet overlay with action sheet options.
async create(opts) { return createOverlay(this.doc.createElement('yoo-action-sheet'), opts); }
[ "showActionSheet (cb) {\n const BUTTONS = ['Save To Camera Roll', 'Cancel'];\n\n ActionSheetIOS.showActionSheetWithOptions({\n options: BUTTONS,\n cancelButtonIndex: 1,\n tintColor: 'rgba(0,0,0,.8)',\n },\n i => i === 0 ? cb() : null);\n }", "function popActionSheet(){\n currentID...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
update this.position and sides of squares clockwise as seen from positive axis
updatePosition(axis, clockwise) { this.position = this.position.map(function (pos) { return nextPosition(pos, axis, clockwise); }); this.squares.forEach(function (square) { square.updatePosition(axis, clockwise); }); }
[ "drawSquareNorth(x,y,color,side){\n fill(color);\n rect(x,y,side,side);\n line(x+(side*.5), y+(side*.9), x+(side*.5), y+(side*.1));\n line(x+(side*.1), y+(side*.5), x+(side*.5), y+(side*.1));\n line(x+(side*.5), y+(side*.1), x+(side*.9), y+(side*.5)); \n this.direction=0; ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
the function getSuplData() loads all the supplementary data about characters and objects and puts the content to separate blocks
function getSuplData(obj){ var infoBlock = document.querySelector('.infoBlock'); var linksArray=[]; var articleTitle; for (var key in obj) { if (obj[key]==='homeworld') { linksArray.push(obj.homeworld); articleTitle = key.charAt(0).toUpperCase() + key.slice(1);; loadSupplementaryData(links...
[ "function init_sys_data()\r\n{\t\r\n\tvar hdrstr= \"app4STATICS\";\r\n\tvar ftrstr= \"College of Engineering :: Michigan State University\";\r\n\t\r\n\tvar marks= [ '\\u0040',\t\t// start marker @\r\n\t\t\t\t '\\u007c' ]\t// end marker |\r\n\t\r\n\tvar codearr= [\r\n\t\t{ name:'deg', \tcode:'\\u00b0' },\r\n\t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get the branches from the given MAT.
function getBranches(mat) { // Start at a node with 1 or 3 branches. let startNode = find_node_1.default(mat, function (node) { return node.branches.length !== 2; }); let branchCount = 0; g(startNode, undefined, 0); //console.log(branchCount); function g(matNode, priorNode, depth) { ...
[ "get branches() {\n if (!this._branches)\n return [];\n const result = [];\n for (const branch of NAMED_BRANCHES) {\n if (this._branches[branch]) {\n result.push(branch);\n }\n }\n return result;\n }", "allBranches() {\n retu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Notify the listeners for each packet sent
notifyOutgoingListeners(packet) { if (this._anyOutgoingListeners && this._anyOutgoingListeners.length) { const listeners = this._anyOutgoingListeners.slice(); for (const listener of listeners) { listener.apply(this, packet.data); } } }
[ "notifyOutgoingListeners(packet) {\n if (this._anyOutgoingListeners && this._anyOutgoingListeners.length) {\n const listeners = this._anyOutgoingListeners.slice();\n for (const listener of listeners) {\n listener.apply(this, packet.data);\n }\n }\n }", "notify () {\n for (var i =...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Finds the edge with the smallest slack that is incident on tree and returns it.
function findMinSlackEdge(t,g){return _.minBy(g.edges(),function(e){if(t.hasNode(e.v)!==t.hasNode(e.w)){return slack(g,e)}})}
[ "function findMinSlackEdge(t,g){return _.min(g.edges(),function(e){if(t.hasNode(e.v)!==t.hasNode(e.w)){return slack(g,e);}});}", "function findMinSlackEdge(t, g) {\n\t return _.min(g.edges(), function(e) {\n\t if (t.hasNode(e.v) !== t.hasNode(e.w)) {\n\t return slack(g, e);\n\t }\n\t });\n\t}", "fu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the fragment id
get_fragment_id() { return this.fragment_id }
[ "get_fragment() {\n return this.fc.get_fragment_by_id(this.get_fragment_id());\n }", "function generateConcreteFragmentID() {\n\t return __webpack_require__(155)(_nextFragmentID++) + SUFFIX;\n\t}", "function generateConcreteFragmentID() {\n\t return __webpack_require__(221)(_nextFragmentID++) + SUFFIX;\n\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This is a TaskRestriction resource
static get __resourceType() { return 'TaskRestriction'; }
[ "function getRestrictionType()\n{\n\treturn restriction;\n}", "function getTaskCPAllowed() {\n if (\n globals.config.has('Butler.startTaskFilter.allowTask.customProperty') === true &&\n globals.config.get('Butler.startTaskFilter.allowTask.customProperty')\n ) {\n return globals.config.g...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Checks whether "value" is present in "that." For now I don't use hasOwnProperty on that: I think I may want to see inherited properties.
function contains(that, value){ for (var i in that){ if (that[i] == value) return true; // Leaving out hasOwnProperty() purposely for now. } return false; }
[ "has(value) {\r\n\t return this.valueMap.has(value);\r\n\t }", "has(value) {\n return this.members.includes(value);\n }", "function contains(key) {\n return this.value().hasOwnProperty(key);\n}", "__contains__(value) {\n if (value.type() === \"dict\") {\n return value.valueO...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Check if the blockonomics uuid is present
function check_blockonomics_uuid() { $scope.spinner = true; if (typeof $scope.order_uuid != 'undefined') { //Fetch the order using uuid Order.get({ "get_order": $scope.order_uuid, "blockonomics_currency": $scope.currency.code }, functio...
[ "isUUID ( uuid ) {\r\n let s = \"\" + uuid;\r\n \r\n s = s.match('^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$');\r\n if (s === null) {\r\n return false;\r\n }\r\n return true;\r\n }", "function uuidMemberTest(sharedLocations,uuid)...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
PROTECTED Shows at the specified coordenates the popup menu associated to this network element.
function showPopupMenuNE(x, y) { if (this.popupListItems.getLength() > 0) { document.getElementById(MAP).map.setPopupMenu(this.popupListItems, x, y); } }
[ "function showConnectionPopupMenu(x, y) {\n\t\tif (this.popupListItems.getLength() > 0) {\n\t\t\tdocument.getElementById(MAP).map.setPopupMenu(this.popupListItems, x, y);\n\t\t}\n\t}", "show(){\n event.stopPropagation()\n document.body.appendChild(this.menuControl);\n contextualCore.PositionM...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Build a very simple expression based language with assignment, semicolon separated expressions and some operators and functions.
function basicLanguage() { // Put the context behind a function to guarantee that no // state is shared between subsequent evaluate calls. var ctx = function () { return ({ scope: { // Our basic calculator bits from above: '-': function (a, b) { return a.eval() - b.eval(); },...
[ "function makeEvaluator(expr)\n{\n // checks the expression format\n if (!EXPRESSION_RE.test(expr)) {\n throw 'Invalid expression.';\n }\n\n // remove spaces\n expr = expr.replace(/ /g, '');\n \n // adds spaces around operators to get the expression in an easy-to-split format\n expr = expr.replace(/\\+/g...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Find attached sheet with the highest index.
function findHighestSheet(registry, options) { for (var i = registry.length - 1; i >= 0; i--) { var sheet = registry[i]; if (sheet.attached && sheet.options.insertionPoint === options.insertionPoint) { return sheet; } } return null; }
[ "function findHighestSheet(registry) {\n\t for (var i = registry.length - 1; i >= 0; i--) {\n\t var sheet = registry[i];\n\t if (sheet.attached) return sheet;\n\t }\n\t return null;\n\t}", "function findHigherSheet(registry, index) {\n\t for (var i = 0; i < registry.length; i++) {\n\t var sheet = reg...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Save reviews to indexed DB.
static saveReviewsToIndexedDB(reviews) { return dbPromise.then(function (db) { if (reviews) { const tx = db.transaction('reviews', 'readwrite'); const reviewsStore = tx.objectStore('reviews'); reviewsStore.clear(); if (reviews instanceof Array) { reviews.forEach(function (review) { revie...
[ "static saveReviewToDB(reviews){\r\n const dbPromise = DBHelper.openDB();\r\n dbPromise.then(db => {\r\n if(!db) return ;\r\n const transaction = db.transaction(\"reviewList\", \"readwrite\");\r\n const store = transaction.objectStore(\"reviewList\");\r\n reviews.forEach(review => {\r\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
handle getlasthave response. the increase in lasthave cannot be assumed to produce new items for timeline since some posts might be directmessages (which won't be returned by getposts, normally).
function processLastHave(userHaves) { var reqConfirmNewPosts = []; var newPostsLocal = 0; for( var user in userHaves ) { if( userHaves.hasOwnProperty(user) ) { // checks for _idTrackerMap as well. the reason is that getlasthave // returns all users we follow, but the current ...
[ "function requestLastHave() {\n twisterRpc(\"getlasthave\", [defaultScreenName],\n function(req, ret) {processLastHave(ret);}, null,\n function(req, ret) {console.log(\"ajax error:\" + ret);}, null);\n}", "function lastPost(threadId, threadTitle, counter, total) {\n var getLa...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
this lights up a row
function lightUpRow(element) { element.style.background = '#FFFFD9'; }
[ "function changeRow(val) {\n\t\trow+=val;\t\t//incriment row coord by value sent to function\t\n\n\t\tif (row==0) {\t\t//if incriment pushs row (into header row) above top edge, incrient it to bring it back\n\t\t\trow++;\n\t\t}\n\t\n\t\tif (row==rowCount) {\t//if incriment pushes row below bottom edge, decriemnt it...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
check if the a string has symbols
function containsSymbol(val) { var charArray = val.toLowerCase().split(''); var allowedCharacters = 'abcdefghijklmnopqrstuvwxyz0123456789'; for (var i=0; i < charArray.length; i++) { if (allowedCharacters.indexOf(charArray[i]) == -1) { return true; } } return false; }
[ "function isValidSymbolString(s) {\n return [\"Symbol(66)\", \"Symbol()\"].indexOf(s) >= 0;\n}", "function SimpleSymbols(str) { \n\n // code goes here \n var str = '=' + str + '=';\n for (var i = 0; i<str.length; i++){\n \t\tif(str[i].match(/[a-z]/i) !== null){\n if (str[i-1] !== '+' || str[i+1] ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Converting the data to database ready input
function convertData(data) { var firstName = data['Voornaam*']; var lastName = data['Achternaam*']; var email = data['Email*']; var education = data['Opleiding*']; var opleidingsInstelling = data['Opleidingsinstelling*']; var geslacht = data['geslacht']; var know = data['kennis']; var jeBericht ...
[ "function csv2db() {\n\n}", "function pipeline(){\n\t\t\tmodule.exports.preProcessor(dataTable, function(objectTable){\n\t\t\t\tmodule.exports.pkProcessor(objectTable, dataTablePK, function(objectTable){\n\t\t\t\t\tmodule.exports.linkProcessor(objectTable, dataTablePK, dataTableFK, function(objectTable){\n\t\t\t\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function to draw a triangle on a prespecified canvas Context and elem refer to the context and canvas, respectively, on which the shape is drawn Xp, yp and zp refer to the (percentual) coordinates of the drawing Xp, yp, and zp are entered as numbers (e.g. 80) In the function, the percentage of the canvas dimension of i...
function drawTriangle(context, elem, xp, yp, zp) { let y = pc(yp, elem.height); let x = pc(xp, elem.width); let z = pc(zp, elem.width); context.moveTo(x + z, y); context.lineTo(x + z*2, y + z*2); context.lineTo(x, y + z*2); context.closePath(); }
[ "function drawTriangle() {\nlet p = document.getElementById(\"canvas4\");\nlet side1 = Number(prompt(\"Side 1:\"));\nlet side2 = Number(prompt(\"Side 2:\"));\nlet side3 = Number(prompt(\"Side 3:\"));\nlet ctx = p.getContext(\"2d\");\n if (side1 == Math.abs(side1) && side2 == Math.abs(side2) && side3 == Math.abs(si...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Hide all images in an array Input: current image array
function hideImgs(imgList) { var i; for (i=0; i<imgList.length; i++) { imgList[i].hide(); } }
[ "function hideImage(index) {\r\n images[index].style.display = \"none\";\r\n }", "function makeSeasonImgInvisible() {\n\n for (let i = 0; i < seasonImgs.length; i++) {\n seasonImgs[i].style.display = 'none'\n\n }\n}", "function hideAllImages() {\n $('img').hide();\n}", "function make...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
import data as JSON or OmniGraphSketcher format from the textarea
function importData() { var raw_data = $('#datatable').val().trim(); try { importPoints(JSON.parse(raw_data)); return; } catch(err) { // sanitize data and treat as OmniGraphSketcher format var points = []; var data = raw_data.split('\n'); if (data.length === 0) return; $.each(d...
[ "static importNoteJSON(objs_str) {\n let sp = new SketchPad();\n SketchPad.clear()\n \n\n let objs = JSON.parse(objs_str);\n\n for (let i = 0; i < Object.keys(objs).length; i++) {\n let class_name = Object.keys(objs)[i];\n \n // For all elements in...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
select record by idField.
function selectRecord(target, idValue){ var opts = $.data(target, 'datagrid').options; var data = $.data(target, 'datagrid').data; if (opts.idField){ var index = -1; for(var i=0; i<data.rows.length; i++){ if (data.rows[i][opts.idField] == idValue){ index = i; break; } } if...
[ "static getIdQuery(id, idField) {\n const query = {};\n query[idField] = id;\n return query;\n }", "function getRecordById(table, id) {\n return base(table)\n .find(id)\n .then((record) => {\n return fromAirtableFormat(record.fields, table);\n })\n .catch((err) => {\n throw err;\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Draws the row elements within the chart group
function drawRows() { let rows; if (isAnimated) { rows = svg.select('.chart-group').selectAll('.row') .data(dataZeroed); drawHorizontalRows(rows); // adding separator line svg.select('.chart-group').append('li...
[ "function renderRows(arr, ctx, canvas) {\n arr.forEach(function(data) {\n renderTile(ctx, data.svg, {x: data.x, y: data.y})\n });\n}", "function SVGStackedRowChart() {\r\n }", "function RenderRow() {}", "function drawRowingChart() {\n\n //Check that the remaining hours are above zero\n l...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Selects seat clicked on, desktop version
function selectSeatDesktop () { $(document).on('click', '.asiento', function (e) { // removes previous tolltip if any exists $('.tooltip-asiento').remove() // checks current passenger selected var activePassenger = $(document).find('.activePassenger') if ($(this).hasClass('asignado'))...
[ "function clickSeat() {\n console.log(\"Clicked \" + props.seat.seatName);\n // alert(\"Clicked \" + props.seat.seatName);\n setSelected({ seat: props.seat.id, level:selected.level });\n }", "function selectSeat(e) {\n //find the selected movie\n if (e.target.className === \"seat\") {\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function to calculate model internals
_recalc_model() { this._update_timescales(); this._calc_equilibrium(); }
[ "compileModel() {\n this.normalizeData();\n \n }", "calculateModelView() {\n this.modelViewMatrix = this.camera.getViewTransform();\n }", "function CalculationModel(modelData)\n{\n\tthis._modelName = modelData.modelName;\n\tthis._startCalculationTime = new Date().getTime();\n\tthis._calculati...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Select the string of text inside of the input.
selectText(){ this.getRef('input').selectText(); }
[ "selectText(){\n let ele = this.getRef('element');\n if (ele) {\n bbn.fn.selectElementText(ele)\n }\n }", "selectText(){\n this.getRef('input').selectText();\n }", "function text(sel) { return getSelectedContent(sel, true); }", "function select(word...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
ControlSlider(name) A function to build and return a control slider html element. Parameters: name..............(String) id for the slider group.............(Boolean) true if it's a group weight............(Number) value of the slider and numinput locked............(Boolean) if the slider is locked flipped...........(B...
function ControlSlider(name, group, weight, locked, flipped, topLevel, theme){ if (group === undefined){ group = false; }; if (weight === undefined){ weight = 0; }; if (locked === undefined){ locked = false; }; if (flipped === undefined){ flipped = false; }; if (topLevel =...
[ "function addSlider(groups, group, name, isGroup, weight, locked, flipped, topLevel, theme){\r\n if (isGroup === undefined){\r\n isGroup = false;\r\n };\r\n if (weight === undefined){\r\n weight = 0;\r\n };\r\n if (locked === undefined){\r\n locked = false;\r\n };\r\n if (flipped === undefined){\r\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Mobile users who want to play
function playMobile() { preload(); showLoadingBar(); _gaq.push(['_trackEvent', 'mobile', 'click', 'playAnyway']); $("#warning").css("width", "0").css("height", "0").css("opacity", "0"); }
[ "function isMobileUser(){\n\tif(pmgConfig.agent_ios || pmgConfig.agent_android){\n\t\treturn true;\t\n\t}\n\telse{\n\t\treturn false;\n\t}\n}", "function canPlay(){\n if(body.hasClass('ios') && !body.hasClass('standalone')) {\n return false;\n }\n return true;\n }", "function ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
return widht of a row
function getRowWidth(row){ var rv = 0; for( var i = 0; i < row.length; i++){ var cur = row[i] var elmWidth = parseInt((cur.text.length)/2)+parseInt((cur.text.length)%2) if(cur.size == "1"){ rv += (elmWidth * 100); }else{ rv += (elmWidth * 50); } ...
[ "function getRowWidth(r) {\n return ( r * 64); // reconfigure ? dynamically get width instead\n}", "getWidth() {\n return this._rows\n .map((row) => row.getWidth())\n .reduce((x, y) => Math.max(x, y), 0);\n }", "get cellWidth() {\n return (min(width, height) - 2*GRID_BU...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
computer attacks by choosing a random attack from array
function computerAttack() { const randomChoice = Math.floor( Math.random() * computer.choice.attacks.length ); //set that random choice as the value of cAttack to store what attack the computer used cAttack.choice = computer.choice.attacks[randomChoice]; }
[ "function assignAttack() {\n var attacks = [\n ['tackle', 'quick attack', 'thunderbolt', 'water gun'],\n ['fire punch', 'sand attack', 'thundershock', 'leaf attack'],\n ['psychic', 'surf', 'earthquake', 'rock throw'],\n ['thunder punch', 'thunder', 'flamethrower', 'tail whip'],\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Replace all external module script tags: `` with inline script tags containing import: `import '...';` And these will be subsequently rolled up by call to `this._rollupInlineModuleScripts()`.
_rewriteExternalModuleScriptTagsAsImports(ast) { return __awaiter(this, void 0, void 0, function* () { for (const scriptTag of dom5.queryAll(ast, matchers.externalModuleScript)) { const scriptHref = dom5.getAttribute(scriptTag, 'src'); const resolvedImportUrl = this.b...
[ "_rollupInlineModuleScripts(ast) {\n return __awaiter(this, void 0, void 0, function* () {\n this.document = yield this._reanalyze(parse5_1.serialize(ast));\n utils_1.rewriteObject(ast, this.document.parsedDocument.ast);\n dom5.removeFakeRootElements(ast);\n const ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Reducer that compares score differences between the new friend and saved friends
function compare(newFriendTotal){ return function(acum, cur, i) { // Compares the difference between the score sums of the new friend and a saved friend let curTotal = cur.scores.reduce((acum, cur) => acum += parseInt(cur), 0); let difference = Math.abs(curTotal - newFriendTotal); ...
[ "function calculateScoreDifference(){\n \n if (friends !== []) {\n if (i < friends.length) {\n scoreCompareArray = [];\n for (var j = 0; j < newFriend.scores.length; j++) {\n var diff = Math.abs(newFriend.scores[j] - f...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates a new sender to the given event hub, and optionally to a given partition if it is not present in the context or returns the one present in the context.
static create(context, partitionId) { const ehSender = new EventHubSender(context, partitionId); if (!context.senders[ehSender.name]) { context.senders[ehSender.name] = ehSender; } return context.senders[ehSender.name]; }
[ "constructor(context, partitionId) {\n super(context, {\n name: context.config.getSenderAddress(partitionId),\n partitionId: partitionId\n });\n /**\n * The unique lock name per connection that is used to acquire the\n * lock for establishing a sender link ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }