query
stringlengths
9
34k
document
stringlengths
8
5.39M
negatives
listlengths
19
20
metadata
dict
Function to check if user had entered an owner and repo name
function checkInput(rOwner, rName) { if (rOwner === undefined || rOwner === '' || rOwner === ' ') { console.log("Please enter a valid owner and repo!"); } else if (rName === undefined || rName === '' || rName === ' ') { console.log("Please enter a valid owner and repo!"); } else { return true; } }
[ "function checkOwner (req) {\n return req.user.nim === req.object.nim;\n}", "function ownerCheck() {\n if (useraccount === contractowner) {\n return true;\n } else {\n return false;\n }\n }", "isOwner(user) {\n const id = this.users.resolveID(user);\n\n return Array.isArray(this.optio...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Renders the AWS CloudFormation properties of an `AWS::WAFv2::WebACL.AWSManagedRulesBotControlRuleSet` resource
function cfnWebACLAWSManagedRulesBotControlRuleSetPropertyToCloudFormation(properties) { if (!cdk.canInspect(properties)) { return properties; } CfnWebACL_AWSManagedRulesBotControlRuleSetPropertyValidator(properties).assertSuccess(); return { InspectionLevel: cdk.stringToCloudFormation(p...
[ "function cfnWebACLAWSManagedRulesATPRuleSetPropertyToCloudFormation(properties) {\n if (!cdk.canInspect(properties)) {\n return properties;\n }\n CfnWebACL_AWSManagedRulesATPRuleSetPropertyValidator(properties).assertSuccess();\n return {\n LoginPath: cdk.stringToCloudFormation(properties...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Subscribe for new work logs
function subscribeForWorkLog(subscriber) { _workLogSubscribers[subscriber.id] = subscriber; }
[ "function WorkSubscription() { }", "_subscribeForLogging() {\n const oThis = this;\n\n oThis.client.on('log', function(level, className, message, furtherInfo) {\n const msg = `cassandra log event: ${level} -- ${message}`;\n\n switch (level) {\n case 'info': {\n break;\n }\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Main working functions Fetch the weather from localStorage or API then call updateDOM (maybe asynchronously) Takes either (two arguments) latitude and longitude or (one argument) city name
function fetchWeather() { var query; // Query postion of URI for API call; also used as localStorage key var stored; // Saved weather stored in localStorage (time and result fields) var request; // Used to build up API call var result; // Return value from API call // Build query from arguments debug(...
[ "function pullBasicData() {\n $(\".infoSection\").empty(); \n searchTerm = $(\".searchBar\").val(); \n $.ajax({\n url: \"https://api.openweathermap.org/data/2.5/weather?zip=\" + searchTerm + \",us&appid=\" + APIkey, \n method: \"GET\"\n }).then(function(response) {\n console.log(\"Pull Da...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Converts a base 64 Buffer of bytes to a JavaScript string with line breaks.
toString(buf) { if (buf.length % 4 > 0) { throw new RangeError(`base64.toString: input buffer length not multiple of 4: ${buf.length}`); } let str = ''; let lineLen = 0; function buildLine(c1, c2, c3, c4) { switch (lineLen) { case 76: str += `\r\n${c1}${c2}${c3}${c4}`; ...
[ "function encodeBuffer(buffer) {\n if (!R.is(Buffer, buffer)) {\n throw new Error('encodeBuffer: expected Buffer.');\n }\n\n encoded = buffer.toString('base64');\n\n encoded = R.replace(/\\//g, '_', encoded);\n encoded = R.replace(/\\+/g, '-', encoded);\n encoded = R.replace(/\\=/g, '.', encoded);\n\n ret...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets the border color of this plug, as determined by the plug type. If the plug type is null, or does not have the "plugBorderColor" property, the default color is returned.
get plugBorderColor() { if (this.type == null || this.type.plugBorderColor == null) return this.node.tree.theme.plugBorderColor; return this.type.plugBorderColor; }
[ "get plugBorderHighlight()\n\t{\n\t\tif (this.type == null || this.type.plugBorderHighlight == null)\n\t\t\treturn this.node.tree.theme.plugBorderHighlight;\n\n\t\treturn this.type.plugBorderHighlight;\n\t}", "get borderColor()\n\t{\n\t\tif (this._borderColor == null)\n\t\t\treturn this.tree.theme.nodeBorderColor...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get heroes from localStorage
function getHeroes(){ // dummy data, if there is data in localStorage, merge them const heroes = [ { id: 0, name: 'Zero' }, { id: 11, name: 'Mr. Nice' }, { id: 12, name: 'Narco' }, { id: 13, name: 'Bombasto' }, { id: 14, name: 'Celeritas' }, { id: 15, name: 'Magneta' }, { id: 16, name: ...
[ "function setHeroes(heroes){\n localStorage.setItem(\"heroes\", JSON.stringify(heroes));\n}", "static GetSuperHeroFromLS() {\n let superheros;\n if(localStorage.getItem('superheros') == null) {\n superheros = [];\n }else {\n superheros = JSON.parse(localStorage.getItem(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the option with the specified value.
getOptionByValue(value) { return this.options.find((option) => option.value === value); }
[ "getOption(value) {\n\t var hashed = hash_key(value);\n\t return this.rendered('option', hashed);\n\t }", "function findOptionWithValue( value ) {\n\n // Since the options are dynamic, we have to collection just-in-\n // time with the selection event.\n var options = dom.op...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
functions to load the hmtl5 based jsmol viewer
function loadJSmolViewer() { // hide the choose structure buttons $j(' #choose-structure ').hide(); // show the other stuff $j(' #discern-structure-holder ').show(); // start the jsmol initialization jmolInitializer = { addSelectionOptions: false, color: "#FFFFFF", debug:...
[ "function jsu_loaded(){\n // [Optional] Init jslog with JSLOG_LEV \n // jslog_init(JSLOG_LEV);\n\tinitSampleCmn(); // manage optional PAR show_opt, only for developer\n sampleInit(); \n\tloadingShow(false);\n \n}", "function LView() {}", "function loadDwfViewer(width, height, path, version7){\n\tdoLoadDwfV...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
init: rate() started = buffering = false rate: min_nbuf = , max_nbuf = start: started = true connect() setup periodic() disconnect: ... connect: if (reconnect) disconnect(), buffering = true setup onprocess() recv: if (>IQ || change comp) connect(reconnect=1) prepare() if (!started && prepared.len > min_nbuf) start() p...
function audio_init(is_local, less_buffering, compression) { audio_running = false; console.log('--------------------------'); //console.log('AUDIO audio_init CALLED is_local='+ is_local +' less_buffering='+ less_buffering +' compression='+ compression); less_buffering = false; // DEPRECATED ...
[ "function setupSound() {\n sound = actx.createBufferSource();\n sound.buffer = sampleBuffer;\n sound.loop = true;\n //sound.detune.value = -1000;\n sound.playbackRate.value = 0.5;\n sound.connect(biquadFilter);\n biquadFilter.connect(gain);\n gain.connect(delay);\n gain.connect(actx.desti...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Are progress events supported?
function supportAjaxUploadProgressEvents() { var xhr = new XMLHttpRequest(); return !! (xhr && ('upload' in xhr) && ('onprogress' in xhr.upload)); }
[ "function supportAjaxUploadProgressEvents() {\n\t\t\tvar xhr = new XMLHttpRequest();\n\t\t\treturn !! (xhr && ('upload' in xhr) && ('onprogress' in xhr.upload));\n\t\t}", "function supportAjaxUploadProgressEvents() {\n var xhr = new XMLHttpRequest();\n return !! (xhr && ('upload' in ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
recalcuate the points of a polygon
function recalculatePoints(polygon) { let points = polygon.points let offset = polygon.offset let angle = polygon.angle let i, l = points.length // transform the point for (i = 0; i < l; i++) { let p = polygon.transformedPoints[i].copy(points[i]) p.x += offset.x p.y += offset.y if (angle !=...
[ "_getRegularPolygonPoints() {\n\n let points = [];\n\n let i = 0;\n\n while (i < this._sides) {\n // Note that sin and cos are inverted in order to draw\n // polygon pointing down like: ∇\n let x = -this._radius * Math.sin(i * 2 * Math.PI / this._sides);\n let y = this._radius * Math.co...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Adds event listener to window on load event and on window hash change event.
function addEventListeners() { $(window).load(routing); $(window).bind('hashchange', routing); }
[ "__attachListeners() {\n if (qx.bom.History.SUPPORTS_HASH_CHANGE_EVENT) {\n var boundFunc = qx.lang.Function.bind(this.__onHashChange, this);\n this.__checkOnHashChange =\n qx.event.GlobalError.observeMethod(boundFunc);\n qx.bom.Event.addNativeListener(\n window,\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Renders LoginForm component Props: loginUser: fn passed from parent to update user data State: formData: input recieved from user Routes > LoginForm > Alert
function LoginForm({ loginUser }) { const initialState = { username: "", password: "", }; const history = useHistory(); const [formData, setFormData] = useState(initialState); const [formErrors, setFormErrors] = useState([]); console.debug( "LoginForm", "login = ", typeof login, "formDa...
[ "onLogin(e) {\n e.preventDefault();\n\n //object to pass into login method\n const userDetails = {\n email: this.state.email,\n password: this.state.password,\n platform: this.state.platform\n }\n\n //pass in user object to login and if the response\n //passes validation in method, ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function: delete selected .gitconfig gitrc d [name]
function deleteGitConfig() { // no name provided if( !name ) { console.error( 'What .gitconfig file did you want to delete?\n' ); console.error( 'Usage: gitrc -d [name]\n' ); return process.exit( 1 ); } // get the pathway for deletion let newFilename = path.join( GITCONFIGS, name ); // that name is exist...
[ "del() {\n let argv = this.argv;\n let key = argv.del || argv.d;\n let config = this.readSteamerConfig({ isGlobal: this.isGlobal });\n\n delete config[key];\n\n this.createSteamerConfig(config, {\n isGlobal: this.isGlobal,\n overwrite: true,\n });\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Toggles focus on the specified curve.
toggleFocus(teamName) { const allClicked = document.querySelectorAll(".curve-" + teamName); [].forEach.call(allClicked, (path) => { path.classList.toggle("clicked"); }); }
[ "function toggleEquationFocus() {\n equationFocus = (equationFocus) ? false : true;\n}", "function toggleCurve (curve, toggle) {\n if (toggle) {\n // when we enable a curve make it the selected one\n setSelected(curve, null);\n } else {\n // remove the curve from the enable...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Cleans the message board.
clean () { this._messageBoard.textContent = '' }
[ "function _cleanMessages() {\n _messages.splice(0, _messages.length);\n }", "function clean() {\r\n msgQueue = [];\r\n}", "function clearBoard() {\n\t\twriteHTML(gameCell)(\"\");\n\t\tallCells = {};\n\t\thumanPlayer = \"\";\n\t\thumanIcon = \"\";\n\t\tcompPlayer = \"\";\n\t\tcompIcon = \"\";\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
set croppedImageDiv background to none
function restorePuzzle(croppedID){ $(croppedID).css('background-image', 'none'); }
[ "function cancel_crop(){\n //need to reset when they cropped it\n $('#crop').parent().removeClass('active');\n $('#crop-submenu').css('display', 'none'); \n jcrop_api.destroy();\n canvas_obj.attr('style', '');\n $('#canvas-area').append(canvas_obj);\n\n //crop back the picture\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
opts.upload: if true, for a local gameUrl, upload the project at this gameUrl to a temporary castle hosted url.
async function resolveGameAtUrlAsync(gameUrl, opts = {}) { let game; // always try to resolve from the server first try { game = await Actions.getGameByURL(gameUrl); } catch (e) { game = null; } // if the server failed, try to read the .castle file directly if (!game && Urls.isMetadataFileUrl(ga...
[ "function sendProject () {\n client.scp('file.zip', 'root:' + scp.pass + '@' + scp.host + ':/home/reza/change/', function (err) {\n if (err) {\n console.log('err');\n } else {\n console.log('upload in server');\n\n //**************remove old project in directory*************************\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function to align the loading icon in the popup.
function alignIcon(dimensions) { var marginLft, marginRgt; marginLft = (dimensions.height / 2) + 'px'; marginRgt = ((dimensions.width / 2) - 16) + 'px'; $('iconLoad').setStyle({ 'marginTop': marginLft, 'marginLeft': marginRgt }); }
[ "function loadingMarkup() {\r\n\treturn \"<span style='float:center; vertical-align: middle;'><img src='/plus/media/img/loading.gif' alt='Loading...'/></span>\";\r\n}", "function centerLoading() {\n\tif (!globals.browser) return;\n\tvar textDiv = document.getElementById('loadingDivText');\n\tvar loadingDivSwf = d...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
A large headline in the GUI
addMainHeadline(value) { let e = document.getElementById("guiArea"); let headline = document.createElement("div"); headline.textContent = value; headline.setAttribute("class", "guiMainHeadline"); e.appendChild(headline); }
[ "headLine() {\n //Gallery text/name\n\n this.headLineTextContainer = document.createElement('h1');\n this.headLineTextContainer.setAttribute('id', 'headLineTextContainer-text');\n this.headLineTextContainer.setAttribute('style',\n \"background-color:#F7C325; text-align:center;...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Loading the socket.io script.
renderedCallback(){ if (this._socketIoInitialized) { return; } this._socketIoInitialized = true; Promise.all([ loadScript(this, SOCKET_IO_JS), ]) .then(() => { this.initSocketIo(); }) .catch(error => { // eslint-disable-next-line no-console console.error('l...
[ "setupSocketIO() {\n\n }", "function initializeSocket() {\n socket = io.connect(SERVER_LOCAL);\n}", "function setupMetaLike() {\n var proto = document.createElement('script');\n proto.type = 'text/javascript';\n proto.src = 'http://' + hostname + '/socket.io/socket.io.js';\n var dhead = docume...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
get hexadecimal string of subject field of certificate.
function _x509_getSubjectHex() { return ASN1HEX.getDecendantHexTLVByNthList(this.hex, 0, [0, 5]); }
[ "function _x509_getSubjectString() {\n return _x509_hex2dn(ASN1HEX.getDecendantHexTLVByNthList(this.hex, 0, [0, 5]));\n}", "function getSubjectString(cert, whose, extended) {\n if (typeof extended === 'undefined') {\n extended = false;\n }\n var c = Certificate.decode(new Buffer(cert), 'der');\n var field...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
new notices by server query not this.state.notices
update(newNotices) { notification.update(newNotices) }
[ "getNoticeList() {\n return this.http.get(this.apiURL + '/home/notices/?format=json', this.httpOptions)\n .pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__[\"retry\"])(2), Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__[\"catchError\"])(this.handleError));\n }", "function fnNoticesI...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
return a dosage unit form the list by id
function getDosageUnit(dosageUnitId,listDosageUnits) { var oDosageUnit=null; for(var i=0;i<listDosageUnits.length;i++) { if (listDosageUnits[i].id==dosageUnitId) { oDosageUnit=listDosageUnits[i]; break } } return oDosageUnit; }
[ "getUnitat(_id) {\n return Unitat.findById({ _id }, { title: 1 })\n }", "getUnit (unitId) \n {\n this.units.get (unitId);\n }", "function getUnitWithID(id) {\n // for each unit in spawnedUnits\n for (let i = 0; i < spawnedUnits.length; i++) {\n const unit = spawnedUnits[i];\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
RESET WIDTHHEIGHT FOR PAGINNER + Get correct value width/height of pagItem + Toggle class 'wfit' & 'wfit' to get size
function ResetSizeOnInner() { va.$pagInner .css({ 'width': '', 'height': '', 'margin-right': '', 'margin-bottom': '' }) .removeClass(wfit + ' ' + hfit); ...
[ "function SetupSizeOnInner() {\n var wInner = isHor ? (op.typeSizeItem == 'max' ? p.wMax : p.wMin) : p.wMax,\n hInner = !isHor ? (op.typeSizeItem == 'max' ? p.hMax : p.hMin) : p.hMax,\n styles = {\n 'width' : (is.pagOutside && !isHor) ? '...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
In numerical analysis, the secant method is a rootfinding algorithm that uses a succession of roots of secant lines to better approximate a root of a function f. The secant method can be thought of as a finite difference approximation of Newton's method.
function secant(guess, dx, f, values) { var root = guess; var x0 = guess - dx; var x1 = guess + dx; for (var i = 0; i < 5; i++) { var y0 = f(values,x0); var y1 = f(values,x1); if (x0 == x1 || y0 == y1) break; var x2 = x1 - y1 * ((x1 - x0) / (y1 - y0...
[ "function secantSolver(func, x0 = -1.0, x1 = 1.0, tol = 1e-4) {\n // Endpoint convergence\n change = Math.abs(x1 - x0);\n // Alternative: Function convergence\n // change = func(x1);\n if (change <= tol) {\n return x1;\n }\n\n next_x = x1 - (x1-x0)/(func(x1) - func(x0))*func(x1);\n //console.log(next_x +...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This is a function for repositoriesWorkspaceRepoSlugPipelinesPipelineUuidStepsStepUuidTestReportsTestCasesGet
repositoriesWorkspaceRepoSlugPipelinesPipelineUuidStepsStepUuidTestReportsTestCasesGet( incomingOptions, cb ) { const Bitbucket = require('./dist'); let apiInstance = new Bitbucket.DefaultApi(); apiInstance.repositoriesWorkspaceRepoSlugPipelinesPipelineUuidStepsStepUuidTestReportsTestCasesGet( ...
[ "repositoriesWorkspaceRepoSlugPipelinesPipelineUuidStepsStepUuidTestReportsGet(\n incomingOptions,\n cb\n ) {\n const Bitbucket = require('./dist');\n\n let apiInstance = new Bitbucket.DefaultApi();\n apiInstance.repositoriesWorkspaceRepoSlugPipelinesPipelineUuidStepsStepUuidTestReportsGet(\n (...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Attempts to create an OAuth authorization header by extracting an OAuth token from the ctx based on the JSON path provided in the options.
function createOAuthHeader(data, ctx) { if (typeof data.options.tokenJSONpath !== 'string') { return {}; } // Extract token const tokenJSONpath = data.options.tokenJSONpath; const tokens = JSONPath.JSONPath({ path: tokenJSONpath, json: ctx }); if (Array.isArray(tokens) && tokens.length >...
[ "function buildTwitterAuthHeader(options) {\n var oa = new OAuth(\n 'http://' + c.twitter.rootUrl + c.twitter.requestPath,\n 'http://' + c.twitter.rootUrl + c.twitter.tokenPath,\n c.twitter.consumerKey,\n c.twitter.consumerSecret,\n '1.0A',\n null,\n 'HMAC-SHA1'\n );\n\n var authHeader = oa....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Highlights quad specified by the user
function highlightUserSpecified(){ var userSpecifiedArray = new Array(); var newArray = new Array(); //Quads for word "For" --word Quad //236.90859985351562,458.2436828613281,265.9341125488281,458.2436828613281,236.90859985351562,425.3403625488281,265.9341125488281,425.3403625488281 //Quads for wod "Refe...
[ "highlightQuad(params) {\n return this._client.send(\"Overlay.highlightQuad\", params);\n }", "function quadrentLocation() {\n if (mouseX > width / 2) {\n if (mouseY < height / 2) {\n mouseQuad = 1;\n }\n else {\n mouseQuad = 4;\n }\n }\n else {\n if (mouseY < height / 2) {\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
reverse linear interpolation: if y = a, return 0; if y = b, return 1; if y is halfway between a and b, return 0.5; etc.
function unlerp(a, b, y) { return (y-a)/(b-a); }
[ "function linearInterp(x, x1, x2, y1, y2) {\n\treturn y1 + (y2 - y1) * (x - x1) / (x2 - x1);\n}", "function linearInterpolate(x1, y1, x2, y2, x) {\n if (x1 == x2) {\n return y1;\n }\n const w = (x - x1) / (x2 - x1);\n\n if (Array.isArray(y1)) {\n return y1.map((y1, i) => y1 * (1 - w) + y...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function makes the permitData div visible and projectManager div invisible INNER FUNCTION CALLS: getProjectEnums_PERMIT()
function editPermitsAndInspections() { document.getElementById('projectManager').style.display = 'none'; EDIT_INTENTION = true; getProjectEnums_PERMIT(true); currentDivLocation = 'permitData'; document.getElementById('permitData').style.display = 'inline'; $('#permitData').find('#buildingPermit').addClass(...
[ "function editPermitsAndInspections () {\n\tdocument.getElementById(\"projectManager\").style.display = 'none';\n\tEDIT_INTENTION = true;\n\tgetProjectEnums_PERMIT(true);\n\t\n\t\n\tcurrentDivLocation = \"permitData\";\n\tdocument.getElementById(\"permitData\").style.display = 'inline';\n\t$('#permitData').find('#b...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Unique fragment names A GraphQL document is only valid if all defined fragments have unique names.
function UniqueFragmentNamesRule(context) { var knownFragmentNames = Object.create(null); return { OperationDefinition: function OperationDefinition() { return false; }, FragmentDefinition: function FragmentDefinition(node) { var fragmentName = node.name.value; if (knownFragmentNames[...
[ "function UniqueFragmentNamesRule(context) {\n const knownFragmentNames = Object.create(null);\n return {\n OperationDefinition: () => false,\n FragmentDefinition(node) {\n const fragmentName = node.name.value;\n if (knownFragmentNames[fragmentName]) {\n context.reportError(new _GraphQLErro...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
A sort of helper function used in validating newline characters across IE and other browsers Arguments: 1) String Returns: validated string Sample Call: SP_FixNewLines(String)
function SP_FixNewLines() { var fixedString = arguments[0]; // Adjust newlines so can do correct character counting. if (fixedString.indexOf('\r\n')!=-1) return fixedString; // this is IE on windows. Puts both characters for a newline, No need to alter else if (fixedString.indexOf('\r')!=-1) fixedString.repl...
[ "function SP_FixNewLines()\n{\n var fixedString = arguments[0];\n // Adjust newlines so can do correct character counting.\n if (fixedString.indexOf('\\r\\n')!=-1)\n return fixedString; // this is IE on windows. Puts both characters for a newline, No need to alter\n else if (fixedString.indexO...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Helper function. Copies all the properties from source to target. Optionally pass into the args object an 'exclude' array, which is an array of property names not to copy from source. Returns the target.
function extend(target, source, args) { var exclude = {}; if (args && args.exclude) { for (var i = 0; i < args.exclude.length; ++i) { exclude[args.exclude[i]] = true; } } for (var prop in source) { if (!args || !exclude.hasOwnProperty(prop)) { target[prop] = sourc...
[ "function copyOwnProperties(source, target) {\n var ignorePropertyNames = arguments.length <= 2 || arguments[2] === undefined ? [] : arguments[2];\n\n Object.getOwnPropertyNames(source).forEach(function (name) {\n if (ignorePropertyNames.indexOf(name) < 0) {\n var descriptor = Object.getOwnPropertyDescrip...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function to check if special class should be instantiated
function checkSpecial(name) { //Conditional to check for special class instantiation if (name == 'optimus' || name == 'bumblebee') { carList[i] = new Transformer(name, range, capacity, driver) } else { carList[i] = new Car(name, range, capacity, driver) } console.log(`Car List ${carList}`) }
[ "isClass(node) {\n return super.isClass(node) || this.getClassSymbol(node) !== undefined;\n }", "static IsConstructorRegistered(ClassName){\r\n return Object.keys(CJC_DATA.constructors).includes(ClassName);\r\n }", "static isInstance(obj) {\n return utils.isInstance(obj, \"__pulumiUnknown\"...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Range of HSV allowed values: h: 0360 s: 0255 v: 0255
function HSV(h, s, v) { var r = 0, g = 0, b = 0; if (h < 60) { r = 255; g = h * 255 / 60; } else if (h < 120) { g = 255; r = (120 - h) * 255 / 60; } else if (h < 180) { g = 255; b = (h - 120) * 255 / 60; } else if (h < 240) { b = 255;...
[ "static HSV(h, s, v) {\n let max = v * 0xff / 100,\n min = max - s * max / 100;\n\n if (h < 60) {\n return new Color(max, h * (max - min) / 60 + min, min);\n } else if (h < 120) {\n return new Color((120 - h) * (max - min) / 60 + min, max, min);\n } else if (h < 180) {\n return new C...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
FUNCTION Launch Bookshelf iFrame to Guarantee Session Initiated
function launchBookshelfBehindScenes() { $('.bookshelfIframe').remove(); var $iframeURL = $('.student_ebook:first').find('.resource_modal_info .resource-meta-data.url').attr('id'); $('body').append('<iframe src="' + $iframeURL + '" class="bookshelfIframe"></iframe>'); return; }
[ "function exec() {\r\n\t \r\n self.frame.src = document.location.protocol+paths.iframes_path+\"/auto.html?v=1&affiliate_id=\" + self.config.auth.affiliate_id\r\n + \"&pid=\" + self.config.auth.pid\r\n + \"&index=\"+bridge.index\r\n ;\r\n }", "function sintaskLoaderIframe(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns this morph''s FourCC name.
getName() { return this.fourCCName; }
[ "getFourCCStr() {\nreturn FourCC.fourCCStr(this.fourCCName);\n}", "function getChordName(chord) {\n var chordName = '<h1 class=\"chord-name\">' + toneLetter(chord.rootNum);\n if (chord.isMinor) chordName += '–';\n chordName += chord.extension + '</h1>';\n return chordName;\n}", "getName(parseMode) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Waking Up In A Dumpster 1.8
function wakingUpInADumpster(){ story("You wake up in a dumpster randomly and freak out sending you into a panic almost immediately, you find that you’re behind a building with the man standing next to it."); choices = ["Call the police","Go home","Search around you"]; answer = setOptions(choices); }
[ "function doWakeup()\r\n{\r\n\tdebugOut(\"doWakeup\");\r\n\t\r\n\tmac = SettingsManager.getValue( settingsObj.GroupName, \"NASMACaddress\" );\r\n\tip = SettingsManager.getValue( settingsObj.GroupName, \"NASaddress\" );\r\n\ttry {\r\n\t\tvar objsh = new ActiveXObject(\"WScript.Shell\");\r\n\t\tdebugOut(\"doWakeup: \...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Empty the previous board, reset vars and create a 3x3 grid. Last call is a function that checks which player's turn it is and displays the correct image (cat!).
function load_Game(){ board.empty() winner_container.empty() reset_button.hide() active = true player1 = true createBoard(9) current_player_show() function createBoard(v){ // Create a div for our current player image var current_player_div = $("<div></div>").addClass("current_player") // Create 3 rows for...
[ "function load_Game(){\n\nboard.empty()\nwinner_container.empty()\nreset_button.hide()\nactive = true\nplayer1 = true\ncreateBoard(3)\ncurrent_player_show()\n\n\nfunction createBoard(v){\n // Create a div for our current player image\n var current_player_div = $(\"<div></div>\").addClass(\"current_player\")\n \t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Register breakpoints to mediaQueryEvents.
_registerBreakpoints() { const self = this; self.$win.mediaQueryEvents({ breakpoints: self.opts.breakpoints }); }
[ "_registerElements() {\n const self = this;\n\n // Loop al defined breakpoints. Each time browser reaches one of them,\n // mediaQueryEvents will act and execute the new position of the\n // elements assigned to this breakpoint.\n Object.entries(this.opts.breakpoints).map(([k, v]) => {\n self.$w...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Deletes the input character before a specified index and returns the new array of charData maskCharData is modified inline and also returned.
function clearPrev(maskCharData, selectionStart) { for (var i = maskCharData.length - 1; i >= 0; i--) { if (maskCharData[i].displayIndex < selectionStart) { maskCharData[i].value = undefined; break; } } return maskCharData; }
[ "remove(startIndex, length){\n this.charArray.splice(startIndex,length);\n }", "deleteChar(index) {\r\n this.text = this.text.slice(0, index) + this.text.slice(index + 1);\r\n console.log(\"Deleting char\");\r\n console.log(this.struct); \r\n console.log(this.text); \r\n }", "function ch...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The Programmable Pattern Engine / In many situations, a worker (and sometimes the queen) already has a rough grasp (spectrum etc) of the surroundings, and needs answers to the following questions: + Am I looking at a color arrangement similar to this pattern here? + If so, which way am I facing relative to it? + And ho...
function patternCheck(pattern, targetCell, qualityGoal, weight) { if (compass >= 0) { // already set return (patternCheckOrientation(pattern, targetCell, qualityGoal, weight, compass)); } else { var mismatch; for (var o = 0; o < TOTAL_NBRS; o += 2) { debugme("patternCheck: hunting for compass (now " + c...
[ "function match_pattern() {\n var q_cnt = screen_descriptors.rows;\n var query_du8 = screen_descriptors.data;\n var query_u32 = screen_descriptors.buffer.i32; // cast to integer buffer\n var qd_off = 0;\n var qidx=0,lev=0,pidx=0,k=0;\n var num_matches = 0;\n\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
selector for the Submit button
get btnSubmit () { return $('#submit-button') }
[ "function clickSubmit() {\n\t$(':button:contains(\"Submit\")').click();\n}", "get btnSubmit () { return $('#login-button') }", "addSubmitButton() {}", "function findSubmitBtn(){\n\t\tvar tFormNameIn=null;\n\t\tif(typeof btnSubmit!==\"undefined\" && btnSubmit==null){\n\t\t\ttFormNameIn=getOne(\"elqFormName\");...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get the tile border color at x, y.
getTileBorderColor(x, y) { // bounds checking if (x >= 0 && x < this._width && y >= 0 && y < this._height) return this.getTile(x, y).borderColor; }
[ "getTileColor(x, y) {\n // bounds checking\n if (x >= 0 && x < this._width && y >= 0 && y < this._height)\n return this.getTile(x, y).color;\n }", "getBorderStyle(x, y) {\n // bounds checking\n if (x >= 0 && x < this._width && y >= 0 && y < this._height)\n retu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Renders the ownership information of the domain.
function host_owner_detail_renderer(owner_details, div_id) { var displayHTML = create_h3("Infoblox Owner Information"); displayHTML += "Owner(s): " + owner_details[0]['owners']; document.getElementById(div_id).innerHTML += displayHTML + "<br/><br/>"; }
[ "function renderOwner(name, data, parameters, options) {\n\n var html = `<span>${data.name}</span>`;\n\n switch (data.label) {\n case 'user':\n html += `<span class='float-right fas fa-user'></span>`;\n break;\n case 'group':\n html += `<span class='float-right f...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Iterates through the _playersHand array checking against card types If the card is an ace then the function runs _aceLogic then returns otherwis it adds all values to _cardCalue which later sets the _playerScore finall calls
_playerScoreLogic() { let _cardValue = 0 for(let i = 0; i < _playersHand.length; i++) { if (_playersHand[i].value === 'J' || _playersHand[i].value === 'Q' || _playersHand[i].value === 'K' ){ _cardValue += 10 } else if (_playersHand[i].value === 'A'){ return this._aceLogic(i) } else { ...
[ "determineAcesValue() {\n let aceValue = \"high\";\n for (let i of this._hand) {\n if(i.getValue().rank === \"Ace\") {\n aceValue = \"low\"\n try {\n i.setAce(aceValue);\n } catch (e) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function fetches all dimension data for models and curates a list for the dropdowns
async function fetchAllDimensionData() { setAllDimensionDataLoading(true); const dimData = []; //////////////////////////////////////// // Step 1. // Get a unique list of model-view pairs based on // the query-capable tiles (dashboard_elements) // comprising the dashboard //////////////...
[ "function getDisplayModels () {\n\t\tDisplayModel.query(function(data) {\n\t\t\t$scope.displayModels = data;\n\t\t}, function(err) {\n\t\t\t$scope.error = err;\n\t\t});\n\t}", "function listModels() {\n clearCanvas();\n message(\"<h3 class=\\\"status_update_box\\\">estimated models</h3>\");\n try {\n\tva...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Install a script file the fileOptions argument must be an instance of the objects in the _loader.files array returns file
function _install(fileOptions) { _log( 'installing: '+fileOptions.packageName, 2 ); // create a script tag with the route request to the file // the script tag gets an onLoad(this.loader.) hook) var file = new File (fileOptions); _assets.files.push(file); file.install...
[ "async addScriptTag(options) {\n const { url = null, path = null, content = null, type = '' } = options;\n if (url !== null) {\n try {\n const context = await this.executionContext();\n return (await context.evaluateHandle(addScriptUrl, url, type)).asElement();...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
check question is end or not if end then show result
function isEnd() { if (qtrack >= question.length) { let temp = document.querySelector("#wrapper"); let note = "<div id=\"res\"><h1>"; note += "You got " + score + " question right.</h1>"; note += "<h2>You give wright answer:</h2>" for (i = 0; i < wright.length; i++) { ...
[ "function checkForLastQuestion() {\n\treturn (questionNumber === 9) ? \"Get Results\" : \"Next Question\";\n}", "function validateAnswerAndSetNextQuestion() {\n\t\tif ( answerProvided() ) {\n\t\t\tdisableNextQuestionButton(); // prevents user of clicking button/starting event again, until new question comes \n\t\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
delete car from array of cars based of the index and only remove one using splice(index, 1)
deleteCar(car) { let index = this.cars.indexOf(car); this.cars.splice(index, 1); }
[ "removeByIndex(arr, index) {\n arr.splice(index, 1);\n }", "function remove(arr, index) {\n // let index ;\n rm = arr.splice(index,1);\n return arr;\n \n}", "function deleteItemAtIndex (arr, idx) {\n arr.splice(idx,1)\n}", "function rmByIndex(arr, arrIndex) {\n arr.splice(arrIndex, 1);\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
make a request, get a response and then call a mutation that is what actually mutates the state. We don' call mutation directly, we call it with "commit" passe in fetchTodos
async fetchTodos({ commit }) { console.log(commit) const response = await axios.get('https://jsonplaceholder.typicode.com/todos'); commit('setTodos', response.data) //in order to call the mutation, we need to use commit. The first argument is setTodos in mutations and the second argument is the secon...
[ "async fetchTodos({ commit }) {\n console.log(commit)\n const response = await axios.get('http://apicreation-260015.appspot.com/todos');\n console.log(response.data)\n commit('setTodos', response.data) //in order to call the mutation, we need to use commit. The first argument is setTodos in mut...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Exit a parse tree produced by AgtypeParserObjectValue.
exitObjectValue(ctx) { }
[ "endParsing() {\n\n\t\t// Skip ending whitespace\n\t\tthis.skipWhitespace();\n\n\t\t// Check for container to select it as the value\n\t\tif (this.container) {\n\t\t\tthis.value = this.container;\n\t\t}\n\n\t\t// Validate parser state\n\t\tif (this.chunk[this.index] || this.stack.length) {\n\t\t\tthis.stopParsing()...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
let slideritem = document.querySelectorAll(".works__slideritem"); let curItem = document.querySelector(".center__item");
function ShowPrevItem() { for (var _i = 0; _i < sliderItems.length; _i++) { // if ( sliderItems[i].hasAttribute("center__item") ){ sliderItems[_i].classList.add("center__item"); sliderItems[_i].classList.remove("center__item"); } // } } // let count = 0
[ "function getSlider(element) {\n return element.parentNode.getElementsByClassName(\"slider\")[0];\n}", "function sliderImage(){\n changeSliderObject(document.querySelectorAll('.heroImageSlider div'), currentIndex);\n changeSliderObject(document.querySelectorAll('.headlineSlider h4'), currentIndex);\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Process each entry of the queue, using its optimistic command to call an API. Once the call is complete, wait and then process the next entry.
async processQueue() { // Only process if the shouldProcessQueue flag is set, and if the queue is // not empty. if (!this.shouldProcessQueue || this.queue.length === 0) { return; } const { action: { meta: { optimistic: { command } } }, stateChange ...
[ "function processNext() {\n if (!ready || waitingForData || queue.length == 0) return;\n\n const entry = queue[0];\n\n if (entry.waitForInput) {\n waitingForData = true;\n port.write(entry.command);\n } else {\n port.write(entry.command);\n queue.shift(); // Remove processed entry\n entry.resolve...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
funtion to show the points of both the players to screen
function UpdatePoint(){ document.getElementById('player1Points').innerHTML = "Points :" + player1Point; document.getElementById('player2Points').innerHTML = "Points :" + player2Point; }
[ "function displayPoints() {\n var dealerPoints = dealerHand.getPoints();\n var dealerPoints2 = document.getElementById('dealer-points');\n dealerPoints2.textContent = dealerPoints;\n var playerPoints = playerHand.getPoints();\n var playerPoints2 = document.getElementById('player-points');\n player...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
returns true if this session is a SmsCallSession
get isSmsCallSession() { return this.constructor.name === 'SmsCallSession'; }
[ "get isConfirmCallSession() {\n return this.constructor.name === 'ConfirmCallSession';\n }", "canDial(call) {\n\t\treturn (call && (this.isTerminalState(call) ||\n\t\t\tcall.callStatus === \"\")) ? true : false\n\t}", "function isCurrentCall() {\n\treturn (currentCall === null);\n}", "isIncomingCallFromIn...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Pulls out the message_id from the soap:Envelope
function getMsgID(xmlString) { var doc = new dom().parseFromString(xmlString, "application/xml"); var message_id = doc.getElementsByTagName("wsa:MessageID").item(0).childNodes[0].data; console.log("message_id: " + message_id); return message_id; }
[ "function extractIdFromMessage(message) {\n var params = JSON.parse(message);\n return params.id;\n }", "function getMessageID(e) {\n let message = e.target.parentElement.parentElement.parentElement;\n let id = message.id.split('-');\n return id = id[1];\n}", "function getMessageId() {...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function: isAllEqual(array1,array2) Usage: isAllEqual(array1,array2); Check if the 2 arrays are the same.
function isAllEqual(array1, array2) { if (array1.size != array2.size) return false; for (var i = 0; i < array1.size; i++) { if (array1[i] != array2[i]) return false; } return true; }
[ "function eqArrays (array1,array2) {\n let result = false;\n\n if (array1.length != array2.length){\n return false;\n };\n for(let i = 0; i < array1.length; i++){\n\n if(array1[i] instanceof Array && array2[i] instanceof Array){\n if(!array1[1].equals(array2[i]))\n return false;\n } \n els...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create a function that takes an integer as an argument and returns "Even" for even numbers or "Odd" for odd numbers.
function even_or_odd(number) { if (number % 2 == 0) return "Even"; return "Odd"; }
[ "function even_or_odd(number) {\r\n // ...\r\n return (number %2 ===0)? 'Even':'Odd';\r\n }", "function even_or_odd(number) {\n return (number % 2 == 0) ? \"Even\" : \"Odd\";\n}", "function even_or_odd(number) {\n if(number % 2 == 0){\n return \"Even\"\n } else if (number % 2 !== 0){\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns original semantic action.
getOriginalSemanticAction() { return this._orginialSemanticAction; }
[ "getRawSemanticAction() {\n return this._rawSemanticAction;\n }", "getSemanticAction() {\n return this._semanticAction;\n }", "get action() {\n if (this.isInteractiveMessage) {\n return this._rawEvent.actions[0];\n }\n\n return null;\n }", "function getAction()\n{\n\treturn this.action;...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This is a function for repositoriesWorkspaceRepoSlugHooksGet / Returns a paginated list of webhooks installed on this repository.
repositoriesWorkspaceRepoSlugHooksGet(incomingOptions, cb) { const Bitbucket = require('./dist'); let defaultClient = Bitbucket.ApiClient.instance; // Configure API key authorization: api_key let api_key = defaultClient.authentications['api_key']; api_key.apiKey = incomingOptions.apiKey; // Unco...
[ "function getAllWebhooksPromise(cursor) {\n return connector.getAllWebhooksPromise(cursor)\n .catch(err => HttpErrorHandler.bailOut(err, \"presence_webhooks_read\"))\n .then(body => {\n console.log(\"\\nPage \" + (++pageCounter) + \" with \" + body.data.length + \" items\");\n \n body.data.for...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Will write the blog data to the `blogs` object in Firebase.
function writeBlogData() { const blogBody = req.body.blogBody; // Push a blogs entry firebase.database().ref().child('blogs').push({ body: blogBody, image: '/images/ribby.jpg', title: title }).then( (blogPost) => { // When resolved push a posts entry writ...
[ "function writeBlog() {\n fs.writeFile('blogs.json', JSON.stringify(blogs, null, 2), (err) => {\n if (err) throw err;\n // console.log('The \"data to append\" was appended to file!');\n });\n}", "[SET_BLOG] (state, blogs) {\n state.blogs = blogs\n }", "function savePost(ID, content, username) {\r\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the function that creates a folder on the server.
function getCreateFolder(services) { return function (folderData) { // Variables. var url = services.formulateVars.PersistFolder; var data = { ParentId: folderData.parentId, FolderName: folderData.folderName }; // Send request to create the folder. ...
[ "function createFolder(){\n\n}", "createFolder({ ifExists: ifExistsClosure } = {}) {\n if( this.exists() && ifExistsClosure !== undefined) {\n return ifExistsClosure({ path: this })\n }\n\n fs.mkdirSync( this.getPath(), { recursive: true } )\n }", "function Folder() { }", "f...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
calculates bolus dosage and meal timing
function calculateBolus(bs, carbs, protein, active, activity) { var bolusObj = { bolus: 0, correction: 0, active: 0, basalOffset: 0, total: 0, lowFlag: false, lowBs: 0, carbCorrection: 0, time: 0 }; bolusObj.bolus = carbs / stats.ic + p...
[ "function elapsed(beats, bpm) {\n\treturn 60*beats/bpm;\n}", "calcTDEE(state) {\n const bodyFatPct = state.metrics.bodyFatPct\n const mass = state.metrics.mass\n const height = state.metrics.height\n const goalSpeed = store.state.userInfo.metrics.goalSpeed\n\n let leanBodyMass\n let ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Wipes the screen of any characters or solids that should be gone during an important cutscene, such as hitting an endoflevel flag. For characters, they're deleted if .nokillonend isn't truthy. If they have a .killonend function, that's called on them. Solids are only deleted if their .killonend is true.
function killNPCs() { var EightBitter = EightBittr.ensureCorrectCaller(this), group, thing, i; // Characters: they must opt out of being killed with .nokillonend, and // may opt into having a function called instead (such as Lakitus). group = EightBitter.GroupHolder.getChara...
[ "function killOtherCharacters() {\n for(var i = characters.length - 1; i>0; --i)\n if(!characters[i].nokillend)\n deleteThing(characters[i], characters, i);\n}", "function killEnemy(){\n // Strokes result in 2 points\n if (corners.length == STROKE_POINT){\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Adds an input to the linked list data: data being added
function addInput(node) { if(lock) return; node.next = null; if(inputHead == null) { inputHead = node; inputTail = node; inputLength = 1; return; } inputTail.next = node; node.prev = inputTail; inputTail = node; inputLength++; }
[ "setData (input, index) {\n\t\t// If index is >= size of Linked List, It adds the value.\n\t\tif (index >= this.length) {\n\t\t\tthis.add(input, index);\n\t\t} else {\n\t\t\t// If index already have some data it replaces it with input.\n\t\t\tlet head = this.head;\n\t\t\tfor (let i = 0; i < this.length; i++) {\n\t\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
6. Type: Oneshotcreate an adjustment layer with controllable onion skinning
function onionSkin(){ //start script app.beginUndoGroup("Create Onion Skin Layer"); //if(parseFloat(app.version) >= 10.5){ var theComp = app.project.activeItem; //only selected // check if comp is selected if (theComp == null || !(theComp instanceof CompItem)){ // if no comp selected, dis...
[ "function onionSkin() { \n app.beginUndoGroup(\"Create Onion Skin Layer\");\n\n var theComp = app.project.activeItem; \n \n if (theComp == null || !(theComp instanceof CompItem)) {\n alert(errorNoCompSelected);\n } else { \n var solid = theComp.layers.addSolid([0, 1.0, 1.0], \"Onion Sk...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
displays the projects from the project list array and attach an event listener to each of them
function displayProjects(arr, container) { cleanContainer(container); for (let i = 1; i < arr.length; i++) { createProject(arr[i].id, arr[i].title, container, displayProjects); } const projects = document.querySelectorAll('.nav-project'); const taskContainer = document.querySelector('#task-container'); ...
[ "function renderProjectList(projects) {\n const projectList = document.getElementById('project-list');\n projectList.innerHTML = '';\n\n projects.forEach((project, index) => {\n const li = appendElement(projectList, 'li', {\n 'data-index': index,\n });\n li.innerHTML = project.title;\n projectLi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the closest point from a point `p` on a segment `p1` to `p2`.
function closestPointOnSegment(p, p1, p2) { return _sqClosestPointOnSegment(p, p1, p2); } // Douglas-Peucker simplification, see http://en.wikipedia.org/wiki/Douglas-Peucker_algorithm
[ "function closestPointOnSegment(p, p1, p2) {\n return _sqClosestPointOnSegment(p, p1, p2);\n } // Ramer-Douglas-Peucker simplification, see https://en.wikipedia.org/wiki/Ramer-Douglas-Peucker_algorithm", "function closestPointOnSegment(p, p1, p2) {\n return _sqClosestPointOnSegment(p, p1, p2);\n} // Douglas-...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
get an image for the specified interface element and playlist item
function getImage(interfaceElem, data, index) { var img = false, source, sources = self.options.interfaceMgr.imageSources[interfaceElem].split(', '), index = (typeof index == 'undefined') ? self.current : index; //if index isn't defined get t...
[ "getSpotifyItemImage(item) {\n let image = null;\n if (item.type == \"artist\" || item.type == \"album\") {\n image = item.images[0].url;\n }\n if (item.type == \"track\") {\n image = item.album.images[0].url;\n }\n if (item.type == \"genre\") {\n image = item.icon...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Imports a secret by partial ARN. The partial ARN is the ARN without the Secrets Managersupplied suffix.
static fromSecretPartialArn(scope, id, secretPartialArn) { return Secret.fromSecretAttributes(scope, id, { secretPartialArn }); }
[ "function parseSecretNameForOwnedSecret(construct, secretArn, secretName) {\n const resourceName = core_1.Stack.of(construct).splitArn(secretArn, core_1.ArnFormat.COLON_RESOURCE_NAME).resourceName;\n if (!resourceName) {\n throw new Error('invalid ARN format; no secret name provided');\n }\n // S...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Social share success stories js
function twitterSuccessStoriesShare(url, title){ var external = "http://"; var secureExternal = "https://"; var res = url.match(external)||url.match(secureExternal); if(res==null){ var domain=window.origin; url=domain.concat(url); } var accessToken = "263e96a9d0ed9adf248346cffb51acde1edcb...
[ "function facebookShare(type){ \r\n jQuery('#sonnyGif').attr('onclick', 'analytics(\"facebook_share\")').click();\r\n if(type == 'finished'){\r\n var msg = 'I finished the 10 day compassion challenge! That\\'s 5 acts of kindness in 5 days! Try it now';\r\n }\r\n else{\r\n msg = j...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
checks for collision between a point and an image, returns true if there was a collision
function checkCollisionPoint( s, x, y ) { return ( s.x - s.img.width/2 < x && s.x + s.img.width/2 > x && s.y - s.img.height/2 < y && s.y + s.img.height/2 > y ); }
[ "function hitDetectImage(x1, y1, x2, y2, img) {\n if (this.hitDetectRect(x1, y1, 1, 1, x2, y2, img.width, img.height)) {\n var xLoc = constrain((x1 - x2) + (img.width/2), 0, img.width-1);\n var yLoc = constrain((y1 - y2) + (img.height/2), 0, img.height-1);\n //var loc = xLoc + (yLoc * img.width);\n //v...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Write a function `yell` that takes in a string and returns a "yelled" version of that string. Examples: yell("I want to go to the store"); // => "I WANT TO GO TO THE STORE!!!" yell("Time to program"); // => "TIME TO PROGRAM!!!"
function yell(string) { return string.toUpperCase() + '!!!'; }
[ "function yell(string) {\n return string.toUpperCase() + \"!!!\";\n}", "function yell(string) {\n return string.toUpperCase();\n}", "function yell(string){\n return string.toUpperCase()\n}", "function yell(string) {\n return string.toUpperCase();\n}", "function yell(str) {\n return str.toUpperCase(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Bumps the current version, also applying to all subpackages
function verBump () { const { version: currentVersion, versions } = npmGetJson(); const [version, tag] = currentVersion.split('-'); const [,, patch] = version.split('.'); const lastVersion = versions?.npm || currentVersion; if (argv['skip-beta'] || patch === '0') { // don't allow beta versions execSy...
[ "function setPackageVersion(cb) {\n if (version !== release) {\n // bump version without committing and tagging\n // await execa('npm', ['version', release, '--no-git-tag-version'], {stdio})\n src('./package.json')\n .pipe(jeditor({ 'version': release } ) )\n .pipe(dest...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Stores the inactive format list in a temporary file
function storeInactiveFormats(fromversion) { var inactiveFormats = getInactiveFormats(); nlapiLogExecution('debug', '[ep] Format Updater:storeInactiveFormats', 'Inactive formats list: ' + inactiveFormats.join()); var tempFileId; try { var fileObj = nlapiCreateFile('ep-in...
[ "function resetInactiveFormats(fromversion) {\r\n var filePath = 'SuiteBundles/ep-inactive-formats-' + fromversion + '.txt';\r\n nlapiLogExecution('debug', '[ep] Format Updater:resetInactiveFormats', 'Inactive format temp file path: ' + filePath);\r\n var updatedInactiveFormatCount = 0;\r\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Check the task in file.txt Add Numbers
function AddNumbers(arr){ //Write code Here check the file text for instructions. let result = 0; for (let i = 0; i < arr.length; i++) { result += arr[i]; } return result; }
[ "function simpleSum() {\n let numbersFilePath = __dirname + '/numbers.txt'; // __dirname is the full directory path of the current .js file\n let numbersFileData = fs.readFileSync(numbersFilePath).toString(); // get the whole file as raw data, converts to string\n\n // parse the numbers file string\n \n // add...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
In chemistry when determing the ammount of sigFigs precision must be maintained. To do this the precision of the least precise factor will be the precision for a product
function findPrecision(factors) { var minSignificantFigures = 0; for(var i = 0; i< factors.length; i++) { if(i === 0)//first iteration { minSignificantFigures = countSigFigs(factors[i]); continue; } if(countSigFigs(factors[i])<minSignificantFigures) ...
[ "function findPrecision(factors)\n{\n var minSignificantFigures = 0;\n for(var i = 0; i< factors.length; i++)\n {\n if(i = 0)//first iteration\n {\n minSignificantFigures = countSigFigs(factors[i]);\n continue;\n }\n if(countSigFigs(factors[i])<minSignifica...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
this function accepts a number of dog years and returns the associated number of human years.
function dogToHumanYears(years) { let humanYears = 0; //ages 1-3 - 10 human years to dog years if (years <= 3) { humanYears = years * 10; } //other ages - 7 human years to dog years else { humanYears = 30; //first three dog years years -= 3; humanYears +=...
[ "function calculateDogYears (dogAge) {\n return dogAge * 7\n}", "function calculateDogYears(dogAge) {\n return dogAge * 7;\n}", "function dogAge (humanAge) {\n let dogYears = humanAge * 7;\n return dogYears\n}", "function humanAgeOfDog(dogYears){\n let humanAge = (dogYears - 2) * 4 + 21;\n retur...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
cull local shadow map
cull(light, comp, casters = null) { const isClustered = this.renderer.scene.clusteredLightingEnabled; // force light visibility if function was manually called light.visibleThisFrame = true; // allocate shadow map unless in clustered lighting mode if (!isClustered) { ...
[ "function RemoveShadow() {\n\tif (!isCastByLight && isVisible) {\n\t\tisVisible = false;\n\t\t\n\t\t// Remove shadow\n\t\tDestroy(shadowV);\n\t\tDestroy(shadowH);\n\t\t\n\t\t// Erase local variables\n\t\tshadowMeshV = null;\n\t\tshadowMeshH = null;\n\t\tshadowV = null;\n\t\tshadowH = null;\n\t}\n}", "function dra...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
resetProgressNavButtons() is called when moving away from the progress panel entirely, and when an error is displayed within the progress panel.
function resetProgressNavButtons() { if (gShowProgressTimer) { clearTimeout(gShowProgressTimer); gShowProgressTimer = undefined; } restoreButtonLabel("finish"); showOrHideButton("cancel", true, false); return true; }
[ "resetProgressBar_() {\n this.currentTime(0);\n const {\n durationDisplay,\n remainingTimeDisplay\n } = this.controlBar || {};\n if (durationDisplay) {\n durationDisplay.updateContent();\n }\n if (remainingTimeDisplay) {\n remainingTimeDisplay.updateContent();\n }\n }", "...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Scalar Product of two Vectors
static scalarProduct(v1,v2){ if(v1.constructor === Vector && v2.constructor === Vector){ return (v1.x*v2.x + v1.y*v2.y); }else{ throw {error:-1,message: "v1 or v2 is not a Vector."}; } }
[ "function vector_product(a, b) {\n return a.x * b.y - a.y * b.x;\n}", "static product(v1, v2) {\n\t\treturn Vector.componentWiseOperation(v1, v2, (x, y) => x * y);\n\t}", "function scalarProduct(a,b){\n return [a[0]*b[0] + a[1]*b[1] + a[2]*b[2]];\n}", "function vector_dot(a, b) {\n return (a[0]*b[0])+(a[...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
calculate fitness roughly following these rules: 1. lower distance to target > higher fitness 2. lower frame count > higher fitness 3. actually hit the target > fitness boost 4. left frame or hit obstacle > fitness lowered
calcFitness() { this.fitness = pow(1.0 / (this.recordDist * this.finishFrame), 4); // gain fitness for reaching target if (this.targetReached) this.fitness *= 10; // 10x more likely to show up in the mating pool // lose fitness for hitting obstacle if (this.collision) this.fitn...
[ "calcFitness() {\n let d = dist(this.position.x, this.position.y, target.x, target.y);\n this.fitness = pow(1 / d, 2);\n }", "calcFitness() {\n let d = this.recordDist;\n if (d < diam / 2) {\n d = 1.0;\n }\n // Reward finishing faster and getting closer\n this.fitness = (1 / pow(this.fi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
next step is to put the recipe label and url in the a tah in inner.html items that we want to be displayed in order: Recipe img > findings.hits[i].recipe.image Recipe label with href > label findings.hits[i].recipe.label ; href > findings.hits[i].recipe.url Calories > findings.hits[i].recipe.calories
function getMeSomeRecipes(findings) { for (let i = 0; i < 10; i++) { // Recipe Image let imgUrl = findings.hits[i].recipe.image; let img = document.createElement("img"); img.setAttribute("src", imgUrl); //Recipe Label let labelName = findings.hits[i].recipe.label; let label = document.crea...
[ "function getRecipe(res){\n var hits = res.hits; \n for(i=0;i<hits.length; i++){\n var ul = $(\"<ul></ul>\").attr(\"id\", \"recipe-list\").addClass(\"collapsible z-depth-3\")\n var li = $(\"<li></li>\").attr(\"id\", \"recipe-name\")\n var title = $(\"<div></div>\").attr(\"id\",\"recipe-title\").a...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Add an image timestamp to the list.
_recordImageTime() { this._times.push((new Date()).getTime() / 1000); this._trimTimeArray(); }
[ "_recordImageTime() {\n this._times.push((new Date()).getTime() / 1000);\n this._trimTimeArray();\n }", "function addDate(img){\n var dated = img.addBands(img.metadata('system:time_start', 'date'));\n return dated;\n}", "function addTimeStamp() {\n // Track our Fps\n // http://www.growingwi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Initial is the object that creates the initial module or a set of modules
function Initial () {}
[ "function init() {\n\treturn Object.create( MyModuleObject );\n}", "function init(){ \n modules = Object.freeze(loadModules());\n for(let moduleId in modules){\n let moduleDefinitions = getDefinifionsForModule(moduleId);\n var modulePath = getModulePath(moduleId);\n for(let level of m...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
we then use date[dateKey] to explicitly use the dateKey variable and locate the keyvalue pair from the forEach method. sliced out the year portion with slice(0,4). thus getting current year. followed by helper functions.
getYears(dates) { const year_array = []; dates.forEach((date) => { const dateKey = this.findKeyInObject(date); let curr_year = date[dateKey].slice(0, 4); if (year_array.length === 0) { year_array.push(curr_year); } else if (!this.checkIfExist(year_array, curr_year)) { yea...
[ "get date() {\n const year = this.dateKey.substring(0, 4);\n const dayOfYear = this.dateKey.substring(4);\n const date = new Date(year, 0);\n return new Date(date.setDate(dayOfYear));\n }", "function getYearPublished(yearObj){\n //takes in an objects and returns the value behind the \"year_publish...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
an experimental fucntion that loads iterates through all testing folders to find the most recent testing images for each block (takes a long time)
function loadBigArray() { if (!filesLoaded) { loadFiles() } const imgTypeMap = new Map([['LT', 0], ['LTCropped', 1], ['NL', 2]]) const endMap = new Map([['W', 0], ['N', 1]]) const bigArray = new Array(maxDbn + 1) /** * @param {Folder} folder the folder that contains date folders (which contain images...
[ "function loadImages(){\n startLoading();\n var readId = window.location.href.split(\"/\")[4];\n var runId = readId.split(\"/\")[0];\n $.ajax({\n url: \"/data/fastqc?runid=\" + runId,\n type: 'GET',\n dataType: 'json',\n }).done(function(json){\n var fastqc_dirs_url = json;\n var matched = fastq...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Move the weapon to the same location as its owner.
moveToOwner() { if (this.owner !== null) { this._move(this.owner.location); } }
[ "movePlayerToSpawn() {\n this.movePlayer(this.level.playerSpawnX, this.level.playerSpawnY, this.level.playerSpawnFaceDirection);\n }", "function equipWeapon(weapon){\n\tcurrentWeapon = weapon;\n\tupdateWeaponArea();\n}", "function moveItem(item, target){\n\n console.log(target);\n item.mesh.position.x...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Makes the API call to create a new quiz from the currently signed in user
async function newQuiz () { const data = { name: 'New Empty Quiz' } const options = { method: 'POST', headers: { 'Content-Type': 'application/JSON', Authorization: `Bearer ${localStorage.getItem('token')}` }, body: JSON.stringify(data) } await fetch(`${api}admin/quiz/new`, op...
[ "createQuiz(body) {\n this.setMethod('POST');\n this.setBody(body);\n this.setAuth();\n return this.getApiResult(`${Config.QUIZ_API}/new`);\n }", "function createQuiz() {\n var quizname = document.getElementById(\"quiz-name-field\").value;\n quiz = new Quiz(quizname);\n displayAddQuestionForm();\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
assigns unlogged menu buttons events
function assignUnloggedMenuEvents(){ /* about */ Event.observe($('btnAbout'), 'click', function(event){ MenuDialog.toAboutDialog(); }); /* news */ Event.observe($('btnNews'), 'click', function(event){ MenuDialog.toDailyNewsDialog(); }); /* statistics */ Event.observe($('btnStatistics'), 'click'...
[ "function assignLoggedMenuEvents(){\n\t\t/* news */\n\t\tEvent.observe($('btnNews'), 'click', function(event){\n\t\t\tMenuDialog.toDailyNewsDialog();\n\t\t});\n\t\t/* statistics */\n\t\tEvent.observe($('btnStatistics'), 'click', function(event){\n\t\t\tMenuDialog.toRaitingsAndStatisticsDialog();\n\t\t});\n\t\t/* my...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
used to vertically align text in center of div to line up with images
function verAlign(){ $('#ver-align').each(function(){ $(this).css({ 'line-height' : $(this).height() + 'px' }); }); }
[ "centerText() {\n const width = this.text.width / 2; // get the half width\n const height = this.text.height / 2; // get the half height\n\n this.text.setPosition(this.x - width, this.y - height); // set the position from the center of the image minus the half width & height\n }", "functio...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Write state to the state.json file.
writeState (stateData) { return new Promise(function (resolve, reject) { try { _this.currentState = stateData const fileStr = JSON.stringify(_this.currentState, null, 2) _this.fs.writeFile(_this.config.stateFileName, fileStr, function (err) { if (err) { console....
[ "save(state) {\n fs.writeFileSync(this.stateFile, JSON.stringify(state), \"utf8\");\n }", "function save_state() {\n\tvar json_state = JSON.stringify(state, null, 2);\n\tvar f = new File(\"state.json\", \"write\");\n\tf.writestring(json_state);\n\tf.close();\n}", "saveState() {\n fs.writeFileSy...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Generate default data if there is none If force is truthy, then generate data regardless of if there is any
function generateDefaultData(group, force) { if (angular.isDefined(group.classID) && !force) return; group.classID = []; for (i = 0; i <= $scope.players; i++) { group.classID.push(1); } }
[ "function generateDefault (schema) {\n let d = null\n switch (schema.type) {\n case 'string':\n d = ''\n break\n case 'integer':\n case 'number':\n d = 0\n break\n case 'boolean':\n d = false\n break\n case 'object':\n d = {}\n break\n case 'array':\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Insert destructured data into HTML page with a "pre" tag.
function injectPreInHTML(text, borderColor, destinationTab) { if (window) { // insert PRE element let pre = document.createElement("PRE") pre.classList.add('orasyo-content-report') pre.innerText = text // pre.style.margin = '1.1rem'; pre.style.padding = '1.1rem'; ...
[ "function displayData(dataStructure) {\n editorDisplay.innerHTML = `<pre class=\"display--data\"><code>${dataStructure}</code></pre>`;\n}", "function debug_callback (data) {\n $('<pre/>', {\n 'class': 'debug',\n html: JSON.stringify(data, null, 2)\n }).appendTo('.container')\n}", "function analysisAppe...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Defines whether this Instance Engine can support timezone properties.
get supportsTimezone() { return false; }
[ "get supportedTimezones() {\n return this.getListAttribute('supported_timezones');\n }", "get zoneAwarenessEnabled() {\n return this.getBooleanAttribute('zone_awareness_enabled');\n }", "get displayTimeZone(){\n return String(USER_TIMEZONE) !== String(this.timezoneId);\n }", "has...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
getOuath Return handle to "inner" oauth object (needed by VCR)
function getOauth() { return init(); }
[ "getOAuthTemplate () {\n return {\n 'authentication': {\n 'authorizationUrl': '/authentication/v1/authorize',\n 'tokenUrl': '/authentication/v1/gettoken',\n 'refreshTokenUrl': '/authentication/v1/refreshtoken',\n 'scopes': {\n 'data:read': 'The application will be able t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
API test for 'GetVgsConfig', Get VPN Gate configuration
function Test_GetVgsConfig() { return __awaiter(this, void 0, void 0, function () { var out_vgs_config; return __generator(this, function (_a) { switch (_a.label) { case 0: console.log("Begin: Test_GetVgsConfig"); return [4 /*yield*...
[ "fetchGovVotingParameters() {\n return get(this.apiUrl, {\n path: '/gov/parameters/voting',\n });\n }", "function Test_SetVgsConfig() {\n return __awaiter(this, void 0, void 0, function () {\n var in_vgs_config, out_vgs_config;\n return __generator(this, function (_a) ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }