Search is not available for this dataset
query
stringlengths
7
355k
document
stringlengths
9
341k
metadata
dict
negatives
listlengths
0
101
negative_scores
listlengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Call the API w/ authentication
_runAuth(method, data, params) { if (!this.arcgisauth) throw new Error('Please specify client_id and client_secret!'); return new Promise((resolve, reject) => { this.arcgisauth.auth() .then((token) => { const query = this._getQuery(method, data, params); query.token = token; if (query.error) reject(query.error); this._execute(this.endpoint, method, query) .then(resolve) .catch(reject); }) .catch(reject); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "authenticate(cb) {\n this.apiCall(\"GET\", DoctolibClient.authRessource, null, null, cb);\n }", "function auth() {\n \n var token = getParameterByName('token');\n var auth = getParameterByName('auth');\n if (auth == 'rest') {\n return authWithRest(token);\n } else {\n return authWithSDK(toke...
[ "0.7060153", "0.69653654", "0.6612886", "0.6589248", "0.6528325", "0.6522597", "0.651367", "0.6468816", "0.6463431", "0.645717", "0.64408207", "0.6436154", "0.640286", "0.63968545", "0.6382859", "0.6369196", "0.6364293", "0.6294595", "0.626297", "0.62256294", "0.62181896", ...
0.6241805
19
Parsing error and return error object
parseError(error) { if (error.code === 400 && (error.details && error.details.length)) { return { code: error.code, msg: get(error, 'details')[0] || 'Error', }; } return error; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function ParserError(e,t){this.message=e,this.error=t}", "function parseError(err, path){\n app.logger.log(err, path); \n \n if(typeof err == 'string')\n return err;\n return 'Unknown error';\n }", "function parseError(input, contents, err) {\n var errLines = err.me...
[ "0.7639631", "0.72706497", "0.71979725", "0.70759445", "0.70511776", "0.69986945", "0.6817068", "0.67343694", "0.67053854", "0.6647787", "0.65015846", "0.64899427", "0.6364251", "0.6264464", "0.6232777", "0.6219385", "0.6184491", "0.6124249", "0.6114782", "0.61146456", "0.611...
0.7544482
1
global getInputType:true / global getFieldValue:true / global getFormValues:true / global formData / global getInputValue:true / global getFieldsValues:true / global getAllFieldsInForm:true / global Hooks / global getInputData:true / global updateTrackedFieldValue:true / global updateAllTrackedFieldValues:true / global formValues
function getFieldsValues(fields, ss) { var doc = {}; fields.each(function formValuesEach() { var fieldName, val = AutoForm.getInputValue(this, ss); if (val !== void 0) { // Get the field/schema key name fieldName = $(this).attr("data-schema-key"); doc[fieldName] = val; } }); return doc; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function setFormFields () {\n let query = qs.parse(window.location.search.substr(1));\n\n setCheckbox(form.allow.json, query[\"allow-json\"]);\n setCheckbox(form.allow.yaml, query[\"allow-yaml\"]);\n setCheckbox(form.allow.text, query[\"allow-text\"]);\n setCheckbox(form.allow.empty, query[\"allow-empty\"]);\...
[ "0.60265553", "0.558891", "0.55873245", "0.55761063", "0.5570761", "0.5543718", "0.55192566", "0.54981834", "0.54981834", "0.54981834", "0.5495228", "0.5478317", "0.54038614", "0.53910923", "0.53910923", "0.53910923", "0.53910923", "0.53910923", "0.53910923", "0.53910923", "0...
0.0
-1
CHECK IF TOKEN EXIST
async function requireToken(req, res, next) { // get the Auth header value const authHeader = req.headers.authorization; if (authHeader) { const token = authHeader && authHeader.split(' ')[1]; // verify the access token jwt.verify(token, process.env.ACCESS_TOKEN_SECRET, (err, tokenUser) => { if(err) { // verify return an error res.status(401).send({ error: '401 Token is unauthorized' }) } else { next() } }) } else { res.status(401).send({ error: '401 token does not exist' }) } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function checkToken(token) {\n if (!token) {\n throw new Error('No access token found');\n }\n}", "async tokenExists(token) {\n\n // parameter token doesn't exist\n if (!this._parameterExists(token)) {\n return false;\n }\n\n try {\n ...
[ "0.73963195", "0.7392369", "0.7252812", "0.7143361", "0.7138902", "0.7122372", "0.70927495", "0.69598126", "0.6918411", "0.68934494", "0.6880925", "0.6876565", "0.6874079", "0.68473953", "0.682739", "0.68228984", "0.681296", "0.67166597", "0.66530883", "0.66446143", "0.664118...
0.0
-1
CHECK FOR ADMIN PREMISSION
async function requireAdmin(req, res, next) { const authHeader = req.headers.authorization; if (authHeader) { const token = authHeader && authHeader.split(' ')[1]; // verify the access token jwt.verify(token, process.env.ACCESS_TOKEN_SECRET, (err, tokenUser) => { if (err) { // verify return an error res.status(401).send({ error: '401 Token is unauthorized' }) } else { const user = tokenUser.user if (user.permission === 'Admin') { next() } else { res.status(403).send({ error: '403 Forbidden' }) } } }) } else { // if no auth header exist res.status(401).send({ error: '401 token does not exist' }) } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "check_admin_status() {}", "function checkAdmin() {\r\n\tvar uPlayers = players.filter(player => !player.isAi);\r\n\tif (uPlayers.length == 0) {\r\n\t\treturn;\r\n\t}\r\n\tvar adminNums = (uPlayers.filter(p => p.isAdmin)).length;\r\n\tif (adminNums == 0) {\r\n\t\tvar p = uPlayers.random();\r\n\t\tif (!p) {\r\n\t\...
[ "0.7530378", "0.6909182", "0.6906115", "0.68320024", "0.6726892", "0.6674226", "0.664227", "0.6605962", "0.656109", "0.6540531", "0.6479276", "0.6479276", "0.6470969", "0.6468379", "0.6468379", "0.64110076", "0.6372502", "0.63431865", "0.63078314", "0.6302338", "0.6295138", ...
0.58443725
71
const apiHost = " const localHost = "
function saveConfig() { const config = { name: configNameRef.current.value, config: clientsConfig, exp_ratios: expRatios }; const isUpdate = currentConfigs.includes(config.name); fetch(apiHost + "/config", { method: isUpdate ? "PUT" : "POST", headers: {"Content-Type": "application/json"}, body: JSON.stringify(config) }) .then(response => { response.json(); }) .then(data => { setSaveStatusMessage(saveSucceedMessage); if (!isUpdate) updateConfigsList([...currentConfigs, config.name]); setShowConfigNamePop(false); setIsFetchSucceed(true); setShowSaveStatus(true); }) .catch(error => { setSaveStatusMessage(saveFailedMessage + error.toString()); setShowConfigNamePop(false); setIsFetchSucceed(true); setShowSaveStatus(true); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "static get API_URL() {\r\n const port = 1337; // Change this to your server port\r\n return `http://localhost:${port}/`;\r\n }", "static get API_URL() {\n const port = 1337; // Change this to your server port\n return `http://localhost:${port}`;\n }", "static get API_URL(){\n\...
[ "0.70827246", "0.69639647", "0.69188774", "0.6732275", "0.6579074", "0.64843184", "0.6409034", "0.64050144", "0.6278818", "0.6248854", "0.6216455", "0.6172931", "0.6082024", "0.6038293", "0.6026491", "0.5973471", "0.5959918", "0.5953296", "0.5943794", "0.5877593", "0.58746386...
0.0
-1
there are two constructors, one with no arguments passed in and one with 5
constructor(inputSize, hiddenSizes, outputSize, learnRate = null, momentum = null) { // error check if (!Number.isInteger(inputSize)) { throw new Error("inputSize is not an integer"); } if (!Array.isArray(hiddenSizes)) { throw new Error("hiddenSizes is not an array"); } if (!Number.isInteger(outputSize)) { throw new Error("outputSize is not an integer"); } if (learnRate !== null && typeof learnRate !== 'number') { throw new Error("learnRate is not null and not a number"); } if (learnRate !== null && typeof momentum !== 'number') { throw new Error("learnRate is not null and not a number"); } // constructor for 0 arguments if (arguments.length === 0) { this.learnRate = 0; this.momentum = 0; this.inputLayer = []; // list of Neurons this.hiddenLayers = [ [/* Neuron */ ] ]; // list of lists of Neurons this.outputLayer = []; // list of Neurons } // construtor with 5 arguments else { this.learnRate = learnRate === null ? 0.4 : learnRate; this.momentum = momentum === null ? 0.9 : momentum; this.inputLayer = []; // list of Neurons this.hiddenLayers = [ [/* Neuron */ ] ]; // list of lists of Neurons this.outputLayer = []; // list of Neurons for (var i = 0; i < inputSize; i++) { this.inputLayer.push(new Neuron()); } var firstHiddenLayer = []; for (var i = 0; i < hiddenSizes[0]; i++) { firstHiddenLayer.push(new Neuron(this.inputLayer)); } this.hiddenLayers.push(firstHiddenLayer); for (var i = 1; i < hiddenSizes.length; i++) { var hiddenLayer = []; // list of Neurons for (var j = 0; j < hiddenSizes[i]; j++) { hiddenLayer.push(new Neuron(this.hiddenLayers[i - 1])); } this.hiddenLayers.push(hiddenLayer); } for (var i = 0; i < outputSize; i++) { // TODO: can we assume hiddenLayers will always have at least one element in the array? var lastIndex = this.hiddenLayers.length - 1; this.outputLayer.push(new Neuron(this.hiddenLayers[lastIndex])); } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "constructor(a5) {\n super();\n this.a5 = a5;\n }", "constructur() {}", "constructor(name = 'anonymous', age = 0) { // if there's no name - argmuent = 'anonymous'\n this.name = name; // 'this' referes to the class instance\n this.age = age;\n}", "constructor(a, b, c) {\n super(a, ...
[ "0.74182355", "0.66868705", "0.65915525", "0.6439747", "0.64272", "0.6333308", "0.62916386", "0.62830824", "0.6239701", "0.62320256", "0.6200246", "0.62000483", "0.62000483", "0.62000483", "0.617957", "0.6170672", "0.6170672", "0.6170672", "0.6170672", "0.6170672", "0.6170672...
0.0
-1
========================= TronWeb hook =========================
function useTronWeb() { const [tronWeb, setTronWeb] = useState(); useEffect(() => { let interval; if (!tronWeb) { interval = setInterval(() => { if (window.tronWeb && window.tronWeb.defaultAddress.base58) { setTronWeb(window.tronWeb); } }, 3000); } return () => { clearInterval(interval); }; }, [tronWeb]); return tronWeb; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function setWebhook() {\r\n //Taken from \"Current Web App Url\" under Publish... Deploy as Web App...\r\n messagePayload.url =\r\n \"\";\r\n var method = \"setWebhook\";\r\n var response = sendPayload(method, messagePayload);\r\n console.log(JSON.stringify(response.getContentText()));\r\n}", "function s...
[ "0.7290124", "0.6946998", "0.6292571", "0.62161833", "0.61875826", "0.60359997", "0.6035439", "0.5917235", "0.5915734", "0.5834752", "0.58183557", "0.5812142", "0.5785325", "0.5777993", "0.5769481", "0.5767918", "0.57641464", "0.57442653", "0.5742906", "0.57218105", "0.571191...
0.54748505
33
This method should be used when the Chnky API allows CORS
async function getChnkyStatus() { let options = { method: "GET", headers: {authorization: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyIjp7InVzZXJuYW1lIjoiYW5kc3ZlQGdtYWlsLmNvbSIsImNvbXBhbnkiOiJwcml2YXRlIiwiY29tcGFueUlkIjoiNDhhZTM0ZDZiMzgwYzVlYyIsImZpcnN0bmFtZSI6IkFuZGVycyIsImxhc3RuYW1lIjoiU3ZlbnNzb24iLCJzY29wZXMiOlsiY2hhbm5lbHMiLCJjb25maWciXX0sImlhdCI6MTYyMDI0MDQ2NCwiZXhwIjoxNjIwODQ1MjY0fQ.u5yRr65BvgLzOu6HGaR9EVXVJoIrs4SpBYXDMzBrNDA"} } return fetch("https://w7bt024bm8.execute-api.eu-central-1.amazonaws.com/prod/getconfigandstatus", options); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "_enableCORS() {\n if (this.server !== null) {\n this.server.use((req, res, next) => {\n res.header('Access-Control-Allow-Origin', this.dev ? '*' : this.url);\n res.header('Access-Control-Allow-Headers', 'Origin, X-Requested-With, Content-Type, Accept');\n next();\n });\n }\n }...
[ "0.73217", "0.7320236", "0.7277136", "0.71621406", "0.7106447", "0.7064571", "0.69894546", "0.69141513", "0.68312126", "0.6794579", "0.67576635", "0.67512584", "0.67464805", "0.671987", "0.67116964", "0.66884065", "0.6659474", "0.65780914", "0.65043736", "0.6448814", "0.64433...
0.0
-1
Process the image by applying the kernel.
function ApplyKernel(img, kern) { let height = img.height; let width = img.width // Create and allocate a new array to hold the new image. let new_image = new Uint8ClampedArray(4 * height * width); new_image.fill(255); // Iterate through each of the channels: R,G,B for(var channel = 0; channel < 3; channel++) { // Iterate through each of the pixels in the image. for (var X = 0; X < width; X++) { for(var Y = 0; Y < height; Y++) { let filtered_value = 0; for (var y = 0; y < kern.length; y++) { for (var x = 0; x < kern[0].length; x++) { // collect the necessary kernel values. let kern_y_shift = ~~(kern.length / 2) - y; let kern_x_shift = ~~(kern[0].length / 2) - x; // Map to the appropriate point let point = mapPoint(X + kern_x_shift,Y + kern_y_shift, height, width, channel); // Apply kernel and add to filtered value. filtered_value += img.data[point]*kern[y][x]; } } // Update the new image at the appropriate pixel. new_image[mapPoint(X,Y,height,width,channel)] = filtered_value; } } } return new ImageData(new_image, img.width, img.height); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "run(imageData, imgWidth, imgHeight) {\n let kernel = this.kernels[this.kernelOperator].kernel;\n let sum = this.kernels[this.kernelOperator].sum;\n return this.convolve(imageData, imgWidth, imgHeight, kernel, 1/sum);\n }", "apply() {\n // Get the source image and create the result ...
[ "0.66036105", "0.62568533", "0.6216518", "0.61938566", "0.58362776", "0.5509829", "0.54928154", "0.54900795", "0.5464914", "0.54426533", "0.5434077", "0.53780484", "0.52914435", "0.5285847", "0.52688164", "0.5246969", "0.52456605", "0.52403015", "0.5228871", "0.5190686", "0.5...
0.7529932
0
this sets up the pieces of the system. comment here to swap implementations for profiling.
initComponents() { // precomputed const components = this._withPrecomputeRenderer(this.reactClass, this.el, this.log, MemoizingSnapshotOptimizer); // isolated // const partially = this._withIsolatedComponents.bind(this, this.reactClass, this.el, this.log); // const components = partially(NoopOptimizer, NaiveReactRenderer); // const components = partially(MemoizingSnapshotOptimizer, NaiveReactRenderer); // const components = partially(NoopOptimizer, RafReactRenderer); // const components = partially(MemoizingOptimizer, RafReactRenderer); // const components = partially(MemoizingSnapshotOptimizer, RafReactRenderer); console.info('initComponents:', components); this.renderer = components.renderer; this.optimizer = components.optimizer; this.loggit = components.loggit; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function _setup () {\n }", "setup() {\n\t\tthis.bpm = Persist.exists('bpm') ? Persist.get('bpm') : 100;\n\t\tthis.startTime = Persist.exists('startTime') ? Persist.get('startTime') : Date.now();\n\t\tthis.tempos = {\n\t\t\tmaster: 'four',\n\t\t\t...TEMPO_CONFIG\n\t\t}\n\t\tObject.keys(this.tempos).filter...
[ "0.7058507", "0.6586679", "0.6586027", "0.65589356", "0.6535429", "0.6360242", "0.6341116", "0.6326285", "0.63025796", "0.6272453", "0.61568785", "0.6149664", "0.61283416", "0.6123608", "0.6119765", "0.6098107", "0.609806", "0.6096445", "0.6096445", "0.6096445", "0.6077087", ...
0.0
-1
inits with the optimizer and renderer isolated from each other. they aren't coupled, but can't cooperate to be more efficient.
_withIsolatedComponents(reactClass, el, log, optimizerClass, rendererClass) { const optimizer = new optimizerClass(log); const loggit = { recordFact: log.recordFact.bind(log), computeFor: this._isolatedComputeForWrapper.bind(this), experimental: { forceCompaction: this._experimentalCompaction.bind(this) } }; const renderer = new rendererClass(reactClass, el, loggit); return {optimizer, renderer, loggit}; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function init() {\n\n rendererStats.domElement.style.position = 'absolute';\n rendererStats.domElement.style.left = '0px';\n rendererStats.domElement.style.bottom = '0px';\n document.body.appendChild(rendererStats.domElement);\n\n graphYPoint = 0;\n buildScene();\n initGraph();\n updateGraph();\n setInter...
[ "0.6582247", "0.6561393", "0.6546518", "0.6509728", "0.64929855", "0.64613974", "0.64560664", "0.63968176", "0.6356363", "0.6356363", "0.6340032", "0.6335139", "0.63340956", "0.6326568", "0.62859696", "0.6265392", "0.62647694", "0.62446904", "0.6240103", "0.62365305", "0.6227...
0.0
-1
This pulls out the computations from the component and computes them with the optimizer.
_isolatedComputeForWrapper(component) { const computations = ReactInterpreter.computations(component); return this.optimizer.compute(computations); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "_precomputeComputeForWrapper(component) {\n const computations = ReactInterpreter.computations(component);\n const computedValues = this.optimizer.compute(computations);\n this.renderer.notifyAboutCompute(component, computations, computedValues);\n return computedValues;\n }", "compute()\n {\n ...
[ "0.7077152", "0.62705755", "0.62705755", "0.6016874", "0.59885037", "0.5929261", "0.59225583", "0.5918945", "0.58713543", "0.5763892", "0.5751716", "0.5737336", "0.57049686", "0.5602473", "0.5596236", "0.5586118", "0.55707955", "0.55706054", "0.54861856", "0.54546505", "0.545...
0.68461645
1
This requires cooperation between the optimizer and the renderer, so we create a loggit API that allows that. It also breaks the loggit.compute method to take a component instead of just a description of computation.
_withPrecomputeRenderer(reactClass, el, log, optimizerClass) { const optimizer = new optimizerClass(log); const loggit = { recordFact: log.recordFact.bind(log), computeFor: this._precomputeComputeForWrapper.bind(this), experimental: { forceCompaction: this._experimentalCompaction.bind(this) } }; const renderer = new PrecomputeReactRenderer(reactClass, el, loggit, { optimizer }); return {optimizer, renderer, loggit}; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "_precomputeComputeForWrapper(component) {\n const computations = ReactInterpreter.computations(component);\n const computedValues = this.optimizer.compute(computations);\n this.renderer.notifyAboutCompute(component, computations, computedValues);\n return computedValues;\n }", "_isolatedComputeForWr...
[ "0.6324974", "0.60579836", "0.574137", "0.5167757", "0.5159222", "0.5096611", "0.49962747", "0.49663883", "0.491505", "0.49148515", "0.49041876", "0.48896286", "0.48692617", "0.47789705", "0.47723264", "0.47723264", "0.4755875", "0.47449255", "0.47398564", "0.4701247", "0.465...
0.6140315
1
the precompute renderer setup funnels calls to loggit.computeFor through here in order to collect information about the read path, so the renderer can use that optimizing rendering updates.
_precomputeComputeForWrapper(component) { const computations = ReactInterpreter.computations(component); const computedValues = this.optimizer.compute(computations); this.renderer.notifyAboutCompute(component, computations, computedValues); return computedValues; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "_withPrecomputeRenderer(reactClass, el, log, optimizerClass) {\n const optimizer = new optimizerClass(log);\n const loggit = {\n recordFact: log.recordFact.bind(log),\n computeFor: this._precomputeComputeForWrapper.bind(this),\n experimental: {\n forceCompaction: this._experimentalCompa...
[ "0.5646902", "0.5259037", "0.521407", "0.51359683", "0.5055533", "0.4999856", "0.49281177", "0.49244145", "0.4855518", "0.48314178", "0.4809135", "0.47968298", "0.47939128", "0.478033", "0.47589025", "0.47389194", "0.47273508", "0.47269338", "0.47269338", "0.47148374", "0.471...
0.4847841
9
This inform the renderer that something has occurred. It can decide whether to respond synchronously, or to batch, etc.
_notifyRenderer() { this.renderer.notify(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "rendererReady() {\n const message = new Message(Message.rendererReadyTitle, 'void').toString();\n this.ipc.send('update-message', message);\n }", "IsFinishedRendering() {}", "function onRender() {\n\t\tvar args;\n\t\tvar i;\n\t\t__debug_429( 'Received a render event. Re-emitting...' );\n\t\targs = new A...
[ "0.60688233", "0.59487796", "0.57427925", "0.57325476", "0.57306087", "0.57235336", "0.5721346", "0.5706901", "0.56946576", "0.56925815", "0.5691034", "0.5683223", "0.56808984", "0.56759024", "0.56724757", "0.5670946", "0.56447506", "0.5576912", "0.55661", "0.55142295", "0.55...
0.61903167
0
Just hacking to see the effects here
_experimentalCompaction() { const compactor = new Compactor(); const previousSize = this.log.facts.length; this.log.facts = compactor.compacted(this.log.facts, compactionFn); const compactionSize = previousSize - this.log.facts.length; const percentText = Math.round(100 * (compactionSize / previousSize)) + '%'; console.log('compaction freed: ', compactionSize, percentText); this._notifyRenderer(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private internal function m248() {}", "private public function m246() {}", "transient final protected internal function m174() {}", "protected internal function m252() {}", "transient private protected internal function m182() {}", "transient protected internal function m189() {}", "transient final pri...
[ "0.6710844", "0.64350253", "0.61923105", "0.61565447", "0.6088692", "0.60500324", "0.59815145", "0.5943818", "0.5857094", "0.57863593", "0.5761853", "0.56960225", "0.5661199", "0.5651277", "0.5625563", "0.5624853", "0.5588234", "0.5565406", "0.55382115", "0.55167955", "0.5508...
0.0
-1
Check if the current user has authorized the application.
function login(immediate) { return new Promise(function(resolve, reject) { ga('send', 'event', 'login', 'start'); gapi.auth.authorize({ client_id: CLIENT_ID, scope: SCOPES, immediate: immediate }, function(authResult) { if (authResult.access_token) { // Access token has been successfully retrieved, requests can be sent to the API loadClient(function() { loadAbout(); auth.isLoggedIn(true); ga('send', 'event', 'login', 'completed'); resolve(authResult); }); } else { ga('send', 'event', 'login', 'failed'); reject(); } }); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function isAuthValid() {\n return getOAuthService().hasAccess();\n}", "function isAuthorized () {\n return !!localStorage.getItem('token');\n}", "isAuthorized() {\n return this.authProvider.isAuthorized();\n }", "function isAuthenticated() {\n return !!getUserInfo();\n }", "isAuthor...
[ "0.70533764", "0.70237464", "0.70101905", "0.6928913", "0.6926521", "0.69233626", "0.68976474", "0.6887263", "0.6855571", "0.6750192", "0.67064893", "0.6680443", "0.6663273", "0.66615146", "0.6652433", "0.6646137", "0.6625117", "0.66059905", "0.6593911", "0.6590299", "0.65847...
0.0
-1
TODO this should be done in a component
function listRooms(connection) { connection.socket.emit('server/listRooms', { rooms: roomRepository.getAll(), joined: userRoomRepository.getRooms(connection.socket.decoded_token.id) }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private public function m246() {}", "private internal function m248() {}", "protected internal function m252() {}", "transient private protected internal function m182() {}", "obtain(){}", "static rendered () {}", "static rendered () {}", "transient private internal function m185() {}", "transient ...
[ "0.62322974", "0.60887873", "0.59596056", "0.57364696", "0.569748", "0.5593987", "0.5593987", "0.5580353", "0.5572841", "0.5560544", "0.55249476", "0.5336263", "0.5318393", "0.52832675", "0.52085364", "0.51920575", "0.5175638", "0.51536393", "0.51453173", "0.51453173", "0.514...
0.0
-1
Ottiene l' inserimento automatico dell' indirizzo
function getDataFromNominatim(lat, lon){ var request = "https://nominatim.openstreetmap.org/reverse?lat=" + lat + "&lon=" + lon + "&format=jsonv2&accept-language=it&zoom=10&namedetails=1"; $.getJSON( request, function( data ) { // Inserisce istruzioni sull' indirizzo a seconda della regione switch (data.address.state){ case "Trentino-Alto Adige" : $("#stradaMex").html("🌐 Se il tuo comune è multilingua, <b>inserisci il nome della strada in tutte le lingue parlate</b>, partendo da quella più utilizzata a quella meno utilizzata in questo formato <b>\"Nome1 - Nome2 - Nome 3\"</b> (es. Maiastraße - Via Maia)"); $('#comuneMex').html("🌐 Anche qui, come prima, <b>inserisci il nome in tutte lingue parlate</b> nel formato <b>\"Nome1 - Nome2 - Nome 3\"</b> (es. Urtijëi - St. Ulrich - Ortisei).<br>"); break; case "Sardegna" : $("#comuneMex").html("🌐 <b>Inserisci il nome della città sia nella lingua italiana che in quella locale</b> in questo modo <b>\"Nome locale/Nome italiano\"</b> (es. Nùgoro/Nuoro).<br>"); break; default : $("#comuneMex").html(""); } // Inserisce città e CAP da Nominatim if(data.address.city != "") $('#comune').val(data.namedetails.name); if(typeof data.address.postcode != "undefined"){ $('#cap').val(data.address.postcode); } else { $('#cap').val(""); // Inserisce avviso "Manca l' indirizzo postale" $("#capMex").html('<div class="alert alert-warning small" role="alert"> ✉️ A quanto pare non abbiamo il CAP di questa città sul nostro database. 😓 Ci farebbe molto piacere che tu lo inserissi, così potremo inserirlo in questa città! </div>'); nopostcode = true; } }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function insertTempObra(x) {\n //code Insertando avances fisicos\n \n if (AOTI && x >= AOTI.length) {\n //code\n console.log(\"Todas las inserciones terminadas:::::::::::::::::::::::::::::::::\");\n location.href=\"mapa_pro...
[ "0.59017766", "0.58748525", "0.5797978", "0.5788312", "0.5703699", "0.5675161", "0.5654472", "0.56488484", "0.5625668", "0.55530673", "0.5485996", "0.5463666", "0.5460886", "0.54565525", "0.545012", "0.5447898", "0.5440037", "0.54395616", "0.54393864", "0.54381055", "0.542957...
0.0
-1
Recupera le coordinate dal device
function getLocation() { if (navigator.geolocation) { posID = navigator.geolocation.watchPosition(getDataFromGPS,showError,{enableHighAccuracy:true,timeout:240000}); $("#geo-information").html('<div class="alert alert-info text-center" role="alert">🕵️‍ Ti stiamo localizzando... <div class="spinner-border spinner-border-sm float-right" role="status"></div></div>'); $("#pos-button").addClass("disabled"); $("#pos-img").addClass("animated flash slower infinite"); } else{$("#geo-information").html('<div class="alert alert-danger" role="alert">😔 Il tuo browser non supporta la geolocalizzazione.</div>');} }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function readLocator () {\r\n orb.readLocator(function (err, data) {\r\n if (err) {\r\n console.error(\"error: \", err);\r\n readLocator();\r\n } else {\r\n console.log(data.xpos);\r\n console.log(data.ypos);\r\n var dist = Math.sqrt(Math.pow(...
[ "0.6354585", "0.6196554", "0.6167624", "0.6096384", "0.60442466", "0.6036752", "0.60238725", "0.6018993", "0.60157555", "0.60105705", "0.5994445", "0.5984678", "0.59766203", "0.5963909", "0.59527075", "0.59506786", "0.5948998", "0.59425944", "0.5923023", "0.5913226", "0.59132...
0.0
-1
Mostra i messaggi di errore
function showError(error) { var text; var animation; (error.code > 1) ? animation = "animated shake" : animation = " "; switch (error.code){ case 1 : text = '🥺 Non hai consentito l\' accesso alla posizione. Se hai dubbi sulla privacy, consulta le <a href="#come-funziona">informazioni</a> in fondo. ⬇️'; break; case 2 : text = "📡 Qualcosa non ha funzionato... Riprova più tardi. <b>Controlla di avere il GPS attivo</b>."; break; case 3 : text = "💤 L' accesso alla posizione sta impiegando più tempo del previsto."; break; default : text = "😨 Errore nella localizzazione."; } $("#geo-information").html('<div class="alert alert-danger ' + animation + '" role="alert">'+ text +'</div>'); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function error(){\n return \"Invaild e-mail or password!\";\n }", "function wikiError(){\r\n self.errorMessage(\"Error in accessing wikipedia\");\r\n self.apiError(true);\r\n}", "function error(err) {\n var problem;\n if (err.code == 1) {\n // user said no!\n problem = \"You won't share you...
[ "0.7069618", "0.6911373", "0.68807715", "0.68802065", "0.68433625", "0.6835731", "0.6835731", "0.68277687", "0.6791468", "0.6774377", "0.676338", "0.67539954", "0.6753904", "0.66912055", "0.6688877", "0.6687436", "0.6685829", "0.66723585", "0.6666222", "0.665087", "0.6624741"...
0.0
-1
Ottiene i dati dal GPS
function getDataFromGPS(position){ $("#geo-information").html('<div class="alert alert-info text-center" role="alert">⌛‍ Aggiornamento... <div class="spinner-grow spinner-grow-sm float-right" role="status"></div></div>'); truelat = position.coords.latitude; truelon = position.coords.longitude; updateData(truelat, truelon, position.coords.accuracy); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function geoloc() {\n let coords = navigator.geolocation.getCurrentPosition((pos) => {\n coords = pos;\n let lat = coords.coords.latitude;\n let long = coords.coords.longitude;\n ll = `?_ll=${lat},${long}`;\n document.querySelector(\".change-hour h1 span\").textContent = \"ma position\";\n getDa...
[ "0.6806493", "0.6790628", "0.674347", "0.6673686", "0.6665772", "0.66496015", "0.6642753", "0.6626201", "0.66116124", "0.65597874", "0.6546017", "0.65106773", "0.6471653", "0.6456484", "0.633452", "0.62265366", "0.6222223", "0.62213564", "0.6143627", "0.61407936", "0.61323166...
0.69579315
0
Aggiorna i dati e li visualizza
function updateData(new_lat, new_lon, new_acc){ lat = new_lat; lon = new_lon; acc = new_acc; showPosition(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function visData(){\r\n\tvar days=new Array(\"Domenica\",\"Luned&igrave;\",\"Marted&igrave;\",\"Mercoled&igrave;\",\"Gioved&igrave;\",\"Venerd&igrave;\",\"Sabato\");\r\n\tvar months=new Array(\"Gennaio\",\"Febbraio\",\"Marzo\",\"Aprile\",\"Maggio\",\"Giugno\",\"Luglio\",\"Agosto\",\"Settembre\",\"Ottobre\",\"Novem...
[ "0.6565566", "0.6420185", "0.64197695", "0.6297304", "0.6249038", "0.6203214", "0.6193866", "0.6167253", "0.612157", "0.6082429", "0.6048621", "0.6032095", "0.6032095", "0.60300046", "0.60185736", "0.6002581", "0.59912413", "0.5957233", "0.5941396", "0.59350324", "0.5928402",...
0.0
-1
Function che aggiunge un marker alla mappa
function addMarker(){ if (typeof marker != "undefined") { map.removeLayer(marker); map.setView([lat, lon]); } else { map.setView([lat, lon], 18); } marker = new L.Marker([lat, lon]); if (typeof acc != 'undefined'){ marker.bindPopup('Sei a circa '+ Math.round(acc) + 'm da qui'); } else { marker.bindPopup('Selezionato da te sulla mappa'); } map.addLayer(marker); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function setMarkers(map, puntos) {\r\n var base_url = document.getElementById('base_url').value;\r\n var contenido = '';\r\n var link2 = base_url+\"pedido/pedidoabierto/\";\r\n //limpiamos el contenido del globo de informacion \r\n var infowindow = new google.maps.InfoWindow({ \r\n content: '' \r...
[ "0.61183894", "0.6011136", "0.5977838", "0.59303313", "0.5909647", "0.5905878", "0.5905836", "0.5905619", "0.58951664", "0.5865559", "0.5826416", "0.582299", "0.58166134", "0.58120215", "0.579747", "0.57729065", "0.5765313", "0.57386875", "0.5735123", "0.57301337", "0.5730073...
0.0
-1
Aggiunge marker al click e ferma la localizzazione
function addMarkerClick(e){ maxDist = 0.8 / 110.574; distGPStoSelection = Math.sqrt(Math.pow(e.latlng.lat - truelat, 2) + Math.pow(e.latlng.lng - truelon, 2)); // Controlla se la distanza non è eccessiva if(distGPStoSelection <= maxDist && stato == 1){ updateData(e.latlng.lat, e.latlng.lng); stopLocation(); $("#geo-information").html('<div class="alert alert-dark text-center" role="alert">📌 Modalità selezione manuale, la geolocalizzazione è in pausa. 🛑 </div>'); } else if (distGPStoSelection <= maxDist){ $("#geo-information").html('<div class="alert alert-info text-center" role="alert">✋ Attendi che l\' accuratezza migliori prima di selezionare la posizione dalla mappa manualmente.<div class="spinner-grow spinner-grow-sm float-right" role="status"></div></div>'); } else if (stato == 1) { $("#geo-information").html('<div class="alert alert-danger text-center" role="alert">✋ Non puoi selezionare un punto così distante dalla tua posizione attuale.'); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function clickMarker(e) {\n deselectCurrentMarker();\n var markerComponent = mly.getComponent('marker');\n var marker = e.target || e;\n marker.options.tags = marker.options.tags || {};\n selectedMarker = marker;\n marker.setIcon(redIcon);\n markerId = marker.id;\n currentMarkerId = markerId;\n markerComp...
[ "0.73829496", "0.7328061", "0.7317792", "0.7284404", "0.72814536", "0.7237583", "0.72132736", "0.7191674", "0.7135163", "0.7121554", "0.70174956", "0.7004344", "0.6958005", "0.69403994", "0.6860577", "0.6844564", "0.68438077", "0.6829785", "0.68135905", "0.67789155", "0.67584...
0.76976025
0
Get move from command line input.
function makeMove(game, mark) { var gridPos, result; while (true) { gridPos = readlineSync.question('-> '); result = tictactoe.move(game, gridPos, mark); if (result[0]) { break; } console.log(result[1]); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getPlayerMove(move) {\n return move || getInput();\n}", "function getPlayerMove(move) {\n\n /* If user imputs a move, the expression will evaluate to that value.\n * If move is unspecified: prompt will pop up & player will need to input a move.\n */ \n if (move) { \n return mov...
[ "0.65655166", "0.63762635", "0.6249636", "0.614866", "0.6060796", "0.58666474", "0.5756806", "0.5739059", "0.57355523", "0.5726201", "0.5650458", "0.564787", "0.564787", "0.564787", "0.5625402", "0.5616404", "0.5594345", "0.55832237", "0.5559225", "0.5551102", "0.54944026", ...
0.48419967
63
Print out overall winner at the end of the game.
function end(scoreboard) { console.log('\n\nThank you for playing!'); var overallWinner = sb.overallWinner(scoreboard); if (overallWinner === 1) { console.log('OVERALL WINNER: PLAYER 1!'); } else if (overallWinner === 2) { console.log('OVERALL WINNER: PLAYER 2!'); } else { console.log('EVERYONE IS A WINNER! :) (Both players tied!)'); } console.log(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function printWinner() {\n alert(game.players[counter].symbol + ' is winner!');\n if (counter === 0) {\n playerX++;\n // console.log(\"X: \" + playerX);\n // console.log(\"O: \" + playerO);\n updateScoreboard();\n }\n else {\n playerO++;\n console.log(\"X: \" + p...
[ "0.7149092", "0.7106511", "0.7092185", "0.70389193", "0.6916296", "0.69056684", "0.68850833", "0.68352085", "0.68282175", "0.6801737", "0.6801605", "0.67970115", "0.6767846", "0.67537427", "0.67274827", "0.671206", "0.6682884", "0.6668329", "0.6667063", "0.6663261", "0.666242...
0.68358755
7
Returns a function, that, as long as it continues to be invoked, will not be triggered. The function will be called after it stops being called for N milliseconds. If `immediate` is passed, trigger the function on the leading edge, instead of the trailing.
function debounce(func, wait, immediate) { var timeout; return function() { var context = this, args = arguments; clearTimeout(timeout); timeout = setTimeout(function() { timeout = null; if (!immediate) func.apply(context, args); }, wait); if (immediate && !timeout) func.apply(context, args); }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function debounce(func, wait, immediate) {\n var timeout;\n return function () {\n var args = arguments,\n callNow = immediate && !timeout,\n later = function () {\n timeout = null;\n if (!immediate) {\n ...
[ "0.60051495", "0.6000779", "0.5987283", "0.596296", "0.59300244", "0.59300244", "0.5926081", "0.59206975", "0.5912837", "0.59122884", "0.59010476", "0.5890147", "0.5888855", "0.5887671", "0.5880398", "0.58780855", "0.58764", "0.58764", "0.58764", "0.58764", "0.5875902", "0....
0.5815724
86
Funcion insertar o actualizar un rol
function guardarRol(e) { e.preventDefault(); const idRol = document.querySelector("#idRol").value; const idUsuario = document.querySelector("#idUsuario").value; //Gaurda los datos dentro de un objeto const data = new FormData(formRolesUsuario); //Si viene vacio informamos problema y corta la ejecucion if (idRol == 0 && idUsuario == 0) { alert("Debe llenar los campos"); return; } //Si la opcion es insertar rol const xhr = new XMLHttpRequest(); xhr.open("POST", formRolesUsuario.getAttribute("action")); xhr.onload = function () { if (xhr.status === 200) { const respuesta = JSON.parse(xhr.responseText); if (respuesta.message == "exito insert") { location.reload(); } else if (respuesta.message == "exito update") { location.href = "AsignarRoles.php"; } else { alert("Hubo un error, intente nuevamente"); } } } xhr.send(data); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "addRollable(){\n if (this.activity?.type === \"NO_ROLL\") return;\n // Copy our template roll\n let newRoll = this.element.find('#rollableEventsTable > li[data-id =\"template\"]').clone();\n // Assign temporary id\n newRoll.attr(\"data-id\", randomID());\n // Show it!\n newRoll.css(\"display\"...
[ "0.60175365", "0.5824135", "0.56017894", "0.55713767", "0.5556328", "0.54143363", "0.53471375", "0.5281694", "0.52603954", "0.5255433", "0.52329427", "0.5230445", "0.52260613", "0.51795805", "0.51621777", "0.5129664", "0.5116059", "0.5116059", "0.5105641", "0.5105495", "0.509...
0.5114501
18
Funcion eliminar un rol
function eliminarRol(e) { for (let i = 0; i < arrayBtnEliminar.length; i++) { if (e.target === arrayBtnEliminar[i]) { const idRolUsu = arrayBtnEliminar[i].getAttribute("data-id"); const xhr = new XMLHttpRequest(); xhr.open("GET",formRolesUsuario.getAttribute("action")+"?idRolUsu="+idRolUsu+"&opcion=3"); xhr.onload = function(){ if(xhr.status === 200){ const respuesta = JSON.parse(xhr.responseText); if(respuesta.message === "exito delete"){ arrayBtnEliminar[i].parentElement.parentElement.remove(); //Elimina el registro de la tabla } } } xhr.send(); } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "moverIzquierda(){\n this.salaActual.jugador = false;\n this.salaActual = this.salaActual.izquierda;\n this.salaActual.entradaAnteriorSala = posicionSala.izquierda;\n this.salaActual.jugador = true;\n }", "undo(){\n try{\n if(this.movesMade.length == 0){\n throw \"Not...
[ "0.5795893", "0.56121796", "0.55855775", "0.55109775", "0.5499252", "0.5444947", "0.54350597", "0.5434209", "0.53689134", "0.53646207", "0.5353047", "0.5316604", "0.5282215", "0.52602535", "0.52275074", "0.52217144", "0.5213951", "0.5212589", "0.521098", "0.52042025", "0.5201...
0.0
-1
Convenience function to access the collection
function collection() { //Make sure the collection exists var result = scope.$eval(collectionName); if (!result) { scope.$eval(collectionName + '=[]'); result = scope.$eval(collectionName); } return result; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "get collection() {\n return this._collection;\n }", "function getCollection(collection){\n var data = bd.collection(collection);\n return data;\n }", "getElement() {\n errors.throwNotImplemented(\"getting an element from a collection\");\n }", "get collection () {\n return thi...
[ "0.73230886", "0.7235103", "0.70831555", "0.7030318", "0.68284154", "0.68284154", "0.68284154", "0.6807725", "0.67215514", "0.67215514", "0.67215514", "0.6692228", "0.66732854", "0.66636306", "0.6657615", "0.66488236", "0.6588857", "0.6556494", "0.646989", "0.64356595", "0.64...
0.6996674
4
Common Entities / Things to remove: &9744; > Empty checkbox &9746; > Filled checkbox &8226; > Unordered List bullet o > Unorder List Subbullet
function paragraph(string) { // Removes ALL HTML: // var str = string.replace(/\(Insert.*\)/, "").replace(/<{1}[^<>]{1,}>{1}/g," "); // Removes (Insert ...) statements var str = string.replace(/\(Insert.*\)/, ""); // Removes certain tags and replaces them with flags for later use // var tags = ["em", "strong"]; // for (var i = 0; i < tags.length; i++) { // var tag = tags[i]; // var regexp = new RegExp(`<${tag}>.\s<\\/${tag}>|<${tag}>[\S]{0,1}<\\/${tag}>`, 'gi'); // str.replace(regexp, `||${tag}||`); // } var options = { allowedTags: [ 'p', 'em', 'strong', 'sup' ], allowedAttributes: { 'sup': ["type"], }, allowedClasses: {}, exclusiveFilter: function(frame) { // return frame.tag === 'a' && !frame.text.trim(); return !frame.text.trim(); } } var clean = sanitizeHtml(str, options); return clean; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function edt_cleanDeprecated()\n {\n var oEditor=eval(\"idContent\"+this.oName);\n\n var elements;\n \n elements=oEditor.document.body.getElementsByTagName(\"STRIKE\");\n this.cleanTags(elements,\"line-through\");\n elements=oEditor.document.body.getElementsByTagName(\"S\");\n this.cleanTags(elements,\"l...
[ "0.61588097", "0.5586432", "0.55750984", "0.5563916", "0.5509279", "0.5482018", "0.5471444", "0.5471204", "0.5424866", "0.5424381", "0.5409417", "0.5387769", "0.5387577", "0.53813905", "0.53779393", "0.53357595", "0.5314437", "0.5313562", "0.5280206", "0.5274116", "0.52557397...
0.0
-1
get one thought by id
getThoughtbyId({ params }, res) { Thoughts.findOne({ _id: params.id }) .then(dbThoughtsData => { if(!dbThoughtsData) { res.status(400).json({message: 'Oh my...no thought found'}); return; } res.json(dbThoughtsData); }) .catch(err => { console.log(err); res.status(400).json(err); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function findById(id) {\n return db('stories')\n .where({ id: Number(id) })\n .first();\n }", "function one(id) {\n\n return lessonPlan.lessons[id]\n\n}", "getThoughtById({ params }, res) {\n Thought.findOne({ _id: params.thoughtId})\n .then(dbThoughtData => {\n if (!dbThoughtData...
[ "0.7131839", "0.7080877", "0.6929071", "0.68685955", "0.68610173", "0.68472874", "0.6838154", "0.6808645", "0.6742733", "0.6648007", "0.6628279", "0.65855134", "0.64543635", "0.643891", "0.638803", "0.6363772", "0.6355988", "0.63329405", "0.63016987", "0.6272963", "0.6264183"...
0.63100934
18
update user by id
updateThought({ params, body }, res) { Thoughts.findOneAndUpdate({ _id: params.id }, body, { new: true }) .then(dbThoughtsData => { if (!dbThoughtsData) { res.status(404).json({ message: 'No Thoughts found with this id!' }); return; } res.json(dbThoughtsData); }) .catch(err => res.json(err)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function updateUser(req, res, next) {\n const sql = sqlString.format(`UPDATE users SET ? WHERE id = ?`, [\n req.body,\n req.params.id\n ])\n\n db.execute(sql, (err, result) => {\n if (err) return next(err)\n if (!result.affectedRows) return next({ message: 'User not find' })\n res.send('User upda...
[ "0.7985246", "0.79495466", "0.7910999", "0.7850244", "0.78222364", "0.76334757", "0.7550128", "0.75343853", "0.74757886", "0.74699116", "0.7454232", "0.7434846", "0.74275315", "0.74194354", "0.74150723", "0.7409809", "0.74013996", "0.7392802", "0.73925984", "0.73871315", "0.7...
0.0
-1
DRAW RECTANGLE WITH CURVED CORNERS
draw(ctx) { const {x, y, w, h, radius, isMatched, scaleX, scaleY, img} = this; const grd = ctx.createLinearGradient(x, y, x + w, y + h); ctx.save(); ctx.translate(x + 0.5 * w, y + 0.5 * h); // TRANSLATE TO SHAPE CENTER ctx.scale(scaleX, scaleY); ctx.translate(-(x + 0.5 * w), -(y + 0.5 * h)); // TRANSLATE CENTER BACK TO 0, 0 ctx.beginPath(); ctx.moveTo(x, y + radius); ctx.lineTo(x, y + h - radius); ctx.quadraticCurveTo(x, y + h, x + radius, y + h); ctx.lineTo(x + w - radius, y + h); ctx.quadraticCurveTo(x + w, y + h, x + w, y + h - radius); ctx.lineTo(x + w, y + radius); ctx.quadraticCurveTo(x + w, y, x + w - radius, y); ctx.lineTo(x + radius, y); ctx.quadraticCurveTo(x, y, x, y + radius); grd.addColorStop(0, '#800080'); grd.addColorStop(1, '#660066'); ctx.fillStyle = grd; ctx.strokeStyle = '#D896FF'; ctx.lineWidth = 10; ctx.stroke(); ctx.fill(); // DRAW IMAGE IF CARD IS MATCHED ctx.clip(); if (isMatched && scaleX >= 0 ) { ctx.drawImage(img, 0, 0, w, h, x, y, w, h); } ctx.restore() }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function drawRect(x,y, width, height, context){\n context.beginPath();\n context.rect(x , y, width , height - 32);\n context.fillStyle = \"0088cc\";\n context.fill();\n context.strokeStyle = 'orange';\n context.stroke();\n}", "function draw_rect(X,Y,Z)\n{\n //outer portion in solid colo...
[ "0.63438064", "0.6306723", "0.62305635", "0.6227458", "0.6218678", "0.6208487", "0.6201294", "0.6200531", "0.61770576", "0.6140994", "0.61370575", "0.613029", "0.61168474", "0.61164933", "0.6113204", "0.60941935", "0.6089786", "0.60889584", "0.6086912", "0.60844845", "0.60759...
0.0
-1
CHECK IS CARD HOVERED BY CURSOR
isHover(x, y) { if (x >= this.x && x <= this.x + this.w && y >= this.y && y <= this.y + this.h) { return true; } else { return false; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function draw() {\n //check if mouse is on item\n if(currentState ===`inspection`){\n //calculates the distance between mouse and items\n let distRemote = dist(mouseX,mouseY,item_remote.x,item_remote.y);\n let distAc = dist(mouseX,mouseY,item_ac.x,item_ac.y);\n let distpenpen = dist(mouseX,mouseY,ite...
[ "0.61495733", "0.5914272", "0.5905241", "0.58405644", "0.58347124", "0.5803509", "0.57898724", "0.5776128", "0.57696563", "0.5705129", "0.56657803", "0.56644547", "0.5664006", "0.5649993", "0.5589875", "0.55680335", "0.5556268", "0.55529135", "0.5549643", "0.5536445", "0.5532...
0.0
-1
Select function that selects Country and Users from HTML dropdown
function select(){ var Country = document.getElementById("Country").value; var Users = document.getElementById("Users").value; if(Country=="All" && Users=="All"){start()} //calls the initial overview drawing else{ update(Country , Users); //updates the drawing according to the selection select1(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function selectizeCountries() {\n var selectCountry = selectizeGeolocation(\"select.predicate-default-value.select-country\");\n selectCountry.addOption(repository.getCountries());\n }", "function selectSalesCountry(country, name) { //39774936\n\t$(\"#dropdownMenuButtonLand\").text(name);\n\t\n\...
[ "0.7252894", "0.6967563", "0.6919902", "0.6863326", "0.68237877", "0.6710932", "0.66881555", "0.66504395", "0.6618597", "0.6543385", "0.65269256", "0.6517626", "0.64990294", "0.6493298", "0.64826787", "0.6368094", "0.6363437", "0.6344807", "0.6321564", "0.63131374", "0.630650...
0.6638116
8
this function is exactly identical to the update function but this draws all the datapoints
function start(){ start1(); d3.csv('data_ellipse.csv', function (data) { svg = d3.select("#scattersvg") margin = { top: 50, right: 20, bottom: 30, left: 30 }; width = 600 - margin.left - margin.right, height = 400 - margin.top - margin.bottom; colors = ["#e41a1c", "#377eb8", "#4daf4a", "#984ea3"] colorScale = d3.scaleOrdinal() .domain(["LEO", "MEO", "GEO", "Elliptical"]) .range(colors); x = d3.scaleLinear() .domain([ d3.min([0,d3.min(data,function (d) { return d.Inclination})]), d3.max([0,d3.max(data,function (d) { return d.Inclination})]) ]) .range([0, width]) .nice(); y = d3.scaleLinear() .domain([ d3.min([0,d3.min(data,function (d) { return d.ecc })]), d3.max([0,d3.max(data,function (d) { return d.ecc })]) ]) .range([height, 0]); tooltip = d3.select("#zoomableScatter").append("div") .attr("class", "tooltip") .style("opacity", 0); xAxis = d3.axisBottom(x).ticks(12) yAxis = d3.axisLeft(y).ticks(12 * height / width); svg = d3.select("#scattersvg") .attr("width", width + margin.left + margin.right) .attr("height", height + margin.top + margin.bottom) .append("g") .attr("transform", "translate(" + margin.left + "," + margin.top + ")"); clip = svg.append("defs").append("svg:clipPath") .attr("id", "clip") .append("svg:rect") .attr("width", width ) .attr("height", height ) .attr("x", 0) .attr("y", 0); scatter = svg.append("g") .attr("id", "scatterplot") .attr("clip-path", "url(#clip)"); brush = d3.brush().extent([[0, 0], [width, height]]).on("end", brushended), idleTimeout, idleDelay = 350; scatter.append("g") .attr("class", "brush") .call(brush) scatter.selectAll(".dot") .data(data) .enter().append("circle") .attr("class", "dot") .attr("r", 4) .attr("cx", function (d) { return x(d.Inclination); }) .attr("cy", function (d) { return y(d.ecc); }) .attr("opacity", 0.5) .style("fill", function (d) { return colorScale(d.ClassOfOrbit)}) .on('mouseover', function () { d3.select(this) .transition() .duration(500) .attr('r',6) //.attr('stroke-width',.5) //.attr('stroke', 'black') }) .on('mouseout', function () { d3.select(this) .transition() .duration(500) .attr('r',4) }) .append('title') // Tooltip .text(function (d) { return d.NameofSatellite + '\nEccentricity: ' + d.Eccentricity + '\nInclination: ' + d.Inclination + '\nClass of orbit: ' + d.ClassOfOrbit}); // x axis svg.append("g") .attr("class", "x axis") .attr('id', "axis--x") .attr("transform", "translate(0," + height + ")") .call(xAxis); svg.append("text") .style("text-anchor", "end") .attr("x", width) .attr("y", height - 28) .text("Inclination"); // y axis svg.append("g") .attr("class", "y axis") .attr('id', "axis--y") .call(yAxis); svg.append("text") .attr("transform", "rotate(-90)") .attr("y", 6) .attr("dy", "1em") .style("text-anchor", "end") .text("Eccentricity"); function brushended() { var s = d3.event.selection; if (!s) { if (!idleTimeout) return idleTimeout = setTimeout(idled, idleDelay); x.domain(d3.extent(data, function (d) { return d.Inclination; })).nice(); y.domain(d3.extent(data, function (d) { return d.ecc; })).nice(); } else { console.log("selected!") x.domain([s[0][0], s[1][0]].map(x.invert, x)); y.domain([s[1][1], s[0][1]].map(y.invert, y)); scatter.select(".brush").call(brush.move, null); } zoom(); } function idled() { idleTimeout = null; } function zoom() { var t = scatter.transition().duration(750); svg.select("#axis--x").transition(t).call(xAxis); svg.select("#axis--y").transition(t).call(yAxis); scatter.selectAll("circle").transition(t) .attr("cx", function (d) { return x(d.Inclination); }) .attr("cy", function (d) { return y(d.ecc); }); } }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function updateCanvas() {\n clearGraph();\n\n updatePoints();\n}", "function update() {\r\n const time = Date.now() / 1000;\r\n coordinates = getCoordinates(time);\r\n drawing.redraw(coordinates);\r\n }", "function update() {\n plot.setData([getRandomData()]);\n ...
[ "0.71386826", "0.70967853", "0.7034117", "0.69341147", "0.68750787", "0.6715336", "0.66668695", "0.66387033", "0.6591523", "0.65554804", "0.65546536", "0.65509397", "0.6542646", "0.65183884", "0.65168047", "0.6501569", "0.64996624", "0.64879495", "0.64862365", "0.64756155", "...
0.0
-1
ajax form file upload
function ajaxFormUpload(formId, fun_success, fun_error) { url = sysWebAppName + 'TransServlet'; $("#" + formId).form( 'submit', { url : encodeURI(url), timeout : ajaxTimeout, async : false, traditional : false, cache : false, ajaxSubmit : function() { return true; }, success : function(result) { var data = (new Function("return " + result))(); if (data.returnCode == 'EB8000006') { $.messager.confirm('用户异常提示', '用户异常,是否重新登录。', function(r) { if (r) { $(".leftcurtain", window.parent.document).stop() .animate({ width : '50%' }, 1500); $(".rightcurtain", window.parent.document).stop() .animate({ width : '51%' }, 1500); $(".login", window.parent.document) .show("slow").find( "input[type=password]") .val(""); parent.changeImage(); } }); } else { if (data.returnCode == successCode) { fun_success && fun_success(data); } else { if (fun_error) { fun_error && fun_error(data); } } } }, onLoadError : function() { $.messager.alert('系统错误', '网络或系统忙提交失败,请重试!', 'error'); } }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function fileUpload() {\n var form = $form[0];\n \n if ($(':input[@name=submit]', form).length) {\n alert('Error: Form elements must not be named \"submit\".');\n return;\n }\n \n var opts = $.extend({}, $.ajaxSettings, options);\n\n var id = '...
[ "0.7445749", "0.74177027", "0.7409275", "0.7379888", "0.7365394", "0.7365096", "0.73496974", "0.73434925", "0.7337572", "0.7207285", "0.7178818", "0.71679497", "0.71500945", "0.71482944", "0.7139041", "0.71204466", "0.70997345", "0.70914197", "0.70897377", "0.70665103", "0.70...
0.0
-1
checks to see if Alt is pressed
function keyHandling(){ window.kill = false; window.addEventListener("keydown", function(e){//console.log(e.keyCode); if(e.keyCode == 18 && !window.kill){window.kill = true;} }); window.addEventListener("keyup", function(e){window.kill = false;}); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "handleAltPress(isPressed) {\n if (isPressed !== this.state.isAltPressed)\n this.setState(prevState => ({\n isAltPressed: !prevState.isAltPressed\n }));\n }", "function isAltOrMeta(ev) {\n // eslint-disable-next-line deprecation/deprecation\n return ev.which === _Utilities__WEBPACK_IMPO...
[ "0.7466744", "0.708914", "0.68929887", "0.68929887", "0.68929887", "0.68929887", "0.68929887", "0.68929887", "0.68929887", "0.68929887", "0.68929887", "0.68929887", "0.68929887", "0.6869559", "0.68236226", "0.6800464", "0.67582846", "0.67393386", "0.67393386", "0.6675342", "0...
0.0
-1
sorts tabs then displays in square grid for easy navigation
function organizeTabs(){ chrome.tabs.query({currentWindow:true}, function(tabs) { //selects all tabs from current window console.log(tabs);//check the console for more tab information //sorts array of obj's. Source: http://stackoverflow.com/users/43452/stobor tabs.sort(function(a, b) { return a['url'].localeCompare(b['url']); }); var urllist = document.getElementById('tabs'); for(var i in tabs){ var tablen = tabs.length; if((i%Math.floor(Math.sqrt(tablen)) === 0 && tablen <= 7*7) || (tablen > 7*7 && i%6 === 0)){ var row = document.createElement('tr'); urllist.appendChild(row);//adds a new row to the table } //tabitem consists of entries in larger table var tabitem = document.createElement('td'); tabitem.id = String(tabs[i]['id']);//sets <td id='tab.id'> tabitem.className = 'clickTab'; row.appendChild(tabitem); //each tabitem has its data formatted in a table var formattedCell = document.createElement('table'); tabitem.appendChild(formattedCell); var cellData = document.createElement('tr'); formattedCell.appendChild(cellData);//there will only be ONE row per cell var iconTd = document.createElement('td'); iconTd.className = 'icontd'; cellData.appendChild(iconTd);//adding icon to cell var lengthLimit = 12,//max number of characters per line visibleText = 30,//max visible characters from title rawTitle = tabs[i]['title'].length>visibleText? tabs[i]['title'].slice(0,visibleText) + '...' : tabs[i]['title'] ; //puts space into URLs or other long text that throws off text spacing var cleanOnce = function(raw, visChars){ var words = raw.split(' '); for(var w in words){ var len = words[w].length; if(len > visChars){ words[w] = words[w].slice(0,len/2) + ' ' + words[w].slice(Math.ceil(len/2),len); } } return words.join(' '); } var rawTitle = cleanOnce(cleanOnce(rawTitle, lengthLimit),lengthLimit); //second data entry to cell table. icon on left, textTd on right var textTd = document.createElement('td'); textTd.className = "title"; cellData.appendChild(textTd); var titleNode = document.createTextNode(rawTitle); textTd.appendChild(titleNode); var iconDim = 32, img = new Image(iconDim,iconDim),//width, height iconUrl = tabs[i]['favIconUrl']; var pattern = /png|jpg|ico/g;//acceptable icon extensions if(pattern.test(iconUrl)){ //only adds icon image if one is found img.src = iconUrl; }else{ img.src = "/images/default.png"; } iconTd.appendChild(img); } //iterates through every entry in the table and attaches a listener var addListeners = function addTableListeners(){ for (var i = 0; i < urllist.children.length; i++) { for(var j = 0; j < urllist.children[i].children.length; j++){ var childElement = urllist.children[i].children[j]; childElement.addEventListener('click', function(){ chrome.tabs.get(parseInt(this.id), function(mytab){ if(!mytab['active']){//can't modify/select active tab if(window.kill){ var tableCell = document.getElementById(mytab.id); tableCell.parentNode.removeChild(tableCell);//removes tab from table in html chrome.tabs.remove(parseInt(mytab.id));//removes tab from browser }else{ //select new tab to be active chrome.tabs.update(parseInt(mytab.id), {active:true});//no callback necessary } } }); }); } } } addListeners();//connects mouse clicks on table with browser's tabs //end of chrome.tabs.query }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function toevoegen_card_tabs_in_grid() {\n card_tabs_data__arr.map( (card_tab__obj, idx) => {\n $x('.grid_' + eval(idx + 1)).append( aanmaken_card_tabs(idx))\n })\n }", "function display_tabs( tabs ) {\n var tabs_code = $(tabs);\n\n set_active_tab( tabs_code );\n ...
[ "0.6578337", "0.631205", "0.6259668", "0.6255593", "0.62150013", "0.619272", "0.6178225", "0.6119733", "0.6092266", "0.60863256", "0.60732603", "0.60263723", "0.60049015", "0.59749115", "0.596604", "0.5961076", "0.5957652", "0.5955172", "0.5948951", "0.59252095", "0.59230083"...
0.6483174
1
Calculates the hypotenuse given sideA and sideB
function hypotenuse(sideA, sideB) { if (isNaN(sideA) || isNaN(sideB)) { return NaN; } return Math.sqrt(sideA**2 + sideB**2); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function lengthOfHypotenuse(side1, side2){\n \n //hypotenuse squared = side1 squared + side2 squared\n var hypotenuse = Math.sqrt((side1 * side1) + (side2 * side2));\n return hypotenuse;\n}", "function hypotenuse(a, b) {\n return Math.sqrt(a * a + b * b);\n}", "function hypoteneuse(a, b){\n retur...
[ "0.82282203", "0.7890947", "0.75940454", "0.74378896", "0.74118584", "0.73922896", "0.73908", "0.7390663", "0.7387037", "0.7245202", "0.7073672", "0.6983835", "0.68348914", "0.68130314", "0.6734878", "0.67297643", "0.6571513", "0.6560006", "0.6445917", "0.6185874", "0.6159060...
0.86003286
0
limpiar campos y escribir nuevos nvalores = button onclick="limpiar():
function limpiar() { document.getElementById("miFormulario").reset(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function limpiar() {\n document.getElementById('taConsulta').style.backgroundColor = \"#FFF\";\n document.getElementById('divEjecutaCMD').style.display = 'none';\n document.getElementById('divEjecutaSQL').style.display = 'block';\n document.getElementById('taConsulta').style.color = \"#000\";\n docu...
[ "0.691557", "0.6911539", "0.690469", "0.67279685", "0.66681504", "0.65978855", "0.65640396", "0.6559355", "0.6525148", "0.648375", "0.64804333", "0.6479693", "0.646877", "0.64593285", "0.6412034", "0.6367715", "0.6329136", "0.6322093", "0.6321097", "0.63076484", "0.6300602", ...
0.0
-1
get integer value from id
function num(id) { return Number($(id).val()); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "get intValue() {}", "function getValue(id) {\n var val = document.getElementById(id.toString()).childNodes;\n val = val[0].innerHTML;\n return Number(val);\n}", "function getId(ele){\t// store the id value\r\n id_value = ele.id; \r\n}", "function get_id( obj ) {\n var id = obj.attr( 'id' );\n ...
[ "0.71254814", "0.7058768", "0.6866085", "0.6865158", "0.66293687", "0.6584422", "0.6454692", "0.64197534", "0.6411032", "0.63998675", "0.6364787", "0.6356297", "0.6350396", "0.6279081", "0.62735426", "0.62372994", "0.6236006", "0.6236006", "0.6219072", "0.6219072", "0.6219072...
0.6870161
2
get number value HTML
function getNum(id) { return document.getElementById(id).innerHTML; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function renderNumber(number) {\n numberView.innerText = number\n}", "function tNumber() {\n const [h, k] = [opt.h, opt.k];\n eid(\"tnumber\").innerHTML = `=&nbsp;${h}<sup>2</sup>&nbsp;+&nbsp;(${h})(${k})&nbsp;+&nbsp;${k}<sup>2</sup>&nbsp=&nbsp${h * h + h * k + k * k}`;\n}", "getDisplayNumber(number) {\...
[ "0.7017389", "0.68203574", "0.68122935", "0.67585605", "0.6660968", "0.663326", "0.6597008", "0.6560891", "0.64550424", "0.6412821", "0.64041334", "0.6340001", "0.6282566", "0.6270825", "0.6268968", "0.625062", "0.6241465", "0.62367785", "0.62332445", "0.62294406", "0.6221004...
0.5903318
48
transfer tokens to an account
async function sendHbars(amount, accountId) { try { const accId = new AccountId(accountId); console.log("starting sendToken() - amount = " + amount + " & accountID = " + accountId); console.log("operator id = " + operatorAccount); //Create the transfer transaction const transaction = await new TransferTransaction() .addHbarTransfer(operatorAccount, new Hbar(-amount)) .addHbarTransfer(accountId, new Hbar(amount)); //Submit the transaction to a Hedera network const txResponse = await transaction.execute(client); //Request the receipt of the transaction const receipt = await txResponse.getReceipt(client); //Get the transaction consensus status const transactionStatus = receipt.status; console.log("The transaction consensus status is " + transactionStatus.toString()); } finally { console.log("Transaction completed."); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function transferTokenFrom() {\n // loginOwner()\n let tokenID = document.getElementById('transferFromTokenID').value;\n let senderPrvtKey = document.getElementById('transferFromPrvtKey').value;\n let addressFrom = document.getElementById('transferFromAddressFrom').value;\n let addressTo = document....
[ "0.69593334", "0.69391596", "0.6858619", "0.679081", "0.6611351", "0.6287044", "0.6169439", "0.61202425", "0.60360956", "0.59620464", "0.58850306", "0.5802836", "0.5759069", "0.57373667", "0.56806505", "0.5656332", "0.5654617", "0.5632424", "0.56301296", "0.56181955", "0.5616...
0.0
-1
Complete the event handler function for the form
function runEnter() { // Prevent the page from refreshing d3.event.preventDefault(); // Select the input element and get the raw HTML node const idColmap = [{ id: "#datetime", col: "datetime" }, { id: "#city", col: "city" }, { id: "#state", col: "state" }, { id: "#country", col: "country" }, { id: "#shape", col: "shape" }]; var filteredData = tableData; idColmap.forEach(entry => { //if the user selection is NOT blank, filter data to user selection. if (d3.select(entry.id).property("value")) { filteredData = filteredData.filter(sighting => sighting[entry.col] === d3.select(entry.id).property("value")); } }); //print the filtered data to the console console.log(filteredData); //overwrite table with filtered data var tbody = d3.select("tbody"); tbody.html(""); // clears the table filteredData.forEach((UFOsighting_bydate) => { var row = tbody.append("tr"); Object.entries(UFOsighting_bydate).forEach(([key, value]) => { var cell = row.append("td"); cell.text(value); }); }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "formChanged() {}", "function processForm(evt) {\n}", "function EndForm()\n\t{\n\t\t// Write out the <div> that will house the submission applet now\n\t\t// if NS4 support is required.\n\t\tif (this.ns4support && !__submitDivOutput) {\n\t\t\tdocument.writeln('<div id=\"editize_submit_div\" style=\"position: abs...
[ "0.69255406", "0.6588107", "0.64550143", "0.62246686", "0.6197997", "0.61374116", "0.612559", "0.6112196", "0.6092421", "0.60517365", "0.60506904", "0.60406387", "0.60368943", "0.60297674", "0.5996614", "0.59878623", "0.59843487", "0.59471774", "0.59408426", "0.5934441", "0.5...
0.0
-1
function to find the posts
function postForComment(posts, comment) { return posts.find(function(post) { // find post with same id return post.id === comment.postId; }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getPosts() {\n\tvar snippet = {\n\t\tquery : {},\n\t\tfields: \"title,category,thumbnail\"\n\t}\n\t// for unpublished\n\t// snippet.query = {published: false, nextKey: '-K_W8zLX65ktmaKwf1Yx'}\n\n\trimer.post.find(snippet, function(error, value) {\n\t\tif(error) {\n\t\t\tconsole.log(error)\n\t\t}\n\t\telse...
[ "0.7785213", "0.7101704", "0.70162195", "0.6943377", "0.6825714", "0.681082", "0.67602545", "0.6741296", "0.6736588", "0.66566855", "0.658753", "0.658716", "0.658645", "0.65801793", "0.65660745", "0.65568537", "0.6554969", "0.6553344", "0.655279", "0.6500837", "0.64842105", ...
0.0
-1
Return the entreprise corresponding to the id parameter
function getEntreprise(req, res, next) { var id = parseInt(req.params.id); db.query("SELECT * FROM entreprises WHERE id = ?", id, function (error, results, fields) { if (error) res.status(500) .json({ status: "ko", data: "error" }) else res.status(200) .json({ status: "ok", data: results }) }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "get(id) {\n return internal(this).idToEntity.get(id);\n }", "getEmpireById(id) {\n return client({\n method: 'GET',\n path: `${ROOT}/empires/${id}`,\n });\n }", "getById(id) {\r\n return this._byId[id]\r\n }", "function getEntityById(id) {\n return enti...
[ "0.7146589", "0.68520635", "0.68410945", "0.67418903", "0.66265833", "0.6572946", "0.656409", "0.6505309", "0.6464359", "0.6446938", "0.64382064", "0.6430203", "0.6423881", "0.6368593", "0.6353878", "0.63314104", "0.6327672", "0.6297064", "0.6292475", "0.62807417", "0.6280741...
0.68777204
1
Return employees of the entreprise corresponding to the id parameter
function getEmployees(req, res, next) { var id = parseInt(req.params.id); db.query("SELECT * FROM users WHERE id_entreprise = ?", id, function (error, results, fields) { if (error) res.status(500) .json({ status: "ko", data: "error" }) else res.status(200) .json({ status: "ok", data: results }) }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getEmployeeById (id) {\n var i;\n for (i = 0; i < employees.length; i++) {\n if (employees[i].id === id) {\n return employees[i];\n }\n }\n\n return undefined\n}", "async findById(id) {\n\t\tlet sqlRequest = \"SELECT * FROM employee WHERE id=$id\";\n\t\tlet sqlParams = {$id: id};\n\t\tcon...
[ "0.73206043", "0.7212194", "0.71006846", "0.6989848", "0.69851136", "0.6932782", "0.6797988", "0.67077446", "0.6678182", "0.66624117", "0.6643086", "0.6540766", "0.6519953", "0.6517105", "0.64350927", "0.64248246", "0.64130837", "0.64055556", "0.6401281", "0.63880527", "0.635...
0.75134283
0
Return offers of the entreprise corresponding to the id parameter
function getEntrepriseOffres(req, res, next) { var id = parseInt(req.params.id); db.query("SELECT * FROM offres WHERE id_entreprise = ?", id, function (error, results, fields) { if (error) res.status(500) .json({ status: "ko", data: "error" }) else res.status(200) .json({ status: "ok", data: results }) }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getOffers() {\n $http.get(\"/api/term_deposits/offers\").then(function (response) {\n response.data.offers.forEach(function (element) {\n offers.push(element);\n });\n loadOffers();\n });\n }", "getOffers(datasetId) {\n return new P...
[ "0.66183436", "0.6362016", "0.6197524", "0.6186715", "0.6145978", "0.59959996", "0.59920025", "0.5943586", "0.59171194", "0.5626534", "0.5591621", "0.55808616", "0.5565421", "0.5561084", "0.55463827", "0.55205965", "0.5517584", "0.55175614", "0.5498024", "0.548575", "0.544879...
0.55813473
11
Add an entreprise to the entreprises table
function addEntreprise(req, res, next) { var name = req.body.name; var description = req.body.description; db.query("INSERT INTO entreprises(name, description, picture_path) VALUES(?, ?, 'placeholder_company.png')", [name, description], function (error, results, fields) { if (error) { res.status(500) .json({ status: "ko", data: "error" }) } else { db.query("SELECT * FROM entreprises WHERE name= ?", [name], function (errors, results, fields) { res.status(200) .json({ status: "ok", data: results }) }) } }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "addEntity (entity) {\n this.entities.push(entity);\n }", "function addEntity(entity) {\n entities.push(entity);\n }", "function addEmployee(obj) {\n console.log(\"Inserting a new employee!\");\n connection.query(\"INSERT INTO employee SET ?\", obj, function(err, res) {\n ...
[ "0.611708", "0.60812455", "0.60738915", "0.606509", "0.60071844", "0.6003557", "0.5928825", "0.5899852", "0.5815088", "0.58033156", "0.57796276", "0.5778683", "0.5705452", "0.5693175", "0.5673195", "0.56551296", "0.5643245", "0.5621177", "0.5611097", "0.5610571", "0.5608898",...
0.60133874
4
Get the total number of entreprises
function getCount(req, res, next) { db.query("SELECT COUNT(*) FROM entreprises", function (errors, results, fields) { if (errors) { console.log(errors) res.status(500) .json({ status: "ko", data: "error" }) } res.status(200) .json({ status: "ok", data: results[0] }) }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "get totalDescendents() {\n let count = this.offspring.length;\n\n for (let offspring of this.offspring) {\n count += offspring.totalDescendents;\n }\n\n return count;\n }", "get totalDescendents() {\n let counter = 0;\n for (let descendent of this.offspring) {\n counter += descendent...
[ "0.7263685", "0.6959776", "0.6894329", "0.6882285", "0.6880025", "0.6807522", "0.6807522", "0.6772852", "0.67427", "0.67339617", "0.67003185", "0.66843826", "0.66495067", "0.66332173", "0.65706044", "0.65483034", "0.649883", "0.6481571", "0.6459471", "0.64325774", "0.6401237"...
0.61647165
46
Deletes the entreprise corresponding to the id parameter
function deleteEntreprise(req, res, next) { var id = parseInt(req.params.id); db.query("DELETE FROM entreprises WHERE id = ?", id, function (errors, results, fields) { if (errors) res.status(500) .json({ status: "ko", data: "error" }) res.status(200) .json({ status: "ok", data: results }) }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function deleteEntityById(id) {\n delete entities[id];\n}", "remove(id, params) {}", "deleteById(req, res) {\n let id = req.params.id;\n\n this.tradeDao.deleteById(id)\n .then(this.common.editSuccess(res))\n .catch(this.common.serverError(res));\n }", "async deleteById...
[ "0.72522163", "0.7210319", "0.706414", "0.70603603", "0.7036229", "0.6943367", "0.6933638", "0.6892575", "0.6861884", "0.68562645", "0.68396944", "0.6826325", "0.6823247", "0.6802406", "0.6780316", "0.6768397", "0.67428386", "0.6737749", "0.6723371", "0.6702689", "0.6681091",...
0.75582635
0
Called by init (onchage traitsnum); populates traits array according to traitsnum
function buildParents() { for(var i = 0; i < self.traitsNum; i++) { self.parent1.traits.push(angular.copy(traitSchema)); self.parent2.traits.push(angular.copy(traitSchema)); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function buildTraits(factoryTraits, traits) {\n return traits.map(function (trait) { return factoryTraits[trait]; });\n}", "constructor(traits) {\r\n\t\tthis.traits = traits;\r\n\t\tthis._haloDirty = false;\r\n\r\n\t\tthis.rebuild();\r\n\t}", "getTraits() {\n return [\n {type: 'superPower', display:...
[ "0.55665296", "0.5540709", "0.53485507", "0.5291602", "0.5227561", "0.5137877", "0.5089087", "0.49502376", "0.49164343", "0.48896375", "0.48866627", "0.47826025", "0.47767958", "0.47767466", "0.46990284", "0.4697882", "0.46975815", "0.46835715", "0.4670766", "0.4648493", "0.4...
0.53620076
2
Validation Function if user enters wrong input
function handler() { let unparsedValue = birthDate + birthMonth; if (isNaN(birthDate) || isNaN(birthMonth)) { console.log(chalk.red.blue("Please enter input in numbers\n")); } else if (birthDate == "" || birthDate == "") { console.log(chalk.red.blue("Fields Should Not Be Empty\n")); } else if (birthDate > maxDate || birthMonth > maxMonth) console.log(chalk.red.blue("It should not exceed", chalk.bold.cyan(maxDate), "for days and ", chalk.bold.cyan(maxMonth), "for month")); else { //Welcome msg console.log("\nWelcome\n", chalk.bold.cyan(userName), "Your Birthdate is", chalk.bold.cyan(birthDate), chalk.bold.cyan(birthMonth), "\n"); primeChecker(unparsedValue); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function validateInput(input){\n if(input == \"\" || input == undefined){\n message(\"Lén verður að vera strengur\");\n return false;\n }\n return true;\n }", "function validateInput() {\n\t\tif (!name) {\n\t\t\talert('Please input a name');\n\t\t\treturn false;\n\t\t}\n\t\tif (!des...
[ "0.7382516", "0.7374024", "0.72361314", "0.7039518", "0.69924605", "0.69854075", "0.69231457", "0.69212896", "0.69162965", "0.6871488", "0.68362653", "0.67993754", "0.6782768", "0.6753065", "0.6735095", "0.67347646", "0.6726372", "0.6714123", "0.67078125", "0.6698239", "0.667...
0.0
-1
Below is an implementation of the Durstenfeld shuffle Borrowed near verbatim from Laurens Holst on Stack Overflow, var names changed for our case
function shuffleAnswers(answers) { for (let i = answers.length - 1; i > 0; i--) { const j = Math.floor(Math.random() * (i + 1)); [answers[i], answers[j]] = [answers[j], answers[i]]; } return answers; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "shuffle() {\n // TODO\n }", "shuffle()\n\t{\n\t\tlet temp;\n\t\tlet arraySpot;\n\t\tlet arraySpot2;\n\t\tfor (let x = 0; x < 1000000; x++)\n\t\t{\n\t\t\tarraySpot = Math.floor(Math.random() * this.numCards);\n\t\t\tarraySpot2 = Math.floor(Math.random() * this.numCards);\n\n\t\t\ttemp = this.cards[array...
[ "0.77170235", "0.73904973", "0.734385", "0.73041064", "0.7282629", "0.7261864", "0.7235354", "0.7198941", "0.7140132", "0.71336067", "0.7130898", "0.71218264", "0.70919293", "0.70822316", "0.70660585", "0.7063995", "0.7054185", "0.70447683", "0.7031722", "0.703135", "0.702967...
0.0
-1
Functions ======================================================================================== Remove commas from Title
function removeFromTitle(str) { title = str; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function get_well_formated_title(title) {\n //setp 1 upper case\n title = title.toLowerCase();\n //remove all the white space and put the space\n title=title.replace(new RegExp(' ', 'g'), '-');\n //remove single quote to normal\n title = title.replace(new RegExp(\"'\", 'g'), '');\n //remove & ...
[ "0.703964", "0.6814982", "0.6786741", "0.6773336", "0.6773336", "0.67238146", "0.6642076", "0.66219646", "0.65703535", "0.6556103", "0.65404904", "0.6532061", "0.6417208", "0.64085", "0.6405783", "0.640395", "0.63990015", "0.6393141", "0.63485795", "0.6347732", "0.6302645", ...
0.6356197
18
Change "Add to eBay" Value
function addItemToEbay() { addToEbay.value = '1'; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function updateBasketTotal(addToTotal) {\n currTotal = $(\"#basket-total\").text();\n currTotal = Number(currTotal.substring(1,currTotal.length));\n basketTotal = currTotal + Number(addToTotal);\n \n basketTotal = \"&pound\" + Number(basketTotal).toFixed(2);\n $(\"#basket-total\").html(basketTota...
[ "0.6014025", "0.56391364", "0.5621171", "0.5555007", "0.549761", "0.54732794", "0.5471149", "0.54103446", "0.5397586", "0.5373796", "0.5363409", "0.53546286", "0.53546286", "0.5322086", "0.5315493", "0.5299758", "0.5290246", "0.5273022", "0.5255665", "0.5246356", "0.52452147"...
0.8097996
0
Remove commas from Short Title
function removeFromShortTitle(str) { CKEDITOR.instances.app_bundle_product_form_shortDescription.setData(`<p>${str}</p>`) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function get_well_formated_title(title) {\n //setp 1 upper case\n title = title.toLowerCase();\n //remove all the white space and put the space\n title=title.replace(new RegExp(' ', 'g'), '-');\n //remove single quote to normal\n title = title.replace(new RegExp(\"'\", 'g'), '');\n //remove & ...
[ "0.69246554", "0.690895", "0.65537274", "0.65491235", "0.6516505", "0.6511126", "0.6508551", "0.6508551", "0.6421714", "0.64186406", "0.6401867", "0.63077617", "0.62776464", "0.6275881", "0.6259394", "0.62579495", "0.62560666", "0.6237189", "0.6219065", "0.6205649", "0.619976...
0.6037072
30
Set template for Long Description
function setDescriptionTemplate(){ CKEDITOR.instances.app_bundle_product_form_longDescription.setData(`<p>Your satisfaction is our number one goal. Keep in mind that we offer hassle-free returns if needed. If you have any questions or problems, please contact us.</p> <p>Please Note: All included items are shown in the pictures</p> <p>${newTitle}<br /> ${itemNumber}</p> <p><strong>Features:</strong></p> <ul> <li>Feature 1</li> </ul> <p><strong>What&#39;s included:</strong></p> <ul> <li>${newTitle}</li> </ul> <p><strong>What&#39;s not included:</strong></p> <ul> <li>Any other accessories</li> </ul> <p><strong>Condition:</strong></p> <ul> <li>Used in good working condition</li> <li>Shows signs of use such as scuffs and scratches</li> <li>See photos for details</li> </ul> `) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function createMarkupForProjectDescription() {\n if (project.projectDescription) {\n return {\n __html: project.projectDescription,\n };\n } else {\n return;\n }\n }", "function...
[ "0.6644738", "0.6422635", "0.63019973", "0.6284039", "0.6265662", "0.6168046", "0.61362284", "0.60829526", "0.60827804", "0.60525", "0.5930345", "0.59264666", "0.59192073", "0.58818763", "0.58609194", "0.57896096", "0.57769364", "0.57747084", "0.5774313", "0.571282", "0.56970...
0.7869298
0
obtenemos el costo de cada producto seleccionado en el formulario de agregar productos
function valorUnitario() { // var codigo = document.getElementById('codigo').value; $('#cantidad').attr("disabled", false); $('#descripcion').attr("disabled", false); console.log("VALOR UNITARIO"); var par = { "codigo" : document.getElementById('codigo').value, }; $.ajax({ url: baseurl+"CtrUniversal/get_valorUnitario", type: "post", dataType: "html", data: par, }) .done(function(response) { var json = $.parseJSON(response); $("#costo").val(json.importe); $("#descripcion").val(json.msg); console.log(json.permiso); if (json.permiso == "") { document.getElementById('costo').removeAttribute('onfocus'); // document.getElementById("costo").setAttribute("onfocus", "this.blur()"); // document.getElementById("costo").blur(); }else{ // document.getElementById('costo').setAttribute('disabled',json.permiso); document.getElementById("costo").setAttribute("onfocus", "this.blur()"); // document.getElementById("costo").blur(); } }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function cargarValorNetoYCalcularTotalProductoSeleccionadoAlCambiarProducto(idSelectProducto){\n\t$(idSelectProducto).change(function(){\n\t\tcargarValorNetoYCalcularTotalProductoSeleccionado(idSelectProducto);\n\t});\n}", "function agregarAlCarrito(e) {\n if($(\"#formularioEnvio\").length===0){\n let ...
[ "0.6845446", "0.67331374", "0.67317724", "0.6731592", "0.67228514", "0.66906404", "0.6685775", "0.6616877", "0.6600178", "0.65890586", "0.6587918", "0.6576533", "0.6532173", "0.6518545", "0.6517055", "0.6480468", "0.6477128", "0.6475226", "0.6458677", "0.6454838", "0.6436909"...
0.0
-1
FIN VALOR UNITARIO OBTENEMOS EL IMPORTE DEL PRODUCTO MULTIPLICACION DE LA CANTIDAD POR UNIDAD
function importe() { console.log("IMPORTE"); var par = { "cantidad" : document.getElementById('cantidad').value, "costo" : document.getElementById('costo').value, }; $.ajax({ url: baseurl+"CtrUniversal/get_importe", type: "post", dataType: "html", data: par, }) .done(function(response){ var json = $.parseJSON(response); $("#importes").val(json.importe); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function accionConsultarProducto(){\n listado1.actualizaDat();\n var numSelec = listado1.numSelecc();\n if ( numSelec < 1 ) {\n GestionarMensaje(\"PRE0025\", null, null, null); // Debe seleccionar un producto.\n } else {\n var codSeleccionados = listado1.codSeleccionados();\n var...
[ "0.6314988", "0.6119212", "0.59917915", "0.5927688", "0.59165746", "0.5912371", "0.588427", "0.5832742", "0.58124375", "0.5786481", "0.5779858", "0.5774276", "0.576222", "0.57567316", "0.57554907", "0.57171816", "0.57058805", "0.5693483", "0.5672699", "0.56678", "0.5663465", ...
0.0
-1
function displayArticles pour l'affichage du contennu dans la page
function displayArticle(article){ let sectionCatalogue = document.getElementById("article"); //on capture la section "id" catalogue let articleTag = document.createElement('article'); //creation d'une balise <article> articleTag.setAttribute('class', 'product'); // ajout d'une classe à la balise article //ajout du titre---------------------------------------------------------------- let articleTitle = document.createElement('h2'); //creation d'une balise h2 articleTitle.textContent = article.name; //ajoute de texte à la balise h2 articleTag.appendChild(articleTitle); //ajout du h2 comme balise enfant de la balise article //ajout de l'iMage-------------------------------------------------------------- let articleImg = document.createElement ('img'); articleImg.src=article.imageUrl; // creation d'une balise href articleTag.appendChild(articleImg); // //ajout de la description------------------------------------------------------- let articleDescription = document.createElement('p'); articleDescription.textContent = article.description ; articleTag.appendChild(articleDescription); //ajout de le prix------------------------------------------------------------- //creation d'une balise h3 pour l'affichage du prix let articlePrice = document.createElement ('h3'); //affichage du prix articlePrice.textContent = article.price ; //conversion du prix en euro******************************** //ici article price est divisé par "/100" ou obtenir le prix en EURO articlePrice.textContent = (new Intl.NumberFormat('de-DE', { style: 'currency', currency: 'EUR' }).format(article.price /100)); //affichage du prix dans article articleTag.appendChild(articlePrice); //affichage des options ------------------------------------- //creation d'une balise selection pour l'affichage des option let lentilles = document.createElement("select"); articleTag.appendChild(lentilles); for (i = 0; i < article.lenses.length; i++) { let option = document.createElement("option"); lentilles.appendChild(option); option.textContent = article.lenses[i]; option.value = article.lenses[i]; } // Fin affichage des option -------------------------------------- //ici ajout du bouton "ajouter au panier" let boutonAjouter = document.getElementById("btn_envoyer"); boutonAjouter.addEventListener("click",function(){ //ajouter ici les fonction néssessaire à la function localStorage.setItem('ajouterAuPanier', 'btn_envoiyer'); //--déclaration de la variable "produitEnregistrerDansLocalStorage" //dans lequelle on met la key et les values qui sont dans le local storage let id_article = article._id; //JSON.parse c'est pour convertir les données au format JSON qui sont dans le local storage en objet Javascript let produitEnregistrerDansLocalStorage = JSON.parse(localStorage.getItem('panier')); if(produitEnregistrerDansLocalStorage){ // si on a un panier let checkCart = 0; // on surveille si on trouve l'article dans le panier for (var cartArticle in produitEnregistrerDansLocalStorage) { // pour chaque article du panier if (id_article.localeCompare( cartArticle) == 0) { // si l'id correspond a larticle aue je veux ajouter let qty_article = parseInt (produitEnregistrerDansLocalStorage[id_article]); // je recupère la quantite qty_article +=1; // j'augmente la quantite // ajouter la nouvelle qty produitEnregistrerDansLocalStorage[id_article] = qty_article; // je stocke la nouvelle qty dans le panier localStorage.setItem('panier', JSON.stringify(produitEnregistrerDansLocalStorage)); //j'enregistre le panier checkCart = 1; //je note aue j'ai trouvé l'article } } if (checkCart == 0) { // si je n'ai pas trouvé l'article produitEnregistrerDansLocalStorage[id_article] = "1"; // j'ajoute ce nouvel article au panier localStorage.setItem('panier', JSON.stringify(produitEnregistrerDansLocalStorage)); } } else{ // si je n'est pas de panier, je crée un nouveau panier let produitEnregistrerDansLocalStorage = {}; produitEnregistrerDansLocalStorage[id_article] = "1"; localStorage.setItem('panier', JSON.stringify(produitEnregistrerDansLocalStorage)); } // Confirmation d'ajout au panier confirm("Le produit à bien été ajouter au panier"); }); //ajout de l'enseMble de l'article dans la section sectionCatalogue.appendChild(articleTag); // ajout de la balise article comme enfant de la balise section Catalogue }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function displayArticles () {\n articleDiv.show();\n }", "function viewArticle() {\n\t\t//set the content of the elements using the list items' attributes\n\t\t$(\"article h1\").html($(this).attr(\"title\"));\n\t\t$(\"article img\").attr(\"src\", $(this).attr(\"backgr\"));\n\t\t$(\"article h4\").html($...
[ "0.7817295", "0.74394715", "0.7204823", "0.7203848", "0.71793497", "0.715829", "0.7156592", "0.70348316", "0.7004579", "0.69927084", "0.6887293", "0.68722385", "0.67983824", "0.6726438", "0.67037356", "0.66963047", "0.66942626", "0.66808116", "0.66700375", "0.6662658", "0.660...
0.63916296
39
returns to home screen when footer clicked again
componentWillReceiveProps(){ this.setState({ screen: this.props.screen }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function returnToHome(){\n\t\n}", "function ExitPage() {\n\t\talert('Are you sure you want navigate away from this App?');\n\t\tgetit()\n\t}", "function homeHandler(event)\n\t\t{\n\t\t\tg.reinit();\n\t\t\thideButtons(this);\n\t\t}", "function returnToMainScreen() {\n if ($percCookieSiteTable.fnClearTa...
[ "0.67482495", "0.6699082", "0.6660728", "0.6550878", "0.65465856", "0.6352044", "0.6343993", "0.63207364", "0.6277618", "0.6265979", "0.62357175", "0.62261075", "0.6195478", "0.6177384", "0.6171302", "0.6151509", "0.61433786", "0.61221397", "0.61042374", "0.6079717", "0.60761...
0.0
-1
Restores select box and checkbox state using the preferences stored in chrome.storage.
function restore_options() { chrome.storage.local.get(['ProgramDate','TicketNumber','ProgramSit'], items => { if (items) { document.getElementById('ProgramDate').value = items.ProgramDate; document.getElementById('ProgramSit').value = items.ProgramSit; document.getElementById('TicketNumber').selectedIndex = items.TicketNumber; } }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function restore_options() {\n $('#options-list input[type=\"checkbox\"]').each(function() {\n var obj = {};\n var check = $(this);\n obj[$(this).attr('id')] = 1;\n chrome.storage.sync.get(obj,\n function(item) {\n $(\"#\" + check.attr('id')).prop(\"checked\", item[check.attr('id')]);\n ...
[ "0.81281155", "0.7955713", "0.7952621", "0.7951413", "0.7809719", "0.78082615", "0.7783867", "0.778071", "0.7736011", "0.76893526", "0.7679347", "0.76774985", "0.7668797", "0.7656839", "0.76450133", "0.76443267", "0.7636669", "0.76314485", "0.76293397", "0.7624497", "0.760011...
0.71544766
57
? Slightly unsure what componentDidMount does but the login within states that if the localstorage item "InstagramUsername is not null then it sets the loggedIn state to true.
componentDidMount() { console.log('Local storage: ', localStorage.getItem('InstagramUsername')); if (localStorage.getItem('InstagramUsername') !== null) { this.setState({ loggedIn: true }); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "componentDidMount() {\n if (localStorage.getItem(\"username\")) {\n this.setState({\n loggedIn: true\n });\n }\n }", "componentDidMount() {\n const loggedinUser = localStorage.getItem('user');\n if (loggedinUser) {\n const foundUser = JSON.parse(loggedinUser)\n ...
[ "0.8137776", "0.7863055", "0.77652735", "0.76302534", "0.7619947", "0.7585621", "0.7585155", "0.754558", "0.75434893", "0.75077903", "0.7450265", "0.739251", "0.7340621", "0.733691", "0.7334462", "0.73220026", "0.72790533", "0.72748995", "0.7248442", "0.7228316", "0.7182825",...
0.8776838
0
This render if statement asks if this.state.loggedIn is true or not if it is true, we'll return to the App component. If it isn't true then we'll be redirected to the Login component.
render() { let output = this.state.loggedIn ? <App /> : <Login />; return output; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "render() {\n if(this.state.isLoggedIn){\n return <HomePage/>\n }\n else{\n return <Login/>\n }\n }", "checkLoginState() {\n if (this.state.loggedIn === 1) return <HomePageRouter />;\n else return <AuthPageRouter />;\n }", "render() {\n if (this...
[ "0.7644102", "0.7482524", "0.7387048", "0.7373826", "0.7294971", "0.7215456", "0.7190083", "0.6951658", "0.695033", "0.6878216", "0.684731", "0.68447506", "0.6838123", "0.67867166", "0.6775981", "0.67657447", "0.6748171", "0.6745615", "0.6698352", "0.6674586", "0.66703814", ...
0.7722254
0
generations numbers for captcha and drop one instance at the start
function randCapNumber(){ randCapNumber01 = 10; randCapNumber02 = Math.floor(Math.random() * Math.floor(10)); randCapNumberResult = randCapNumber01 + randCapNumber02; document.getElementById('form-captcha-eco-txt').textContent = randCapNumber01 + ' + ' + randCapNumber02 + ' = '; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "resetCaptcha() { this.captchaCounter = 0; }", "function generateCaptcha() {\n captchaCode = \"\";\n for (let i = 0; i < 6; i++) {\n captchaCode += values.charAt(Math.floor(Math.random() * values.length));\n }\n captcha.innerHTML = captchaCode;\n }", "function captcha_h...
[ "0.67751664", "0.6757209", "0.64839983", "0.6287672", "0.6248516", "0.62112486", "0.61993325", "0.61611754", "0.6110522", "0.60537636", "0.6049405", "0.6045157", "0.60397494", "0.60329205", "0.59956354", "0.5972444", "0.5970642", "0.5938897", "0.5930704", "0.5930704", "0.5928...
0.5800058
39
GET Return all items on the menu. URL /menu
function allItems(req, res){ FoodItem.find({}, function (err, menu) { if (err) throw err; return res.send(menu); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getList() {\n return request(`/WebApi/menu/getlist`);\n}", "function getMenu(){\n let request = new XMLHttpRequest();\n request.open('GET', 'http://tiy-28202.herokuapp.com/menu');\n request.addEventListener('load', function(){\n\n let response = JSON.parse(request.responseText);\n\n ...
[ "0.76360285", "0.6932435", "0.6851444", "0.6839813", "0.67693645", "0.6753002", "0.6744113", "0.671442", "0.65836054", "0.6551686", "0.6540947", "0.653995", "0.64922845", "0.64846337", "0.6433405", "0.6398082", "0.63441795", "0.6322692", "0.63175803", "0.6310467", "0.6271565"...
0.67387635
7
GET Return user with specified email.
function logIn(req, res){ if(req.query.email === undefined) { return res.send("Error: email undefined"); } User.findOne({'email': req.query.email}, function (err, user) { if (err) throw err; if(user === null) { return res.send("Error: No such user exists"); } return res.json(user); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getUserByEmail(req, res, next){\n userModel.getUserByEmail(req.query.email)\n .then(function(data){\n res.send({ data })\n })\n .catch(next)\n}", "function retrieveUserByEmail(email, callback) {\n retrieveUserByQuery({\"email\": email}, callback);\n}", "async getByEmail( email ) {\n /* At...
[ "0.8389809", "0.832679", "0.80966794", "0.8008486", "0.79458034", "0.79308975", "0.7920499", "0.79066", "0.78971064", "0.7845125", "0.7843661", "0.7791823", "0.7700516", "0.7647125", "0.7623434", "0.75642896", "0.7531614", "0.7517627", "0.7512524", "0.7508857", "0.748852", ...
0.6704371
58
POST Store information of new user and return this user. URL /signUp
function signUp(req, res) { if(req.body.email === undefined) { return res.send("Error: no info"); } var newUser = new User(req.body); newUser.save(function(err, newUser) { if (err) throw err; return res.json(newUser); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "signup() {\n\t\tconst URIs = AccountRouter.getURIs();\n\t\tthis.router.post(URIs.signup, (request, response) => {\n\t\t\tconst username = request.body.username,\n\t\t\t\t\t\tpassword = request.body.password;\n\n\t\t\t// Preventing send request to firebase, if you information is not valid.\n\t\t\tif (!username || !...
[ "0.7757477", "0.7745469", "0.7713919", "0.75551194", "0.744195", "0.74375826", "0.74288493", "0.74237806", "0.74120575", "0.7401132", "0.7392589", "0.7389565", "0.73698896", "0.73472786", "0.7292082", "0.7260528", "0.7257563", "0.7233336", "0.72326493", "0.72141284", "0.72141...
0.77308553
2
POST Store new information about existing user. URL /updateProfile
function updateUserProfile(req, res) { if(req.body.userID === undefined){ return res.send("Error: no user specified"); } User.findById(req.body.userID, function (err, user) { if (err) throw err; if(user === null) { return res.send("Error: No such User exists"); } user.name = req.body.name; user.email = req.body.email; user.phone = req.body.phone; user.address = req.body.address; user.password = req.body.password; user.save(function(err) { if (err) throw err; return res.send('Success'); }); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function updateProfile(profile) {\n checkUser();\n UserId = userId;\n $.ajax({\n method: \"PUT\",\n url: \"/api/profile_data\",\n data: profile\n })\n .then(function () {\n window.location.href = \"/members\";\n });\n }", "updateProfile() {}", "function updateProfil...
[ "0.76180446", "0.7392023", "0.7297582", "0.7172985", "0.7080161", "0.70665884", "0.70493174", "0.7021343", "0.7015097", "0.6992569", "0.6958347", "0.6945055", "0.6938772", "0.6929013", "0.69176364", "0.68938655", "0.6864781", "0.6863834", "0.68552345", "0.6788788", "0.6766140...
0.65665466
29
GET Return all the customer users' userId, name, and email. URL /customers
function getCustomers(req, res) { var answer = []; User.find({}, function(err, users) { if (err) throw err; for(var i = 0; i<users.length; i++) { if(!users[i].admin) { answer.push({userId: users[i]._id, name: users[i].name, email: users[i].email}); } } return res.json(answer); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "list() {\n return this.iugu.makePagedRequest('GET', '/customers');\n }", "fetchSpecificCustomers(id) {\r\n return Api().get('/customers/' + id)\r\n }", "function getCustomerList() {\n\t// TODO: add logic to call backend system\n\n\n}", "function getCustomers() {\n console.log('8');\n $.ge...
[ "0.7320257", "0.69984657", "0.69642913", "0.69195944", "0.6819917", "0.6808778", "0.67777574", "0.6683724", "0.6607724", "0.6588683", "0.65830487", "0.65676874", "0.655043", "0.65014905", "0.6461242", "0.6438895", "0.6412948", "0.6408919", "0.6408402", "0.6404305", "0.6385692...
0.72981346
1
GET Return all user profiles. URL /users
function getAllUsers(req, res) { User.find({}, function(err, users) { if (err) throw err; return res.json(users); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getUsers() {\n\treturn fetch(userURL).then((resp) => resp.json())\n}", "function getUsers() {\n fetch(userUrl)\n .then((res) => res.json())\n .then((users) => {\n sortUsers(users);\n displayLeaderBoard();\n })\n .catch((error) => console.error(\"ERROR:\", error));\n ...
[ "0.7722814", "0.7474676", "0.7435822", "0.7390101", "0.73360544", "0.72865766", "0.7282433", "0.7218146", "0.72164947", "0.7212999", "0.7192372", "0.7157336", "0.7095448", "0.70819956", "0.7079369", "0.7073217", "0.7067096", "0.70565957", "0.70350635", "0.70315516", "0.701987...
0.6823957
43
Customer requests POST Store an order placed by a customer and return it. URL /order
function placeOrder(req, res) { if(req.body.userEmail === undefined) { return res.send("Error: no order"); } var order = req.body; var newOrder = new Order(order); newOrder.save(function(err, newOrder) { if (err) throw err; return res.send(newOrder); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function submitSupplierOrder() {\n fetch(`http://localhost:8080/api/purchase/delivered/${purchaseNumber}`, {\n method: 'POST',\n headers: {'Authorization': `bearer ${localStorage.getItem('access_token')}`,\n 'Content-Type': 'application/json'}\n ...
[ "0.6862449", "0.6651266", "0.6630495", "0.6623059", "0.6510041", "0.6503385", "0.64139044", "0.635112", "0.6335595", "0.6322463", "0.63082063", "0.6299259", "0.6253828", "0.62399375", "0.6195363", "0.6194983", "0.61708665", "0.61563486", "0.6151442", "0.61227113", "0.6099231"...
0.5922058
40
GET Return the five most recent orders of the specified customer.
function getOrders(req, res) { var answer = []; if(req.query.email === undefined) { return res.send("Error: no email specified"); } Order.find({userEmail: req.query.email}, function(err, orders) { if (err) throw err; orders.sort(compare); if(orders.length <= 5) { answer.push({orders: orders}); } else { answer.push({orders: orders.slice(0,6)}); } return res.json(answer); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getOrdersByCustomers(cust) {\n $.ajax({\n url: \"/Customer/Orders/\" + cust.CustomerId,\n type:\"GET\"\n }).done(function (resp) {\n self.Orders(resp);\n }).error(function (err) {\n self.ErrorMessage(\"Error! \" +...
[ "0.61811715", "0.58491164", "0.551831", "0.5447577", "0.5437496", "0.54115814", "0.53614295", "0.5327838", "0.5326991", "0.5278611", "0.5277923", "0.5269265", "0.5227563", "0.5188624", "0.5156632", "0.51194364", "0.5113826", "0.5099569", "0.5098474", "0.5093305", "0.5081831",...
0.5774267
2
GET Return the order status of the specified order. URL /status?orderID=584342b42f98df8965985b69
function getOrderStatus(req, res) { if(req.query.orderID === undefined) { return res.send("Error: orderID undefined"); } Order.findOne({_id: req.query.orderID}, function(err, order) { if (err) throw err; return res.send(order.status); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "getOrderStatus(orderId) {\n return __awaiter(this, void 0, void 0, function* () {\n let response = yield request({\n method: 'get',\n json: true,\n uri: `${this.EFoodAPIOrigin}/api/v1/order/status/${orderId}/`,\n headers: { 'x-core-sessi...
[ "0.77244294", "0.70756054", "0.6543379", "0.65101004", "0.6164444", "0.6100166", "0.6081409", "0.60803556", "0.6078036", "0.6032109", "0.5950874", "0.5931992", "0.583974", "0.5837124", "0.58181816", "0.5800978", "0.57797563", "0.5718791", "0.569007", "0.56722325", "0.5647904"...
0.8065022
0
Admin requests GET Return all customer orders that have been placed but not delivered. URL /activeOrders
function getActiveOrders(req, res) { Order.find({status: { $in: activeStatus}}, function(err, orders) { if (err) throw err; return res.json(orders); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function adminOrdersFetchCall() {\n return request('get', urls.ADMIN_ORDER_URL);\n}", "static async listCurrentOrders() {\n const query = `\n SELECT order.id AS \"orId\",\n order.customer_id AS \"cusId\",\n order.delivery_address AS \"addy\"\n FROM orders\n ...
[ "0.6732341", "0.6476649", "0.6447403", "0.6374412", "0.63644636", "0.63600934", "0.63565886", "0.6307102", "0.62942594", "0.6257828", "0.621339", "0.6211291", "0.61896956", "0.6077949", "0.6066741", "0.60649157", "0.60630685", "0.60585505", "0.6005015", "0.59920233", "0.59844...
0.7574684
0
POST Store the new order status for a specific order. URL /orderStatus
function updateOrderStatus(req, res) { if(req.body.orderID === undefined) { return res.send("Error: no orderID specified"); } Order.findOne({_id: req.body.orderID}, function(err, order) { if (err) throw err; if(order === null){ return res.send("Error: no such order exists"); } order.status = req.body.status; order.save(function(err, order) { if (err) throw err; return res.json("Success"); }); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "placeOrder() {\n // add item to statuses and store as status \"in progress\"\n console.log(\"Your order is ready.\");\n }", "savePurchaseOrder(purchaseOrder) {\n\n purchaseOrder.status = PURCHASE_ORDER_STATUS_IN_PROGRESS;\n this.updatePurchaseOrder(purchaseOrder);\n\n }", "function upda...
[ "0.65965843", "0.63118184", "0.6147358", "0.59851485", "0.59711236", "0.59115696", "0.5888942", "0.57751507", "0.5727981", "0.5726496", "0.5698549", "0.5656904", "0.5646944", "0.5643262", "0.55878913", "0.5584915", "0.5542042", "0.55406237", "0.5510089", "0.5474984", "0.54523...
0.6920921
0
POST Store new menu item and return it. URL /menu
function addMenuItem(req, res) { var newItem = new FoodItem(req.body); console.log(newItem); newItem.save(function(err, newItem) { if (err) throw err; return res.json(newItem); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "insertNewMenu(){\n\t\tfetch(\"/reactui/menu\", {\n method: 'POST',\n\t\t\theaders: {\n\t\t\t\t'Accept': 'application/json',\n\t\t\t\t'Content-Type': 'application/json'\n\t\t\t},\n\t\t\tbody: JSON.stringify(this.state.newMenu)\n }).then((resp) => {\n\t\t\treturn resp;\n\t\t}).then((respMessage) =>...
[ "0.76003313", "0.70412725", "0.6812183", "0.6765626", "0.67256147", "0.6705598", "0.66559154", "0.64652056", "0.64190185", "0.6384572", "0.63171047", "0.63049644", "0.62860453", "0.62209165", "0.62006783", "0.6073996", "0.605232", "0.6038891", "0.6031468", "0.600662", "0.5994...
0.7081679
1
DELETE Remove specified menu item from database. URL /menu
function deleteMenuItem(req, res) { FoodItem.findOne({_id: req.body.itemID}, function(err, item) { if (err) throw err; if(item === null) { return res.send("Error: no such item"); } item.remove(function(err) { if (err) throw err; return res.send("Success"); }); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function removeMenu(id){\n return db('menu')\n .where({ id })\n .del()\n}", "function menuBorrar(req, res) {\n const idParams = req.params.id;\n errorParams(idParams, res);\n Menu.findByIdAndRemove(idParams).exec((err, respDB) => {\n errorBD(err, respDB,res);\n res.status(200).json({\n ok:...
[ "0.7927207", "0.7103373", "0.6887212", "0.6881293", "0.6808459", "0.6805908", "0.671129", "0.6667769", "0.666174", "0.66494745", "0.6569481", "0.6563609", "0.6555546", "0.6538083", "0.65164757", "0.651534", "0.6506378", "0.6495212", "0.64711535", "0.64637095", "0.6455055", ...
0.78458667
1
DELETE Remove specified user item from database. URL /menu
function deleteUser(req, res) { User.findOne({_id: req.body.userID}, function(err, user) { if (err) throw err; if(user === null) { return res.send("Error: no such user"); } user.remove(function(err) { if (err) throw err; return res.send("Success"); }); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function deleteMenuItem(req, res) {\n FoodItem.findOne({_id: req.body.itemID}, function(err, item) {\n if (err) throw err;\n if(item === null) {\n return res.send(\"Error: no such item\");\n }\n item.remove(function(err) {\n if (err) throw err;\n retu...
[ "0.74909675", "0.72359264", "0.7068487", "0.703827", "0.702809", "0.70170057", "0.6904976", "0.68746", "0.68545276", "0.6839773", "0.67948455", "0.6786218", "0.6783019", "0.67764187", "0.67733127", "0.67151403", "0.6712362", "0.6699098", "0.66940165", "0.66897833", "0.6689306...
0.6367443
71
Helper function to sort orders by date
function compare(a,b) { if (a.orderDate < b.orderDate) return -1; if (a.orderDate > b.orderDate) return 1; return 0; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function sortListsByDate() {\r\n\t\treturn getItems().sort(function(a,b){\r\n \t\t\treturn new Date(`${a.date} ${a.time}`) - new Date(`${b.date} ${b.time}`);\r\n\t\t});\r\n\t}", "function SortByDate(array) {\n return _.sortBy(array, function (item) {\n return moment(item...
[ "0.74435717", "0.72798216", "0.7182733", "0.71798486", "0.70433754", "0.6985355", "0.69797987", "0.69391465", "0.69140655", "0.69080395", "0.68638176", "0.6858557", "0.6846499", "0.6805774", "0.6793244", "0.67629945", "0.67406315", "0.66957676", "0.667165", "0.6640186", "0.66...
0.6743062
16
These helpers produce better VM code in JS engines due to their explicitness and function inlining.
function isUndef (v) { return v === undefined || v === null }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function makeJITCompiledFunction() {\n\tfunction target(x) {\n\t\treturn x;\n\t}\n\tfor (var i = 0; i < 1000; i++) {\n\t\ttarget(i);\n\t}\n\treturn target;\n}", "function Module() {\n \"use asm\";\n\n function d0() {\n do { } while(false);\n return 110;\n }\n\n function d1() {\n do { return 111; } w...
[ "0.6199141", "0.6115816", "0.5916578", "0.57993305", "0.5634627", "0.56060207", "0.5537418", "0.55157775", "0.5500454", "0.5500454", "0.5494032", "0.54618603", "0.5435869", "0.54118556", "0.5394844", "0.538355", "0.53820723", "0.53579617", "0.53484744", "0.5347413", "0.533606...
0.0
-1
Check if value is primitive.
function isPrimitive (value) { return ( typeof value === 'string' || typeof value === 'number' || // $flow-disable-line typeof value === 'symbol' || typeof value === 'boolean' ) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function primitive (value) {\n\t var type = typeof value;\n\t return type === 'number' ||\n\t type === 'boolean' ||\n\t type === 'string' ||\n\t type === 'symbol'\n\t}", "function isPrimitive(value){return typeof value==='string'||typeof value==='number'||typeof value==='boolean';}", "function isPrimitive...
[ "0.84274745", "0.8343144", "0.8343144", "0.8342192", "0.8301743", "0.8285709", "0.82844144", "0.8261427", "0.8261427", "0.8261427", "0.8261427", "0.8261427", "0.8261427", "0.8261427", "0.8261427", "0.8247974", "0.8247974", "0.8247974", "0.8247974", "0.82411116", "0.8223359", ...
0.0
-1
Quick object check this is primarily used to tell Objects from primitive values when we know the value is a JSONcompliant type.
function isObject (obj) { return obj !== null && typeof obj === 'object' }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "#isPrimitive(value) {\n return value !== Object(value); \n }", "function isValueObject(obj) {\n\treturn (obj instanceof Number) || (obj instanceof String) || (obj instanceof Boolean) || (obj === null);\n}", "function isPrimitiveType (obj) {\r\n return ( typeof obj === 'boolean' ||\r\n typeof o...
[ "0.72089636", "0.70473754", "0.69155014", "0.690904", "0.6898181", "0.6771583", "0.6720692", "0.67112875", "0.6701554", "0.67009985", "0.67009985", "0.67009985", "0.67009985", "0.67009985", "0.67009985", "0.67009985", "0.67009985", "0.67009985", "0.67009985", "0.67009985", "0...
0.0
-1
Strict object type check. Only returns true for plain JavaScript objects.
function isPlainObject (obj) { return _toString.call(obj) === '[object Object]' }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "isPlainObject(obj) {\n return _toString.call(obj) === '[object Object]'\n }", "function isPlainObject(obj){return _toString.call(obj)==='[object Object]';}", "function isPlainObject(obj){return _toString.call(obj)==='[object Object]';}", "function isPlainObject(obj){\n \tif (obj.constructor.name===\"Obj...
[ "0.75358397", "0.7523835", "0.7523835", "0.7520325", "0.74303263", "0.7412724", "0.7400782", "0.7400782", "0.7400782", "0.7400782", "0.740051", "0.740051", "0.73875743", "0.73812795", "0.73768944", "0.73717374", "0.73717374", "0.73717374", "0.73717374", "0.73717374", "0.73708...
0.0
-1
Check if val is a valid array index.
function isValidArrayIndex (val) { var n = parseFloat(String(val)); return n >= 0 && Math.floor(n) === n && isFinite(val) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function isValidArrayIndex(val) {\n var n = parseFloat(String(val));\n return n >= 0 && Math.floor(n) === n && isFinite(val)\n }", "function isValidArrayIndex(val) {\n var n = parseFloat(String(val));\n return n >= 0 && Math.floor(n) === n && isFinite(val)\n }", "function isVa...
[ "0.81624454", "0.81624454", "0.81346345", "0.8101839", "0.8096607", "0.8096607", "0.8096607", "0.8052123", "0.80390686", "0.80390686", "0.80390686", "0.80390686", "0.80107343", "0.80107343", "0.80107343", "0.80107343", "0.80107343", "0.80107343", "0.80107343", "0.80107343", "...
0.0
-1
Convert a value to a string that is actually rendered.
function toString (val) { return val == null ? '' : Array.isArray(val) || (isPlainObject(val) && val.toString === _toString) ? JSON.stringify(val, null, 2) : String(val) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function renderStringify(value) {\n if (typeof value === 'string')\n return value;\n if (value == null)\n return '';\n return '' + value;\n}", "function valueToHTML(value) {\n var valueType = typeof value;\n\n var output = \"\";\n if (value == null) {\n outp...
[ "0.75840807", "0.73503274", "0.7298674", "0.7298674", "0.7298674", "0.7298674", "0.7298674", "0.7298674", "0.7298674", "0.7298674", "0.7298674", "0.7298674", "0.7298674", "0.7298674", "0.7298674", "0.7298674", "0.7288216", "0.7267222", "0.72589314", "0.7192036", "0.7168452", ...
0.0
-1
Convert an input value to a number for persistence. If the conversion fails, return original string.
function toNumber (val) { var n = parseFloat(val); return isNaN(n) ? val : n }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function toNumber(value) {\n if (hasValue(value) && !isNumber(value)) {\n var converted = Number(value);\n if (isNaN(converted) && isString(value) && value != \"\") {\n return toNumber(value.replace(/[^0-9.\\-]+/g, ''));\n }\n return converted;\n }\n return value;\n}...
[ "0.6727598", "0.66358066", "0.6380881", "0.6346358", "0.6346358", "0.6346358", "0.63408524", "0.628258", "0.628258", "0.628258", "0.628258", "0.628258", "0.62780374", "0.6276392", "0.6276392", "0.6276392", "0.6276392", "0.62703866", "0.6244077", "0.62287104", "0.6223957", "...
0.0
-1
Make a map and return a function for checking if a key is in that map.
function makeMap ( str, expectsLowerCase ) { var map = Object.create(null); var list = str.split(','); for (var i = 0; i < list.length; i++) { map[list[i]] = true; } return expectsLowerCase ? function (val) { return map[val.toLowerCase()]; } : function (val) { return map[val]; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async has(key) {}", "has (key, strict = true) {\n if (!strict) {\n return [...this.keys()].some((_key) => {\n return isEqual(key, _key);\n });\n }\n return Map.prototype.has.call(this, key);\n }", "has(key) {\n return this.map[key] !== ...
[ "0.6155837", "0.6006893", "0.599867", "0.5865757", "0.58059657", "0.5792026", "0.5769131", "0.5655304", "0.5596331", "0.55634475", "0.5560054", "0.55427426", "0.5535011", "0.55316114", "0.55316114", "0.55205566", "0.5517831", "0.54922557", "0.54636514", "0.54543024", "0.54436...
0.0
-1
Remove an item from an array.
function remove (arr, item) { if (arr.length) { var index = arr.indexOf(item); if (index > -1) { return arr.splice(index, 1) } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function remove(arr, item){\n\t var idx = indexOf(arr, item);\n\t if (idx !== -1) arr.splice(idx, 1);\n\t }", "function removeArrayItem(arr, item) {\n var i = arr.indexOf(item);\n if (i >= 0) arr.splice(i, 1);\n}", "function remove(arr, item){\n var idx = indexOf(arr, item);\n ...
[ "0.8166234", "0.81469136", "0.8104021", "0.80995995", "0.80834365", "0.80760545", "0.8009832", "0.79711485", "0.79691595", "0.79218113", "0.7921071", "0.7921071", "0.7898776", "0.7898776", "0.7898776", "0.7891583", "0.7883409", "0.7883409", "0.7883409", "0.7883409", "0.788340...
0.0
-1
Create a cached version of a pure function.
function cached (fn) { var cache = Object.create(null); return (function cachedFn (str) { var hit = cache[str]; return hit || (cache[str] = fn(str)) }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function cached(fn){var cache=Object.create(null);return function cachedFn(str){var hit=cache[str];return hit||(cache[str]=fn(str));};}", "function cached(fn){var cache=Object.create(null);return function cachedFn(str){var hit=cache[str];return hit||(cache[str]=fn(str));};}", "function cached(fn){var cache=Obj...
[ "0.6953703", "0.6953703", "0.6953703", "0.68957925", "0.6889733", "0.6865773", "0.6865773", "0.68357754", "0.68357754", "0.68357754", "0.68357754", "0.68357754", "0.68357754", "0.68357754", "0.68357754", "0.68357754", "0.68357754", "0.68357754", "0.68357754", "0.68357754", "0...
0.0
-1
Simple bind polyfill for environments that do not support it, e.g., PhantomJS 1.x. Technically, we don't need this anymore since native bind is now performant enough in most browsers. But removing it would mean breaking code that was able to run in PhantomJS 1.x, so this must be kept for backward compatibility. / istanbul ignore next
function polyfillBind (fn, ctx) { function boundFn (a) { var l = arguments.length; return l ? l > 1 ? fn.apply(ctx, arguments) : fn.call(ctx, a) : fn.call(ctx) } boundFn._length = fn.length; return boundFn }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function bind_shim() {\n\n if (!Function.prototype.bind) {\n\n Function.prototype.bind = function(oThis) {\n\n if (typeof this !== \"function\") {\n // closest thing possible to the ECMAScript 5 internal IsCallable function\n throw new TypeError(\n \"Function.prototype.bind - what...
[ "0.80943835", "0.7982001", "0.7982001", "0.7982001", "0.7982001", "0.7982001", "0.7982001", "0.7982001" ]
0.79805964
96
Convert an Arraylike object to a real Array.
function toArray (list, start) { start = start || 0; var i = list.length - start; var ret = new Array(i); while (i--) { ret[i] = list[i + start]; } return ret }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function convertArray( array, type, forceClone ) {\n\n\tif ( ! array || // let 'undefined' and 'null' pass\n\t\t! forceClone && array.constructor === type ) return array;\n\n\tif ( typeof type.BYTES_PER_ELEMENT === 'number' ) {\n\n\t\treturn new type( array ); // create typed array\n\n\t}\n\n\treturn Array.prototy...
[ "0.73040587", "0.7301542", "0.72855735", "0.7278617", "0.72582656", "0.7179821", "0.7134585", "0.71301657", "0.71301657", "0.7129415", "0.7129415", "0.7129415", "0.7129415", "0.7129415", "0.7129415", "0.7129415", "0.7129415", "0.7129415", "0.70944196", "0.708892", "0.70535296...
0.0
-1
Mix properties into target object.
function extend (to, _from) { for (var key in _from) { to[key] = _from[key]; } return to }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function fillProperties(target,source){for(var key in source){if(source.hasOwnProperty(key)&&!target.hasOwnProperty(key)){target[key]=source[key]}}}", "function fillProperties(target,source){for(var key in source){if(source.hasOwnProperty(key)&&!target.hasOwnProperty(key)){target[key]=source[key];}}}", "functi...
[ "0.73263377", "0.73095685", "0.7214008", "0.71767485", "0.71767485", "0.71767485", "0.70545983", "0.7018322", "0.7018322", "0.7018322", "0.7018322", "0.7012555", "0.7012555", "0.7012555", "0.7012555", "0.7012555", "0.7012555", "0.7012555", "0.7012555", "0.7012555", "0.6934832...
0.0
-1
Merge an Array of Objects into a single Object.
function toObject (arr) { var res = {}; for (var i = 0; i < arr.length; i++) { if (arr[i]) { extend(res, arr[i]); } } return res }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function bs_arrayMerge(obj1, obj2) {\n if (!bs_isObject(obj1) || !bs_isObject(obj2)) return false;\n for (var key in obj2) {obj1[key] = obj2[key];}\n return obj1;\n}", "function merge (...params) {\n // check if all are objects\n let l = params.length\n for (l; l > 0; l--) {\n const item = params[l - 1]...
[ "0.6403391", "0.6156235", "0.6079095", "0.6032048", "0.60072684", "0.59575105", "0.5937284", "0.58723676", "0.58459294", "0.58373743", "0.58365333", "0.5809302", "0.5792909", "0.57778853", "0.5776126", "0.5776126", "0.5775512", "0.5766381", "0.5766381", "0.57541186", "0.57425...
0.0
-1
eslintdisable nounusedvars Perform no operation. Stubbing args to make Flow happy without leaving useless transpiled code with ...rest (
function noop (a, b, c) {}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function args() {\n\n}", "function SimpleArgs() {\r\n}", "function noArgs() {\n console.log(\"hi\")\n}", "static noop(...args) {\n if (false) {\n console.log(args);\n }\n }", "function test () {\n return arguments\n}", "function noop() {\n var args = [];\n\n for (var _i = 0; _i < argu...
[ "0.64363354", "0.62372154", "0.6230678", "0.61126035", "0.6091667", "0.60616624", "0.60191685", "0.59530616", "0.59392995", "0.59003824", "0.59003824", "0.57666", "0.5746728", "0.57382596", "0.5722161", "0.5704264", "0.5690031", "0.56822973", "0.5679003", "0.56340325", "0.563...
0.0
-1