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
Initializes the fields of this object. This method is used by the constructors of any subclasses, in order to implement multiple inheritance (mixins). Only for internal use.
static initialize(obj, name, expression) { obj['name'] = name; obj['expression'] = expression; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "constructor() {\n super();\n this._init();\n }", "init() {\n this._super(...arguments);\n this._applyDefaults();\n }", "_init() {\n\t\tthis.life.init();\n\t\tthis.render.init();\n\n\t\tthis.emission.init();\n\t\tthis.trail.init(this.node);\n\n\t\tthis.color.init();\n\t}", "function Co...
[ "0.71298605", "0.6962414", "0.6812148", "0.6745229", "0.67139006", "0.6640839", "0.6633109", "0.66000056", "0.6578991", "0.6562441", "0.6408217", "0.6406366", "0.633336", "0.63027614", "0.62955034", "0.6282292", "0.6267246", "0.6239798", "0.6239771", "0.6233473", "0.62325084"...
0.0
-1
Render an item or a loading indicator.
redirectProfile(id) { this.props.onHide(); if (this.props.hideMenuResponsive) { this.props.hideMenuResponsive(); } this.props.history.push(`/profile/${id}`); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "renderLoadingIcon() {}", "renderItem(item) { return item; }", "render() {\n return (\n myutils.renderLoadingstate()\n );\n }", "render(){\n return (this.data.dataLoaded) ? this.getContent() : <div><Loader /></div>\n }", "render() {\n const status = this.props.status;\n\n if(st...
[ "0.6628623", "0.6500926", "0.6446487", "0.63982755", "0.6300878", "0.62708443", "0.62683684", "0.6255546", "0.61899537", "0.60888016", "0.6083155", "0.6069514", "0.6057844", "0.6037624", "0.6029985", "0.59973603", "0.597888", "0.5959829", "0.5953864", "0.5953864", "0.5953864"...
0.0
-1
Defines the Zimlet handler class.
function ZmCloudChatZimlet() { }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "constructor () {\n this.handlers = {\n ls: {\n handlerFunc: (protocol, conn) => lsHandler(this, conn),\n matchFunc: matchExact\n\n }\n }\n this.log = util.log.listener()\n }", "constructor () {\n this.handlers = {\n ls: {\n handlerFunc: (protocol, conn) => lsHandl...
[ "0.6205745", "0.6205745", "0.6189626", "0.6189626", "0.6189626", "0.6189626", "0.6189626", "0.6189626", "0.6189626", "0.6189626", "0.6189626", "0.6189626", "0.6189626", "0.6151117", "0.6105445", "0.6003223", "0.5819732", "0.5813231", "0.5670339", "0.56441385", "0.5626883", ...
0.5126239
42
Async / await does not work in a pipeline ?!
async asyncRun (input) { this.logToFile(input, 'raw-input.jsonl'); this.logger.info('PlaceNameEntity.run() !'); return this.placenameEntity(input); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async function test() {}", "async method(){}", "async function syncPipeline() {\n await generateAllowance();\n // await confirmPendingBookings();\n // the server-side script does this now\n await updateContactList();\n await updateTourList();\n}", "async function miFuncionConPromesa ()\r\n{\r\n retur...
[ "0.6646525", "0.6307582", "0.6253026", "0.62198764", "0.6107784", "0.6057227", "0.60174423", "0.6006216", "0.6004953", "0.6002591", "0.5940146", "0.5937797", "0.592851", "0.5920989", "0.5897067", "0.5897067", "0.58855635", "0.5878823", "0.5876359", "0.58659154", "0.5848694", ...
0.0
-1
Returns true if we are using a material other than the default materials
_hasUserMaterial() { return !!this._materialAsset || (!!this._material && this._system.defaultImageMaterials.indexOf(this._material) === -1); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "canBeRendering() {\n return (this.geometry !== undefined) && (this.material !== undefined);\n }", "function isMaterialExisting(tableModel, matNo) {\n\tvar isExisting = false;\n\tvar tabModelData = null; \n\tif(typeof tableModel != 'undefined') {\n\t\ttabModelData = tableModel.oData.modelData;\n\t\t\n\t...
[ "0.69040686", "0.6559864", "0.6313853", "0.6215873", "0.62087506", "0.61854833", "0.60936", "0.6083612", "0.6083612", "0.6068246", "0.6061012", "0.59653807", "0.59463406", "0.59379447", "0.5936193", "0.59361637", "0.58801824", "0.5841089", "0.58383334", "0.5836986", "0.583424...
0.767264
0
build a quad for the image
_createMesh() { var element = this._element; var w = element.calculatedWidth; var h = element.calculatedHeight; var r = this._rect; // Note that when creating a typed array, it's initialized to zeros. // Allocate memory for 4 vertices, 8 floats per vertex, 4 bytes per float. var vertexData = new ArrayBuffer(4 * 8 * 4); var vertexDataF32 = new Float32Array(vertexData); // Vertex layout is: PX, PY, PZ, NX, NY, NZ, U, V // Since the memory is zeroed, we will only set non-zero elements // POS: 0, 0, 0 vertexDataF32[5] = 1; // NZ vertexDataF32[6] = r.x; // U vertexDataF32[7] = r.y; // V // POS: w, 0, 0 vertexDataF32[8] = w; // PX vertexDataF32[13] = 1; // NZ vertexDataF32[14] = r.x + r.z; // U vertexDataF32[15] = r.y; // V // POS: w, h, 0 vertexDataF32[16] = w; // PX vertexDataF32[17] = h; // PY vertexDataF32[21] = 1; // NZ vertexDataF32[22] = r.x + r.z; // U vertexDataF32[23] = r.y + r.w; // V // POS: 0, h, 0 vertexDataF32[25] = h; // PY vertexDataF32[29] = 1; // NZ vertexDataF32[30] = r.x; // U vertexDataF32[31] = r.y + r.w; // V var vertexDesc = [ { semantic: SEMANTIC_POSITION, components: 3, type: TYPE_FLOAT32 }, { semantic: SEMANTIC_NORMAL, components: 3, type: TYPE_FLOAT32 }, { semantic: SEMANTIC_TEXCOORD0, components: 2, type: TYPE_FLOAT32 } ]; var device = this._system.app.graphicsDevice; var vertexFormat = new VertexFormat(device, vertexDesc); var vertexBuffer = new VertexBuffer(device, vertexFormat, 4, BUFFER_STATIC, vertexData); var mesh = new Mesh(device); mesh.vertexBuffer = vertexBuffer; mesh.primitive[0].type = PRIMITIVE_TRIFAN; mesh.primitive[0].base = 0; mesh.primitive[0].count = 4; mesh.primitive[0].indexed = false; mesh.aabb.setMinMax(Vec3.ZERO, new Vec3(w, h, 0)); this._updateMesh(mesh); return mesh; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Quad() { return [-1.0, -1.0, 1.0, -1.0, -1.0, 1.0, 1.0, 1.0] }", "function Quad() { return [-1.0, -1.0, 1.0, -1.0, -1.0, 1.0, 1.0, 1.0] }", "function Quad() { return [\n -1.0, -1.0,\n 1.0, -1.0,\n -1.0, 1.0,\n\n -1.0, 1.0,\n 1.0, 1.0,\n 1.0, -1.0]\n }", "function...
[ "0.6825046", "0.6825046", "0.6711603", "0.6711603", "0.64217526", "0.6378096", "0.6345268", "0.6302454", "0.6246773", "0.62303936", "0.6139949", "0.6105729", "0.60577536", "0.59955597", "0.5952175", "0.59469146", "0.5926001", "0.59069014", "0.58490616", "0.5847508", "0.584750...
0.0
-1
Gets the mesh from the sprite asset if the sprite is 9sliced or the default mesh from the image element and calls _updateMesh or sets meshDirty to true if the component is currently being initialized. We need to call _updateSprite every time something related to the sprite asset changes
_updateSprite() { var nineSlice = false; var mesh = null; // take mesh from sprite if (this._sprite && this._sprite.atlas) { mesh = this._sprite.meshes[this.spriteFrame]; nineSlice = this._sprite.renderMode === SPRITE_RENDERMODE_SLICED || this._sprite.renderMode === SPRITE_RENDERMODE_TILED; } // if we use 9 slicing then use that mesh otherwise keep using the default mesh this.mesh = nineSlice ? mesh : this._defaultMesh; if (this.mesh) { if (! this._element._beingInitialized) { this._updateMesh(this.mesh); } else { this._meshDirty = true; } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "get() {\n return this.mesh;\n }", "function SkinnedMeshRendererComponent(gameObject, componentFlyWeight, instanceId) {\n this.type = 'skinned_mesh_renderer';\n this.flyweight = componentFlyWeight;\n this.parent = gameObject;\n this.fields = {\n animation: componentFlyWeight.fields.anim...
[ "0.5459933", "0.5191617", "0.5127821", "0.5072956", "0.50678736", "0.5041422", "0.5038603", "0.50135183", "0.500863", "0.49959624", "0.49847066", "0.4972354", "0.49704602", "0.49560887", "0.4954342", "0.4948348", "0.49439576", "0.4894806", "0.4873033", "0.48665842", "0.481350...
0.7644354
0
updates AABB while 9slicing
_updateAabb(aabb) { aabb.center.set(0, 0, 0); aabb.halfExtents.set(this._outerScale.x * 0.5, this._outerScale.y * 0.5, 0.001); aabb.setFromTransformedAabb(aabb, this._renderable.node.getWorldTransform()); return aabb; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "updateBoundingBox() {\n this._aabb.copy(this.origMeshInstances[0].aabb);\n for (let i = 1; i < this.origMeshInstances.length; i++) {\n this._aabb.add(this.origMeshInstances[i].aabb);\n }\n this.meshInstance.aabb = this._aabb;\n this.meshInstance._aabbVer = 0;\n }", ...
[ "0.6768538", "0.62924093", "0.615536", "0.6018581", "0.5863983", "0.57706106", "0.5750389", "0.5731454", "0.5709351", "0.56993735", "0.56736815", "0.5632526", "0.5618141", "0.5605986", "0.5602015", "0.5586291", "0.5571724", "0.5520573", "0.5518532", "0.5515194", "0.5512441", ...
0.6025642
3
When sprite asset is added bind it
_onSpriteAssetAdded(asset) { this._system.app.assets.off('add:' + asset.id, this._onSpriteAssetAdded, this); if (this._spriteAsset === asset.id) { this._bindSpriteAsset(asset); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "_bindSpriteAsset(asset) {\n if (!this._entity.enabled) return; // don't bind until element is enabled\n\n asset.on(\"load\", this._onSpriteAssetLoad, this);\n asset.on(\"change\", this._onSpriteAssetChange, this);\n asset.on(\"remove\", this._onSpriteAssetRemove, this);\n\n if (a...
[ "0.8133044", "0.72946274", "0.6838729", "0.6798736", "0.66355985", "0.64771205", "0.63804024", "0.62660295", "0.6245194", "0.6195658", "0.6158708", "0.6147098", "0.6118074", "0.6085275", "0.60830593", "0.6072368", "0.60480225", "0.6037227", "0.6022023", "0.6022023", "0.600086...
0.79181755
1
Hook up event handlers on sprite asset
_bindSpriteAsset(asset) { if (!this._entity.enabled) return; // don't bind until element is enabled asset.on("load", this._onSpriteAssetLoad, this); asset.on("change", this._onSpriteAssetChange, this); asset.on("remove", this._onSpriteAssetRemove, this); if (asset.resource) { this._onSpriteAssetLoad(asset); } else { this._system.app.assets.load(asset); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "_onSpriteAssetChange(asset) {\n this._onSpriteAssetLoad(asset);\n }", "_bindSprite(sprite) {\n sprite.on('set:meshes', this._onSpriteMeshesChange, this);\n sprite.on('set:pixelsPerUnit', this._onSpritePpuChange, this);\n sprite.on('set:atlas', this._onAtlasTextureChange, this);\n ...
[ "0.7188668", "0.68213934", "0.6616797", "0.6429807", "0.6048303", "0.60396934", "0.5983057", "0.59444153", "0.5849738", "0.5780771", "0.57693356", "0.57661945", "0.5739805", "0.57180816", "0.57035285", "0.56849486", "0.56849486", "0.56808025", "0.56559086", "0.5645214", "0.56...
0.67075133
2
When sprite asset is loaded make sure the texture atlas asset is loaded too If so then set the sprite, otherwise wait for the atlas to be loaded first
_onSpriteAssetLoad(asset) { if (!asset || !asset.resource) { this.sprite = null; } else { if (!asset.resource.atlas) { var atlasAssetId = asset.data.textureAtlasAsset; if (atlasAssetId) { var assets = this._system.app.assets; assets.off('load:' + atlasAssetId, this._onTextureAtlasLoad, this); assets.once('load:' + atlasAssetId, this._onTextureAtlasLoad, this); } } else { this.sprite = asset.resource; } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "_onTextureAtlasLoad(atlasAsset) {\n var spriteAsset = this._spriteAsset;\n if (spriteAsset instanceof Asset) {\n // TODO: _spriteAsset should never be an asset instance?\n this._onSpriteAssetLoad(spriteAsset);\n } else {\n this._onSpriteAssetLoad(this._system.a...
[ "0.6995537", "0.67003065", "0.65117806", "0.6493966", "0.6463556", "0.64496166", "0.6426764", "0.63816327", "0.6377788", "0.6354841", "0.6352427", "0.6333556", "0.6310363", "0.6289241", "0.6289241", "0.62837684", "0.62685925", "0.6246109", "0.62441516", "0.62265664", "0.62265...
0.7923246
0
When the sprite asset changes reset it
_onSpriteAssetChange(asset) { this._onSpriteAssetLoad(asset); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "updateSprite () {\n this.setDirState(null, null)\n }", "destroyAssets() {\n this.sprite.destroy();\n }", "function reset() { // Resetting sprite/locations locations\n player.x = 205;\n player.y = 405;\n for (const enemy of allEnemies) {\n enemy.x = 0;\n }\n ...
[ "0.7485471", "0.6978439", "0.693214", "0.6813481", "0.6782456", "0.6727015", "0.67163706", "0.6557173", "0.64903754", "0.6465137", "0.6454123", "0.6417043", "0.6405076", "0.6400781", "0.6400755", "0.6386667", "0.6377601", "0.6341355", "0.6310618", "0.6309419", "0.6300777", ...
0.63821054
16
Hook up event handlers on sprite asset
_bindSprite(sprite) { sprite.on('set:meshes', this._onSpriteMeshesChange, this); sprite.on('set:pixelsPerUnit', this._onSpritePpuChange, this); sprite.on('set:atlas', this._onAtlasTextureChange, this); if (sprite.atlas) { sprite.atlas.on('set:texture', this._onAtlasTextureChange, this); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "_onSpriteAssetChange(asset) {\n this._onSpriteAssetLoad(asset);\n }", "_bindSpriteAsset(asset) {\n if (!this._entity.enabled) return; // don't bind until element is enabled\n\n asset.on(\"load\", this._onSpriteAssetLoad, this);\n asset.on(\"change\", this._onSpriteAssetChange, this...
[ "0.7190222", "0.67088836", "0.6618075", "0.64282376", "0.60498327", "0.6038736", "0.5983331", "0.59438384", "0.5849135", "0.5781978", "0.5768881", "0.576625", "0.57396024", "0.5718129", "0.57027256", "0.5685111", "0.5685111", "0.56798464", "0.5655463", "0.5645384", "0.5636506...
0.6820217
1
When atlas is loaded try to reset the sprite asset
_onTextureAtlasLoad(atlasAsset) { var spriteAsset = this._spriteAsset; if (spriteAsset instanceof Asset) { // TODO: _spriteAsset should never be an asset instance? this._onSpriteAssetLoad(spriteAsset); } else { this._onSpriteAssetLoad(this._system.app.assets.get(spriteAsset)); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "_onSpriteAssetLoad(asset) {\n if (!asset || !asset.resource) {\n this.sprite = null;\n } else {\n if (!asset.resource.atlas) {\n var atlasAssetId = asset.data.textureAtlasAsset;\n if (atlasAssetId) {\n var assets = this._system.ap...
[ "0.7602866", "0.6896558", "0.67990816", "0.67780477", "0.6693195", "0.6568996", "0.645322", "0.64476115", "0.63267225", "0.6323545", "0.6268682", "0.62549657", "0.6249645", "0.6244431", "0.62380666", "0.6234852", "0.6229806", "0.6219113", "0.6213304", "0.61978537", "0.6190154...
0.0
-1
render decides what is displayed on the page props let us pass information back and forth between different levels of component
render() { return ( <Content source = "https://cdn.pixabay.com/photo/2016/10/09/19/39/bee-1726659_960_720.jpg" labelText= "Bees (Apis)" bodyText="Bees make honey. Bees pollinate crops and trees. Bees rule!" additionalInfo = "Did you know: It takes one ounce of honey to fuel a bee's flight around the world?" additionalImage = "https://cdn-prod.servicemaster.com/-/media/Feature/Terminix/Blogs/bee-fiction-main.jpg" /> ) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "renderPage() {\t\t\n\t\tswitch (this.props.data.active) {\n\t\t\tcase 'user': \n\t\t\t\treturn this.renderUserInfo(this.props.data.body);\t\t\t\n\t\t\tcase 'repos': \n\t\t\t\treturn this.renderRepos(this.props.data.body);\n\t\t\tcase 'about': \n\t\t\t\treturn this.renderAbout();\t\t\t\t\t\n\t\t}\n\t}", "render()...
[ "0.7439651", "0.7117437", "0.6805867", "0.68007636", "0.67792284", "0.67514527", "0.672482", "0.6711327", "0.6708149", "0.67049265", "0.6674986", "0.6659307", "0.6653284", "0.6653284", "0.6653284", "0.6653284", "0.65893626", "0.6565246", "0.6551647", "0.65509385", "0.6547354"...
0.0
-1
listen on textarea change and update snippet result
function debounceSnippetIframeUpdate (textareaToUpdate, value) { window.clearTimeout(state.timeout) state.timeout = window.setTimeout(() => { state[textareaToUpdate] = value createSnippetIframe( dom.content.result, snippetData.metadata.base, snippetData.content.head, state.html, state.css, state.js ) }, config.debounceIframeCreation) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function updateTextArea(n) {\r\n document.getElementById(n).value = document.getElementById(\"wysiwyg\" + n).contentWindow.document.body.innerHTML;\r\n}", "function updateTextarea()\n {\n var JSONstring = JSON.stringify(parseTokens());\n textarea.val(JSONstring);\n }", "function textChange...
[ "0.65870655", "0.6410803", "0.6350836", "0.6340748", "0.6339805", "0.633446", "0.62932104", "0.6282357", "0.62797844", "0.6215568", "0.61949754", "0.61779785", "0.6176615", "0.61708033", "0.6162585", "0.6142994", "0.6141669", "0.61080897", "0.6098153", "0.6097329", "0.6086392...
0.5881421
43
Reload the outbrain modules after the ajax call
function reloadOutBrainModules() { if (typeof(OBR) !== "undefined" && typeof(OBR.extern) !== "undefined" && typeof(OBR.extern.researchWidget) !== "undefined") { OBR.extern.researchWidget("http://" + document.location.hostname + document.location.pathname); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function upcDoUpdate(){\n\tif(!singlePageSite){ //If it's not a single page site, remove the script for the modules loaded for the previous page\t\t\t\t\n\t\twhile($s(\"moduleScript\")) $(\"#moduleScript\").remove();\n\t}\t\t\t\t\n\tif(pageAjax.readyState===4){\n\t\tupdatePage();//parse response and finalize page ...
[ "0.64374065", "0.6431472", "0.6331076", "0.6300536", "0.6275721", "0.62447774", "0.6191223", "0.60233325", "0.60145485", "0.6014461", "0.60091114", "0.6003973", "0.5972698", "0.59457386", "0.59412336", "0.59377676", "0.5875785", "0.5874836", "0.57961345", "0.57621497", "0.575...
0.7164736
0
To refresh the leaderboard Ad when video page is reloaded
function AdsRefresh() { var detect_device = get_device(); if (detect_device == 'desktop') { if (jQuery(".node-type-recipe").length > 0) { // Adding the adslot for desktop & mobile. if (jQuery('div#ad-multi_ad_leaderboard').length > 0) { var scrollTopPosition, bottomOfElement, outerHeight; scrollTopPosition = Math.round(jQuery(window).scrollTop()); outerHeight = Math.round(jQuery('#ad-multi_ad_leaderboard').outerHeight(true)) / 2; bottomOfElement = Math.round(jQuery('#ad-multi_ad_leaderboard').offset().top + outerHeight); // Check if ad is in view port. if (scrollTopPosition < bottomOfElement) { time_dfp.refresh("ad-multi_ad_leaderboard"); } } }else{ if (jQuery('div#ad-multi_ad_leaderboard').length > 0) { time_dfp.refresh("ad-multi_ad_leaderboard"); } } } if (detect_device == 'phone') { if (jQuery('div#ad-mobile_ad_leaderboard').length > 0) { time_dfp.refresh("ad-mobile_ad_leaderboard"); } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function refreshPlayer() {\r\n\r\n\tdocument.location.reload(true);\r\n\r\n\t\t\t\r\n}//end method", "function refreshPlayers() {\n\n sendRequest('load-player', { tournamentId: window.tournamentId, getName: true }, handleRefresh)\n}", "function refresh_game() {\n var form = get_form_data('#play_game_form...
[ "0.64717597", "0.6331159", "0.6299958", "0.61579174", "0.61438215", "0.5956947", "0.5923052", "0.59115124", "0.5898757", "0.58685035", "0.5862733", "0.58613586", "0.58544666", "0.58407605", "0.5837244", "0.5781019", "0.5764929", "0.5746181", "0.5730578", "0.5729045", "0.57225...
0.6028948
5
Assigning user action tracking(prop43).
function update_utag_link(dsc) { if (dsc != '') { var omni_arr = dsc.split('|'); // User Action Tracking for Global Navigation Menu. if (omni_arr[0] != '' && omni_arr[0] == 'global-nav' && omni_arr[1] != '') { omni_click_id = dsc; utag.link({ "event_name": omni_arr[0], "click_id": omni_click_id }); } else if (omni_arr[0] != '' && omni_arr[0] == 'social_share' && omni_arr[1] != '') { // User Action Tracking for Social Share. var omni_event_name = omni_arr[0]; var omni_social_network = omni_arr[1]; var omni_click_id = 'sharebar|' + omni_arr[1]; utag.link({ "event_name": omni_event_name, "social_network": omni_social_network, "click_id": omni_click_id }); } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "set_user(on) { store.dispatch(hpUser(on)); }", "function add_paf_analytics() {\n // Check it out; btn.\n paf.on('#edit-submit-btn-in', 'click', undefined, 'NewUserOnboardingPromptTry');\n // No thanks; btn.\n paf.on('#edit-submit-btn-out', 'click', undefined, 'NewUserO...
[ "0.6206487", "0.5826509", "0.5583606", "0.5583305", "0.5529917", "0.551926", "0.5516282", "0.54538184", "0.5445014", "0.5426532", "0.5398306", "0.5385771", "0.5378622", "0.5372608", "0.5355269", "0.53382576", "0.5325389", "0.53170127", "0.5267143", "0.5259584", "0.52525", "...
0.0
-1
Write password to the password input
function writePassword() { // local variables for password parameters. var passwordContainer = []; var finalPassword = ''; var charSelect = 0; var password = generatePassword(); var passwordText = document.querySelector('#password'); passwordText.value = password; // Generate password function to be run once button is pushed function generatePassword(){ charSelect = prompt ('How many characters would you like?'); // user prompted to state how many characters they would like in their password // if statement assures 8 < length < 128 if(!charSelect) { alert('This needs a value'); } else if (charSelect < 8 || charSelect > 128){ charSelect = alert('You must choose between 8 and 128'); return; } else { // confirmation of symbol types confirmInt = confirm('Will this contain numbers?'); confirmChar = confirm('Will this contain special characters?'); confirmCaps = confirm('Will this contain Uppercase letters?'); confirmAlpha = confirm('Will this contain Lowercase letters?'); } // if statements to concatenate array variables if (confirmInt) { passwordContainer = passwordContainer.concat(int); } if (confirmChar) { passwordContainer = passwordContainer.concat(spec); } if (confirmCaps) { passwordContainer = passwordContainer.concat(alpha2); } if (confirmAlpha) { passwordContainer = passwordContainer.concat(alpha); } // if statement preventing lack of selection if (!confirmInt, !confirmChar, !confirmCaps, !confirmAlpha) { alert("Your password must contain at least one special, numeric, lowercase, or uppercase character."); return generatePassword(); } else { randomizePassword(); } /* for loop turning array into a string with proper length and setting finalPassword equal to the randomized selection*/ function randomizePassword() { for(var i = 0; i < charSelect; i++) { var randomIdx = Math.floor(Math.random() * passwordContainer.length); var randomChar = passwordContainer[randomIdx]; finalPassword = randomChar + finalPassword; } } } // logs randomized password in console console.log(finalPassword); // Pushes randomized password to appear on webpage passwordText.value = finalPassword; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function writePassword() {}", "function writePassword() {\n var password = getPasswordOptions();\n var passwordText = document.querySelector('#password');\n \n passwordText.value = password;\n }", "function writePassword() {\n var password = generatePassword();\n var passwordText = document.qu...
[ "0.8859371", "0.85438496", "0.8511671", "0.8501158", "0.8490387", "0.848501", "0.8472282", "0.8468989", "0.845468", "0.8444224", "0.84319127", "0.8420268", "0.8419394", "0.84066415", "0.8404136", "0.8400749", "0.8393203", "0.83766234", "0.83703816", "0.83647054", "0.83603424"...
0.0
-1
Generate password function to be run once button is pushed
function generatePassword(){ charSelect = prompt ('How many characters would you like?'); // user prompted to state how many characters they would like in their password // if statement assures 8 < length < 128 if(!charSelect) { alert('This needs a value'); } else if (charSelect < 8 || charSelect > 128){ charSelect = alert('You must choose between 8 and 128'); return; } else { // confirmation of symbol types confirmInt = confirm('Will this contain numbers?'); confirmChar = confirm('Will this contain special characters?'); confirmCaps = confirm('Will this contain Uppercase letters?'); confirmAlpha = confirm('Will this contain Lowercase letters?'); } // if statements to concatenate array variables if (confirmInt) { passwordContainer = passwordContainer.concat(int); } if (confirmChar) { passwordContainer = passwordContainer.concat(spec); } if (confirmCaps) { passwordContainer = passwordContainer.concat(alpha2); } if (confirmAlpha) { passwordContainer = passwordContainer.concat(alpha); } // if statement preventing lack of selection if (!confirmInt, !confirmChar, !confirmCaps, !confirmAlpha) { alert("Your password must contain at least one special, numeric, lowercase, or uppercase character."); return generatePassword(); } else { randomizePassword(); } /* for loop turning array into a string with proper length and setting finalPassword equal to the randomized selection*/ function randomizePassword() { for(var i = 0; i < charSelect; i++) { var randomIdx = Math.floor(Math.random() * passwordContainer.length); var randomChar = passwordContainer[randomIdx]; finalPassword = randomChar + finalPassword; } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function generatePassword() {\n reset();\n correctLength();\n upperConfirm();\n lowerConfirm();\n numbConfirm();\n specialConfirm();\n\n for (i = 0; i < lengthOfPW; i++) {\n let randomInt = getRandomInt(charsToUse.length);\n password += charsToUse.charAt(randomInt);\n }\n /...
[ "0.85201716", "0.8420203", "0.8366399", "0.8296782", "0.82471377", "0.82381415", "0.810846", "0.81013745", "0.80547225", "0.8048203", "0.80115926", "0.79741395", "0.7969136", "0.7926161", "0.79229957", "0.792172", "0.7908288", "0.79007", "0.7897408", "0.78894836", "0.78868073...
0.0
-1
for loop turning array into a string with proper length and setting finalPassword equal to the randomized selection
function randomizePassword() { for(var i = 0; i < charSelect; i++) { var randomIdx = Math.floor(Math.random() * passwordContainer.length); var randomChar = passwordContainer[randomIdx]; finalPassword = randomChar + finalPassword; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function generatePassword() {\n for (var i = 0; i < pwLength; i++) {\n var randomNum = Math.floor(Math.random() * userSelect.length);\n var randomCharacter = userSelect[randomNum];\n finalPassword.push(randomCharacter);\n \n // var randomCharacter = finalArr[arrIndex];\n ...
[ "0.8575623", "0.8179286", "0.8142102", "0.81072783", "0.81064725", "0.8010218", "0.80000263", "0.79993516", "0.7991404", "0.79863244", "0.7940964", "0.79306644", "0.79288685", "0.7925274", "0.7891941", "0.7887024", "0.78707993", "0.78518456", "0.78204715", "0.78144664", "0.77...
0.85804665
0
FindIndex / findIndex() returns index of the first element in a given array that satisfies the provided testing function. Otherwise 1 is returned array.findIndex(function(currentValue, index, arr), thisValue)
function isOdd(element, index, array) { return (element%2 == 1); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function find() {\n return function (arr, value) {\n var len = arr.length,\n i;\n for (i = 0; i < len; i += 1) {\n if (arr[i] === value) {\n return i;\n }\n }\n return -1;\n };\n }", "func...
[ "0.7802249", "0.77842265", "0.7757497", "0.7400297", "0.7326098", "0.72898334", "0.7285945", "0.7269102", "0.7247989", "0.72429425", "0.7233486", "0.72162193", "0.72136045", "0.71923715", "0.7185327", "0.7166986", "0.71353626", "0.7132092", "0.7119847", "0.7106232", "0.709989...
0.0
-1
add class for li this function to use as listener with event & it make web scroll to the sellection section
function scrollFunc(event) { allSections[index].scrollIntoView({ behavior: "smooth", block: "end", inline: "nearest" }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function scrollToView(event){\n const listItem = event.target;\n const sectionId =listItem.getAttribute('name');\n const section = document.getElementById(sectionId);\n window.scrollTo({\n top: section.getBoundingClientRect().y + window.scrollY,\n behavior: 'smooth'\n });\n /*const listItems = document.q...
[ "0.7209312", "0.6942626", "0.67685217", "0.6671048", "0.665455", "0.65180683", "0.6435807", "0.6402027", "0.6389932", "0.6368636", "0.63523555", "0.6352268", "0.6343713", "0.6271952", "0.62568206", "0.62480015", "0.6241389", "0.62266755", "0.6222676", "0.62198126", "0.6200307...
0.60521513
41
dynamically adjust the canvas to the window
function windowResized() { resizeCanvas(windowWidth, windowHeight); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function adjustCanvasSize() {\n CANVAS.width = CANVAS_WIDTH;\n CANVAS.height = window.innerHeight;\n}", "function windowResized(){\n canvas.resize(windowWidth, windowHeight - canvasadjust);\n}", "function windowResized() {\n centerCanvas();\n}", "function resizeCanvas() {\n\tvar newHeight = window.in...
[ "0.78116006", "0.77119523", "0.77046156", "0.76467985", "0.7646421", "0.7605592", "0.756261", "0.7471809", "0.7429307", "0.7428623", "0.74280494", "0.7394401", "0.73618746", "0.7361076", "0.73549914", "0.73509425", "0.73509425", "0.7346518", "0.7345867", "0.734224", "0.732390...
0.709766
94
`buildJOSMPresets()` Create JOSM presets using the tree/key/value structure to organize the presets into JOSM preset groups. See:
function buildJOSMPresets() { let root = xmlbuilder2.create({ version: '1.0', encoding: 'UTF-8' }); let presets = root.ele('presets') .att('xmlns', 'http://josm.openstreetmap.de/tagging-preset-1.0') .att('author', 'Name Suggestion Index') .att('shortdescription', 'Name Suggestion Index') .att('description', packageJSON.description) .att('link', 'https://github.com/' + packageJSON.repository) .att('version', packageJSON.version); let topGroup = presets .ele('group') .att('name', 'Name Suggestion Index'); let tPrev, kPrev, vPrev; let tGroup, kGroup, vGroup; const paths = Object.keys(_cache.path).sort(withLocale); paths.forEach(tkv => { const parts = tkv.split('/', 3); // tkv = "tree/key/value" const t = parts[0]; const k = parts[1]; const v = parts[2]; // Which wikidata tag is considered the "main" tag for this tree? const wdTag = trees[t].mainTag; // Include only items that have a wikidata tag and are not dissolved.. let items = (_cache.path[tkv].items || []) .filter(item => { const qid = item.tags[wdTag]; if (!qid || !/^Q\d+$/.test(qid)) return false; // wikidata tag missing or looks wrong.. if (dissolved[item.id]) return false; // dissolved/closed businesses.. return true; }); if (!items.length) return; // skip this path // Create new menu groups as t/k/v change if (t !== tPrev) tGroup = topGroup.ele('group').att('name', t); if (k !== kPrev) kGroup = tGroup.ele('group').att('name', k); if (v !== vPrev) vGroup = kGroup.ele('group').att('name', v); // Choose allowable geometries for the category let presetType; if (t === 'flags') { presetType = 'node'; } else if (k === 'route') { if (v === 'ferry') { // Ferry hack! ⛴ presetType = 'way,closedway,relation'; } else { presetType = 'relation'; } } else if (k === 'power' && (v === 'line' || v === 'minor_line')) { presetType = 'way,closedway'; } else if (k === 'power' && (v === 'pole' || v === 'tower')) { presetType = 'node'; } else { presetType = 'node,closedway,multipolygon'; // default for POIs } items.forEach(item => { let preset = vGroup .ele('item') .att('name', item.displayName) .att('type', presetType); for (const osmkey in item.tags) { preset.ele('key').att('key', osmkey).att('value', item.tags[osmkey]); } }); tPrev = t; kPrev = k; vPrev = v; }); fs.writeFileSync('dist/presets/nsi-josm-presets.xml', root.end({ prettyPrint: true })); fs.writeFileSync('dist/presets/nsi-josm-presets.min.xml', root.end()); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function addPresets(title, presets){\n\t\tvar topFolder = makeFolder(title, VISUALS);\n\t\t//iterate over the preset, \n\t\tfor (var i = 0; i < presets.length; i++){\n\t\t\tvar level = presets[i];\n\t\t\taddObject(topFolder, \"Level \"+i, level);\n\t\t}\n\t\t//add an print button\n\t\ttopFolder.add({\n\t\t\t\"prin...
[ "0.5656756", "0.55095625", "0.522493", "0.5091114", "0.5001775", "0.49868938", "0.4936914", "0.4936914", "0.4936914", "0.4936914", "0.4936914", "0.4936914", "0.4936914", "0.4936914", "0.4936914", "0.4936914", "0.4936914", "0.4902442", "0.4902442", "0.49003696", "0.47950545", ...
0.73804957
0
`buildTaginfo()` Create a taginfo project file See:
function buildTaginfo() { const distURL = 'https://raw.githubusercontent.com/osmlab/name-suggestion-index/main/dist'; let taginfo = { 'data_format': 1, 'data_url': `${distURL}/taginfo.json`, 'project': { 'name': 'name-suggestion-index', 'description': 'Canonical features for OpenStreetMap', 'project_url': 'https://github.com/osmlab/name-suggestion-index', 'doc_url': 'https://github.com/osmlab/name-suggestion-index/blob/main/README.md', 'icon_url': 'https://cdn.jsdelivr.net/npm/@mapbox/maki@6/icons/fastr-food-15.svg', 'contact_name': 'Bryan Housel', 'contact_email': 'bhousel@gmail.com' } }; // collect all tag pairs let tagPairs = {}; _cache.id.forEach(item => { for (const k in item.tags) { let v = item.tags[k]; // Don't export every value for many tags this project uses.. // ('tag matches any of these')(?!('not followed by :type')) if (/(brand|brewery|country|flag|internet_access:ssid|max_age|min_age|name|network|operator|owner|ref|subject)(?!(:type))/.test(k)) { v = '*'; } const kv = `${k}/${v}`; tagPairs[kv] = { key: k }; if (v !== '*') { tagPairs[kv].value = v; } } }); taginfo.tags = Object.keys(tagPairs).sort(withLocale).map(kv => tagPairs[kv]); fs.writeFileSync('dist/taginfo.json', stringify(taginfo, { maxLength: 100 }) + '\n'); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function tagFile() {\n\n // TODO: sort by further fields, too\n tags.sort(function(x,y){ return x.name > y.name ? 1 : x.name == y.name ? 0 : -1 });\n\n var tagFile = [];\n\n tagFile.push('!_TAG_FILE_SORTED\\t1\\t');\n tagFile.push('!_TAG_PROGRAM_AUTHOR\\tClaus Reinke\\t');\n tagFile.push('!_TAG_PROGRAM_NAME\...
[ "0.61200327", "0.58099604", "0.5648067", "0.55684483", "0.5112746", "0.5105488", "0.49996012", "0.4997148", "0.4978548", "0.4978548", "0.49147755", "0.48923498", "0.4891497", "0.48870024", "0.48823032", "0.48789573", "0.48521176", "0.48033822", "0.48032707", "0.47727922", "0....
0.73186946
0
`buildSitemap()` Create the sitemap for See:
function buildSitemap() { const changefreq = 'weekly'; const lastmod = (new Date()).toISOString(); let root = xmlbuilder2.create({ version: '1.0', encoding: 'UTF-8' }); let urlset = root.ele('urlset').att('xmlns', 'http://www.sitemaps.org/schemas/sitemap/0.9'); let index = urlset.ele('url'); index.ele('loc').txt('https://nsi.guide/index.html'); index.ele('changefreq').txt(changefreq); index.ele('lastmod').txt(lastmod); // collect all paths const paths = Object.keys(_cache.path).sort(withLocale); paths.forEach(tkv => { const parts = tkv.split('/', 3); // tkv = "tree/key/value" const t = parts[0]; const k = parts[1]; const v = parts[2]; let url = urlset.ele('url'); url.ele('loc').txt(`https://nsi.guide/index.html?t=${t}&k=${k}&v=${v}`); url.ele('changefreq').txt(changefreq); url.ele('lastmod').txt(lastmod); }); fs.writeFileSync('docs/sitemap.xml', root.end({ prettyPrint: true })); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async function sitemap() {\n if (!config.OPTIONS.sitemap) return;\n\n let publicUrl;\n if (typeof config.OPTIONS.sitemap === \"string\")\n publicUrl = config.OPTIONS.sitemap;\n else if (env.raw.PUBLIC_URL) {\n publicUrl = env.raw.PUBLIC_URL;\n\n // removes forward slash at the end\n if (publicUrl.c...
[ "0.68529147", "0.6769498", "0.66632396", "0.6448362", "0.6223317", "0.58190626", "0.55860907", "0.5582013", "0.5566501", "0.5299909", "0.52291137", "0.52244604", "0.50927746", "0.5059484", "0.5043453", "0.4941226", "0.49147642", "0.48696935", "0.48118812", "0.48096296", "0.47...
0.80682343
0
`minifySync()` minifies a file
function minifySync(inPath, outPath) { try { const contents = fs.readFileSync(inPath, 'utf8'); const minified = JSON.stringify(JSON5.parse(contents)); fs.writeFileSync(outPath, minified); } catch (err) { console.error(chalk.red(`Error - ${err.message} minifying:`)); console.error(' ' + chalk.yellow(inPath)); process.exit(1); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "minifyFile(file) {\n // The hash meteor provides seems to change more than\n // necessary, so we create our own here based on only what \n // affects the minified output\n let key\n Profile.time('hash', () => {\n key = this._deepHash({\n content: file.getContentsAsString(),\n sour...
[ "0.6956672", "0.6806987", "0.6684811", "0.6613109", "0.65868384", "0.65110207", "0.6477338", "0.63976413", "0.6344866", "0.63355976", "0.63077474", "0.6290507", "0.62225395", "0.6211793", "0.62005645", "0.61476225", "0.6103916", "0.6102272", "0.60607064", "0.6001399", "0.5895...
0.7484735
0
Init function. And some globals! Yikes!
function ready() { console.log('ready'); getItems(function (item) { for (var i in item) { var f = item[i]; var mockItem = getFurniture(); f.item[0].itemTitle = mockItem.itemTitle; f.item[0].images = mockItem.images; console.log(f); dust.render("item", f, function (origin) { var address = origin.User; origin.address=address; return function (err, text) { var newItem = $(text); newItem.data('originData', origin); newItem.on('routeQueue', setToRoute); newItem.on('requestQueue', setToRequest); newItem.on('changeQueue', calcRoute); newItem.on('reject', setToReject); newItem.find('button.toRoute').click(function (item) { return function () { item.appendTo("#routes"); item.trigger('routeQueue').trigger('changeQueue'); } }(newItem)); newItem.find('button.toRequest').click(function (item) { return function () { if (!confirm("Are you sure you want to cancel this pickup?")) { return; } item.prependTo("#requests"); item.trigger('requestQueue').trigger('changeQueue'); } }(newItem)); newItem.find('button.toReject').click(function (item) { return function () { if (!confirm("Are you sure you want to reject this donation?")) { return; } item.remove().trigger('reject'); } }(newItem)); $("#requests").append(newItem); geoCode(newItem, address) } }(f)); } }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function init() {}", "function init() {}", "function init() {}", "function init() {}", "function init() {}", "function init() {}", "function init() {}", "function init() {}", "function init() {}", "function init() {}", "function init() { }", "function init() { }", "function init(){}", "fu...
[ "0.8688422", "0.8688422", "0.8688422", "0.8688422", "0.8688422", "0.8688422", "0.8688422", "0.8688422", "0.8688422", "0.8688422", "0.84062994", "0.84062994", "0.832529", "0.831627", "0.8284989", "0.8284989", "0.8284989", "0.8209971", "0.8191519", "0.8184018", "0.8171824", "...
0.0
-1
Load up some mock item photos from the twitter API
function jsonFlickrApi(data) { mock.images = data.photos.photo; ready(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getPhotos() {\n imageCount = 0;\n ready = false;\n loader.hidden = false;\n if (random) {\n getRandomPhotos();\n } else {\n getSearchResults(query);\n }\n}", "function loadFlickrPhotos() {\n var photoSetId, photoSetName;\n photoSetId = this.id.substring(2); // remove \"ps\" prefix\n ...
[ "0.6507373", "0.6450353", "0.6427113", "0.6380571", "0.6359778", "0.6346344", "0.63078535", "0.62893254", "0.62824535", "0.6247507", "0.61759305", "0.616855", "0.6140892", "0.6135742", "0.60930413", "0.60770726", "0.6060324", "0.60394275", "0.603688", "0.60199356", "0.6015361...
0.6848327
0
Actions for the list item controls
function setToRoute(e) { var item = $(this); item.data('marker').setMap(map); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function ListItem() { }", "function onListBoxAction (data) {\n if (data.index < 0) return;\n\n switch (data.action) {\n case 'navigate':\n if (debug) console.log(`navigate: ${data.index}`);\n updateButton(false);\n break;\n case 'activate':\n if (debug) console.log(`activate: ${data.i...
[ "0.68638235", "0.6682912", "0.647275", "0.647275", "0.647275", "0.64372134", "0.6390759", "0.6375086", "0.6368167", "0.6366718", "0.6334368", "0.61986613", "0.61960894", "0.6181981", "0.6139975", "0.61326957", "0.61210114", "0.6100705", "0.6001814", "0.599121", "0.59495467", ...
0.0
-1
Calculate the best route between the points in the routeQueue
function calcRoute() { //Hardcoded the Goodwill HQ as the start and end location for all routes var start = "1580 Mission Street, San Francisco, CA 94103"; var end = start;//"20 Descanso Dr, San Jose CA 95134";//start; var items = $('#routes .item'); var wayPoints = items.map(function (idx, item) { var data = $(item).data('originData').address; $(item).data('marker').setMap(null); return { location: data.address + " "/* + data.addr2 */+ " , " + data.city + " , " + data.zip, stopover: true } }); var optimize = $("#optimize").is(":checked"); var request = { origin: start, destination: end, waypoints: wayPoints, optimizeWaypoints: optimize, travelMode: google.maps.TravelMode.DRIVING }; // directionsService.route(request, function (result, status) { if (status == google.maps.DirectionsStatus.OK) { //Render the solution on the map directionsDisplay.setDirections(result); //Tally up the total time / distance for this route var totals = computeTotalDistance(result); $("#routeSpecs").text(" " + wayPoints.length + " stops, " + totals.distance + " miles, " + totals.time + " hours"); //Rejjiger the list if set to optimize route if (optimize) { var optimizedWaypoints = result.routes[0].waypoint_order; var oldItems = $("#routes li"); var newRoute = []; for (var i in optimizedWaypoints) { newRoute.push(oldItems[optimizedWaypoints[i]]); } $("#routes").append(newRoute); } } }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function calcRoute(){\n\t//clear the map of exisiting lines\n\tclearLines();\n\t//get the inputs from the forms\n\tvar startVal = parseInt($(\"#start\")[0].value);\n\tvar endVal = parseInt($(\"#end\")[0].value);\n\t//use the input to get the node and id represented by the input\n\tvar startNode = getNodeFromRoomRe...
[ "0.7112134", "0.6640623", "0.65206265", "0.6514286", "0.64983183", "0.6326816", "0.61781764", "0.61505383", "0.61078405", "0.60964", "0.60548043", "0.60380507", "0.6022074", "0.59942794", "0.5992656", "0.5986015", "0.5976471", "0.5950796", "0.5914696", "0.59102285", "0.589250...
0.59615666
17
Translate a customers address into a map point. This will create two sets of markers: A blue temp marker for hover events A red permanent marker for placemente on the pickup list
function geoCode(item, address) { var full = address.address + " " +/* address.addr2 + " " +*/ address.city + " " + address.state + ", " + address.zip; console.log('full ',full); var geo = new google.maps.Geocoder(); geo.geocode({'address': full }, function (results, status) { var map_center_lat = results[0].geometry.location.lat(); var map_center_lng = results[0].geometry.location.lng(); var tmpMarker = new google.maps.Marker({ position: new google.maps.LatLng(map_center_lat, map_center_lng), icon: "http://maps.google.com/mapfiles/ms/icons/blue-dot.png" }); var prmMarker = new google.maps.Marker({ position: new google.maps.LatLng(map_center_lat, map_center_lng), icon: "http://maps.google.com/mapfiles/ms/icons/red-dot.png" }); google.maps.event.addListener(prmMarker, 'click', (function (add, marker) { return function () { console.log("in click listener ", add); infowindow.setContent(add); infowindow.open(map, marker); } })(full, prmMarker)); item.hover( //On enter function (add, marker) { return function () { marker.setMap(map); infowindow.setContent(add); infowindow.open(map, marker); } }(full, tmpMarker), //On leave function (add, marker) { return function () { marker.setMap(null); } }(full, tmpMarker) ); item.data({marker: prmMarker, infoWindow: infowindow}); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function createMarker(point, name, address, type) {\n var marker = new GMarker(point, customIcons[type]);\n var html = \"<p class='marker_geoloc'>\";\n\t html = html + \"<strong>\" + name + \"</strong>\";\n\t if (address != \"\") { html = html + \"<br /><br />\" + address; }\n\t html = html + \"</p>\...
[ "0.66652715", "0.6601436", "0.64061224", "0.63056797", "0.6250385", "0.62001306", "0.6188702", "0.61774313", "0.61664283", "0.6158404", "0.6127125", "0.61206174", "0.61150116", "0.6110089", "0.60936385", "0.6091429", "0.6059078", "0.6049639", "0.60231024", "0.60083306", "0.60...
0.6116387
12
populates array of objects that keeps track of counts of different types of cards
function getCount(){ cardCounts = [{'name':'-1', 'value':0}, {'name': '0', 'value':0}, {'name':'1', 'value':0}]; discard.forEach(function(card) { val = countValues[card]; val = parseInt(val); cardCounts[val+1].value++; }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "constructor(count=1) {\r\n this.count = count;\r\n this.cards = [];\r\n for (let c = 1; c <= count; c++){ \r\n for (let s = 0; s <= 3; s++){\r\n for(let f = 0; f <=12; f++)\r\n this.cards.push(new card(FACES[f], SUITES[s], SCORES[f]));\r\n ...
[ "0.6464403", "0.64112264", "0.6327018", "0.6286204", "0.622182", "0.620646", "0.61797833", "0.6163907", "0.6113029", "0.60783786", "0.60553527", "0.6047972", "0.6042261", "0.60342556", "0.6033811", "0.60139734", "0.6002017", "0.599916", "0.5992427", "0.5980616", "0.5972857", ...
0.72435784
0
An asynchronous function to fetch data from the API
async function sendApiRequest(){ let response = await fetch(`https://opentdb.com/api_category.php`); // console.log(response) let data = await response.json() // console.log(data) getCategories(data) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async function gettingData() {\n let response = await fetch(url);\n let data = await response.json();\n console.log(data);\n }", "async function getDataFromApiAsync() {\n let response = await fetch(urlSwapi);\n let data = await response.json();\n console.log(data....
[ "0.7863471", "0.78312045", "0.77544236", "0.7574837", "0.7570324", "0.75503224", "0.7544349", "0.752518", "0.752518", "0.7516662", "0.74892145", "0.7435369", "0.7415986", "0.73979867", "0.7388539", "0.7371502", "0.7366746", "0.7354953", "0.73471195", "0.73428285", "0.7338648"...
0.72020227
32
delete local database on confirmation
function deleteLocalDatabase() { expApp.confirm( //'Do you really want to drop the local database? All local data (expenses, settings) will be lost.', 'This functionality is not available yet.', //'Delete Database', 'OK', function () { /*db.drop(); db = new localStorageDB("expenSync", localStorage); createLocalDatabase(); pageIndexLeft.trigger(); pageIndex.trigger();*/ }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function deleteDb() {\n dbAdapter.deleteDatabase(AppSettings.lokijs.dbName);\n }", "async function cleanup() {\n await client.database(databaseId).delete();\n }", "async function cleanup() {\r\n await client.database(databaseId).delete()\r\n}", "function clearDatabase() {\n console.lo...
[ "0.7469223", "0.71060973", "0.70686686", "0.70395076", "0.70026255", "0.69927955", "0.69666934", "0.6885609", "0.6864241", "0.68122995", "0.67034656", "0.66499865", "0.66465", "0.66231585", "0.65931416", "0.65913165", "0.65808386", "0.646839", "0.6459721", "0.6459721", "0.645...
0.8239764
0
separate a string str into chunks of given length len
function chunkString(str, len) { var _size = Math.ceil(str.length / len), _ret = new Array(_size), _offset; for (var _i = 0; _i < _size; _i++) { _offset = _i * len; _ret[_i] = str.substring(_offset, _offset + len); } return _ret; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function chunkString(s, len) {\n var curr = len, prev = 0;\n\n var output = [];\n\n while (s[curr]) {\n if (s[curr++] == ' ') {\n output.push(s.substring(prev, curr));\n prev = curr;\n curr += len;\n }\n else {\n var currReverse = curr;\n ...
[ "0.73841876", "0.73582536", "0.69901764", "0.68241423", "0.6336491", "0.6227581", "0.6077559", "0.6074262", "0.6047248", "0.601308", "0.5968714", "0.591397", "0.58134437", "0.5759229", "0.57329434", "0.5657048", "0.5581341", "0.5560088", "0.5551631", "0.5545051", "0.55193114"...
0.74387336
0
create CSV file (encoded as utf8) from JSON object
function createCSVDataLink(tableName, JSONData, title, noLink) { noLink = noLink || false; var CSV = ''; // set Report title in first row or line CSV += title + '\r\n\n'; // this condition will generate the Label/Header var tableFields = db.tableFields(tableName); var row = tableFields.join(); CSV += row + '\r\n'; var data = convertJSONtoCSV(JSONData); if (data.length == 0) return false; CSV += data; // initialize file format you want csv or xls if (!noLink) CSV = 'data:text/csv;charset=utf-8,' + escape(CSV); return CSV; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "jsonToCSV(data) {\n var csvData = [];\n //Header\n if (this.title != null) {\n csvData.push(this.parseExtraData(this.title, \"${data}\\r\\n\"));\n }\n //Fields\n for (let key in data[0]) {\n csvData.push(key);\n csvData.push(\",\");\n }\n csvData.pop();\...
[ "0.78618443", "0.7537736", "0.7349511", "0.7144762", "0.69967383", "0.6861733", "0.6811", "0.67335564", "0.6729914", "0.6718809", "0.66682804", "0.6640806", "0.66181254", "0.6616871", "0.6605309", "0.6570442", "0.6562567", "0.652621", "0.6514584", "0.6469822", "0.6454404", ...
0.589835
51
convert JSON object to CSV
function convertJSONtoCSV(JSONData) { // if JSONData is not an object then JSON.parse will parse the JSON string in an Object var arrData = (typeof JSONData === "undefined" ? "undefined" : _typeof(JSONData)) != 'object' ? JSON.parse(JSONData) : JSONData; var CSV = ''; // 1st loop is to extract each row for (var i = 0; i < arrData.length; i++) { var row = ''; // 2nd loop will extract each column and convert it in string comma-seprated for (var index in arrData[i]) { row += '"' + arrData[i][index] + '",'; } CSV += row.slice(0, row.length - 1) + '\r\n'; } return CSV; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "jsonToCSV(data) {\n var csvData = [];\n //Header\n if (this.title != null) {\n csvData.push(this.parseExtraData(this.title, \"${data}\\r\\n\"));\n }\n //Fields\n for (let key in data[0]) {\n csvData.push(key);\n csvData.push(\",\");\n }\n csvData.pop();\...
[ "0.8217984", "0.8115128", "0.7747288", "0.7718176", "0.7462357", "0.73165596", "0.71575004", "0.7153348", "0.7062393", "0.69790936", "0.6955298", "0.69456595", "0.692351", "0.6909199", "0.6898291", "0.6878117", "0.6868458", "0.68538254", "0.67796844", "0.67673683", "0.6734206...
0.6903916
14
create a unique ID for items based on time, a given salt and browser's user agent
function createUniqueid(timestamp, salt, noUserAgent) { noUserAgent = noUserAgent || false; var str = '' + timestamp + salt; if (!noUserAgent) str += navigator.userAgent; return calcMD5(str); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function genID() {\n return (+new Date() + Math.floor(Math.random() * 999999)).toString(36);\n}", "function makeId() {\n return Math.random().toString(36).substr(2, 5);\n}", "function generateSessionID() {\n const d = new Date();\n const month = [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", ...
[ "0.6636407", "0.6491503", "0.64855975", "0.64851314", "0.648299", "0.6450382", "0.6441026", "0.64361334", "0.6434323", "0.64191025", "0.639639", "0.6374918", "0.6371627", "0.6361296", "0.634617", "0.633899", "0.6338635", "0.6338007", "0.63361955", "0.63358194", "0.63344955", ...
0.77777076
0
reduce functions for daily total and average
function reduceAdd(p, v) { p.total += v.price; p.count++; //p.average = p.total / p.count; return p; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function calc_aadt(unmapper,sum_variables,ts_column){\n\n return function(data){\n\n // data is all the data to sum up,by column. Theoretically a\n // subset of the big data, but really I don't care inside this\n // code\n\n // start is the starting point for the map summing functi...
[ "0.6275451", "0.6135549", "0.60078603", "0.5967015", "0.5966944", "0.5949108", "0.5819142", "0.57960033", "0.578838", "0.5755927", "0.5750446", "0.57381654", "0.5706722", "0.57026964", "0.57021004", "0.5697739", "0.5668251", "0.5666143", "0.5631696", "0.5631293", "0.56137294"...
0.0
-1
reduce functions for running total
function runningReduceInitial() { return { total: 0, count: 0, //average: 0, type: 'runningTotal' }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "calculateTotals(data) {\n let calculate = (acc, current) => acc + current;\n let total = data.reduce(calculate);\n return total;\n }", "function myReduceFunc() {\n \n\n\n}", "function total(arr)\n{\n\t//your code here \n\tconst result = arr.reduce(function(num, addedValue){\n\t\taddedValue = addedVa...
[ "0.7084783", "0.6847594", "0.67563605", "0.6744238", "0.6744238", "0.66593546", "0.66416544", "0.6624324", "0.6591982", "0.65741354", "0.6571466", "0.6506661", "0.64822793", "0.6465947", "0.6465662", "0.6388197", "0.6369364", "0.6361905", "0.6354466", "0.6353723", "0.63234776...
0.7139719
0
4 Event listener functions
function getDataFromApi(searchTerm, callback) { var query = { part: 'snippet', key: 'put in your key', q: searchTerm, per_page: 5 } $.getJSON(YouTube_SEARCH_URL, query, callback); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function EventHandlers() {}", "function EventHandlers() {}", "function EventHandlers() {}", "function EventHandlers() {}", "function EventHandlers() {}", "function EventHandlers() {}", "function EventHandlers() {}", "function EventHandlers() {}", "function EventHandlers() {}", "function EventHand...
[ "0.7381111", "0.7381111", "0.7381111", "0.7381111", "0.7381111", "0.7381111", "0.7381111", "0.7381111", "0.7381111", "0.7381111", "0.7381111", "0.7381111", "0.7381111", "0.7381111", "0.7381111", "0.7381111", "0.7381111", "0.7381111", "0.7381111", "0.7155391", "0.7126808", "...
0.0
-1
Use of this source code is governed by a BSDstyle license that can be found in the LICENSE file.
function initializeButtonClicks() { var logger = new Logger(); logger.initialize();// check and log if needed //Set up button actions $("#btn-documentation").click(newTab("btn-documentation")); //Opens a tab for the documentation $("#btn-createRequest").click(switchWindow("btn-createRequest")); //Switches to the request creation form $("#btn-cancel").click(resetSection()); //Resets the collapsible sections $("#btn-cancel").click(switchWindow("btn-cancel")); //Switches back to the main view of the popup $("#btn-cancel").click(function(){$("#btn-create").prop("disabled",false);}); // $("#btn-cancelLogin").click(function(){logger.hideLogin()}); //Hides login page, and see main view $("#btn-login").click(function(){logger.showLogin(false)}); //Shows login page $(".close").click(function(){$(".alert").alert('close')}); //close alerts with (x) $("#btn-loginToSW").click(logger.getConnectToSW()); //Logs into Software from login page $("#btn-logout").click(function(){logger.logoutFromSW()}); //Logs out of software $("#btn-screenshot").click(function(){clickHandler()}); //Takes a screenshot $("#btn-cancel").click(clearFields()); //Clears input fields when user cancels the form $("#btn-create").click(createRequest()); //Submits form to actual software page when you hit "Create" $("#btn-createRequest").click(function(){ getVersionInfo()}); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private internal function m248() {}", "private public function m246() {}", "protected internal function m252() {}", "static final private internal function m106() {}", "transient private protected internal function m182() {}", "static private internal function m121() {}", "transient protected internal ...
[ "0.7136994", "0.6834812", "0.652212", "0.6499044", "0.6235297", "0.6188284", "0.61636406", "0.61635774", "0.6159229", "0.6099427", "0.6042316", "0.60398203", "0.595128", "0.59119475", "0.5883029", "0.5863093", "0.5857713", "0.578178", "0.568961", "0.5660226", "0.5644679", "...
0.0
-1
When focusing on this component, focus on the TextInput
focus() { this.refs.input.focus(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "focus () {\n const { textInput } = this;\n textInput && textInput.focus();\n }", "focus() {\n this.textInput.focus();\n }", "focusTextInput() {\n this.textInput.current.focus()\n }", "focus() {\n const { textInput } = this;\n textInput && textInput.focus();\n }", "focus() {\n ...
[ "0.84669644", "0.8427931", "0.8422549", "0.8380458", "0.80401057", "0.793155", "0.7732654", "0.77161247", "0.75783", "0.75496113", "0.7540812", "0.75125617", "0.7508633", "0.7502652", "0.7502652", "0.7485974", "0.7469511", "0.74292266", "0.7404566", "0.7385734", "0.7383736", ...
0.7583497
8
When blurring on this component, blur the TextInput
blur() { this.refs.input.blur(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "blur () {\n const { textInput } = this;\n textInput && textInput.blur();\n }", "blur() {\n const { textInput } = this;\n textInput && textInput.blur();\n }", "blur() {\n this.textInput.blur();\n }", "blur() {\n this.control_input.blur();\n this.onBlur(null);\n }", "function b...
[ "0.8488113", "0.84350616", "0.8197789", "0.76420367", "0.74363124", "0.73409986", "0.733986", "0.7314191", "0.7202803", "0.7194631", "0.71694607", "0.71347404", "0.7134235", "0.71262395", "0.7114388", "0.70961267", "0.70605505", "0.70502955", "0.70426327", "0.70426327", "0.70...
0.72837234
8
Write password to the password input
function writePassword() { function generatePassword() { // promts user to choose pass length and parses into an integer var passLength = prompt("Password length (min:8 chars, max:128 chars): "); var length = parseInt(passLength); var passChars = prompt("What type of characters would you like to use: \nlowercase, uppercase, numeric, special characters or all"); var charset; var charset1 = "abcdefghijklmnopqrstuvwxyz"; var charset2 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; var charset3 = "0123456789"; var charset4 = "!@#$%&*"; var charset5 = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%&*" if (length >= 8 && length <= 128) { length; // straight up just the character set to choose from // The retVal kinda sets it up as both a split and gets returned as a string for the password if (passChars === "lowercase") { charset = charset1; retVal = ""; for (var i = 0, n = charset.length; i < length; ++i) { //parses and prints like an array after choosing random whole numbers associated with the charlist retVal += charset.charAt(Math.floor(Math.random() * n)); } return retVal; } else if (passChars === "uppercase") { charset = charset2; retVal = ""; for (var i = 0, n = charset.length; i < length; ++i) { //parses and prints like an array after choosing random whole numbers associated with the charlist retVal += charset.charAt(Math.floor(Math.random() * n)); } return retVal; } else if (passChars === "numeric") { charset = charset3; retVal = ""; for (var i = 0, n = charset.length; i < length; ++i) { //parses and prints like an array after choosing random whole numbers associated with the charlist retVal += charset.charAt(Math.floor(Math.random() * n)); } return retVal; } else if (passChars === "special characters" || passChars === "special") { charset = charset4; retVal = ""; for (var i = 0, n = charset.length; i < length; ++i) { //parses and prints like an array after choosing random whole numbers associated with the charlist retVal += charset.charAt(Math.floor(Math.random() * n)); } return retVal; } else if (passChars === "all") { charset = charset5; retVal = ""; for (var i = 0, n = charset.length; i < length; ++i) { //parses and prints like an array after choosing random whole numbers associated with the charlist retVal += charset.charAt(Math.floor(Math.random() * n)); } return retVal; } else { alert("Please enter valid response") } } // I honestly couldnt figure out how to do this part of connecting two inputs and thier character sets, lemme know if I was on the right track here // Didnt want to code every variation and couldnt figureout how to do more than one variable // else if (passChars === "lowercase uppercase") { // charset = charset1 + charset2; // retVal = ""; // for (var i = 0, n = charset.length; i < length; ++i) { // //parses and prints like an array after choosing random whole numbers associated with the charlist // retVal += charset.charAt(Math.floor(Math.random() * n)); // } // return retVal; // } // else if (passChars === "lowercase numeric") { // charset = charset1 + charset3; // retVal = ""; // for (var i = 0, n = charset.length; i < length; ++i) { // //parses and prints like an array after choosing random whole numbers associated with the charlist // retVal += charset.charAt(Math.floor(Math.random() * n)); // } // return retVal; // } // else if (passChars === "lowercase special characters" || passChars === "lowercase special") { // charset = charset1 + charset3; // retVal = ""; // for (var i = 0, n = charset.length; i < length; ++i) { // //parses and prints like an array after choosing random whole numbers associated with the charlist // retVal += charset.charAt(Math.floor(Math.random() * n)); // } // return retVal; // } // else if (passChars === "uppercase numeric") { // charset = charset1 + charset3; // retVal = ""; // for (var i = 0, n = charset.length; i < length; ++i) { // //parses and prints like an array after choosing random whole numbers associated with the charlist // retVal += charset.charAt(Math.floor(Math.random() * n)); // } // return retVal; // } // else if (passChars === "uppercase special characters" || passChars === "uppercase special") { // charset = charset1 + charset3; // retVal = ""; // for (var i = 0, n = charset.length; i < length; ++i) { // //parses and prints like an array after choosing random whole numbers associated with the charlist // retVal += charset.charAt(Math.floor(Math.random() * n)); // } // return retVal; // } // else if (passChars === "lowercase numeric") { // charset = charset1 + charset3; // retVal = ""; // for (var i = 0, n = charset.length; i < length; ++i) { // //parses and prints like an array after choosing random whole numbers associated with the charlist // retVal += charset.charAt(Math.floor(Math.random() * n)); // } // return retVal; // } // else { // alert("Please input a vaild length.") // } } var password = generatePassword(); var passwordText = document.querySelector("#password"); passwordText.value = password; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function writePassword() {}", "function writePassword() {\n var password = getPasswordOptions();\n var passwordText = document.querySelector('#password');\n \n passwordText.value = password;\n }", "function writePassword() {\n var password = generatePassword();\n var passwordText = document.qu...
[ "0.8859371", "0.85438496", "0.8511671", "0.8501158", "0.8490387", "0.848501", "0.8472282", "0.8468989", "0.845468", "0.8444224", "0.84319127", "0.8420268", "0.8419394", "0.84066415", "0.8404136", "0.8400749", "0.8393203", "0.83766234", "0.83703816", "0.83647054", "0.83603424"...
0.0
-1
Function to polyfill currentScript implementation in browsers that do not support it yet.
function currentScript() { var s; var url; var l; var scripts; if (document && document.currentScript) { // By default use document.currentScript if supported s = document.currentScript; } else { // If document.currentScript is not supported, throw an error // and parse current script from the stack. try { throw new Error(); } catch (e) { l = e.stack.indexOf(" at ") !== -1 ? " at " : "@"; // In known browsers, last line of the stack defines the current script. url = e.stack.substring(e.stack.lastIndexOf(l) + l.length); if (l === " at ") { // In Chrome, last line in stack has URL in format: " at <url>:<line>:<column>" url = url.substring(0, url.lastIndexOf(':', url.lastIndexOf(':') - 1)); } else if (l === "@") { // In Firefox, last line in stack has URL in format: "<function>@<url>:<line>" url = url.substring(url.indexOf(l), url.lastIndexOf(':')); } else { throw new Error("Unsupported browser."); } // Find the matching script element from DOM scripts = document.getElementsByTagName("script"); for (var i = 0; i < scripts.length; i++) { if (scripts[i].src === url) { s = scripts[i]; break; } } } } if (!s) { s = document.location.href; } return s; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function a(){\n// Yes, this IS possible, i.e. if a script removes other scripts (or itself)\nif(0===b.length)return null;\n// Guaranteed accurate in IE 6-10.\n// Not supported in any other browsers. =(\nif(e)for(var c=b.length;c--;)if(b[c]&&\"interactive\"===b[c].readyState)return b[c];\n// If the native method ex...
[ "0.6164537", "0.60299563", "0.5718754", "0.5636772", "0.5620973", "0.5618859", "0.55516213", "0.5535876", "0.551209", "0.54013103", "0.53439987", "0.53439987", "0.53439987", "0.5342518", "0.5342279", "0.53011084", "0.53011084", "0.5274911", "0.52703124", "0.52667433", "0.5240...
0.49956706
66
Helper to turn any URL to absolute URL
function getFullURL(url) { var a = document.createElement('a'); a.href = url; return a.href; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function toAbsoluteURL (url) {\n // Handle absolute URLs (with protocol-relative prefix)\n // Example: //domain.com/file.png\n if (url.search(/^\\/\\//) != -1) {\n return window.location.protocol + url\n }\n\n // Handle absolute URLs (with explicit origin)\n // Example: http://domain.com/file.png\n if (u...
[ "0.77098393", "0.7584332", "0.7301124", "0.72774065", "0.6996715", "0.6968517", "0.6926654", "0.6926654", "0.6892214", "0.6834112", "0.68115216", "0.67346793", "0.6724591", "0.67167056", "0.67152554", "0.671055", "0.6678574", "0.6678574", "0.6678574", "0.6678574", "0.6671354"...
0.6799525
11
Skills not part of entities because they are generally secondary to combat
constructor(entityID, name, type) { this.entityID = entityID; this.name = name; this.type = type; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function useCombatSkills(target) {\n if (can_use(\"curse\") && character.mp > PriestSkills.Curse.mp\n\t && target.hp >= 3000) { \n useCurse(target); \n }\n}", "function getSkills() {\n return [\"sourceTerminalEducate1\", \"sourceTerminalEducate2\"].map(p => (0, _property.get)(p)).filter(s => s !=...
[ "0.7152382", "0.67659986", "0.65602875", "0.64951414", "0.6458999", "0.6360576", "0.6242282", "0.623798", "0.619012", "0.6186223", "0.59711385", "0.5914828", "0.5888018", "0.58555603", "0.58290476", "0.58237", "0.5806294", "0.57773054", "0.5766637", "0.5759327", "0.57244563",...
0.0
-1
Animation for Deep First Search
function animateDFS(eventStates, timer) { eventStates.visitedNodes.forEach((element, index) => { setTimeout(function() { element.classList += " visitedColor1" if (index === eventStates.visitedNodes.length - 1 && eventStates.pathFound) { buildPath(eventStates.pathStack, 1, eventStates.visitedNodes, eventStates.visitedNodesPainted) } }, timer * 100) timer++ }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function animation_search() { // search stored data (called after every keystroke)\n\n\tg.clearFoundNodes()\n\n\t// read keywords\n\tlet searchedItems=document.getElementById(\"itemSearch\").value;\n\tsearchedItems=searchedItems.replace(/&{2,}/ig,\"&&\");\n\tsearchedItems=searchedItems.replace(/\\band\\b/ig,\"&&\"...
[ "0.6432454", "0.6412045", "0.62924707", "0.61521906", "0.6067434", "0.6040848", "0.60053736", "0.592135", "0.5783697", "0.5774713", "0.5657008", "0.5636772", "0.5632732", "0.5612514", "0.56050813", "0.5604906", "0.5523592", "0.5504057", "0.54967767", "0.5469026", "0.54552853"...
0.5911778
8
Animation for Solution Path Function
function buildPath(pathStack, timer, visitedNodes, visitedNodesPainted) { pathStack.forEach(element => { setTimeout(function() {element.classList += " pathNode"}, timer * 50) timer++ }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function animateDijs() {\n const visitedNodes = dijkstra(nodes, startingPoins, endPoint);\n //dijsktra returna vse visited nodese\n //loopamo skozi vsakega in mu dodamo class listo visited z delajom\n for (let i = 0; i < visitedNodes.length; i++) {\n setTimeout(() => {\n const element = visitedNodes[i]...
[ "0.6657233", "0.66153085", "0.64257437", "0.63772994", "0.62759197", "0.62688094", "0.62205285", "0.61971843", "0.61558586", "0.6133099", "0.61285377", "0.61051744", "0.6075636", "0.60731256", "0.60587734", "0.6013519", "0.59956616", "0.595119", "0.5941957", "0.59110403", "0....
0.59574324
17
find active recipes in recipe index
async findActive() { const hits = await this.client.search({ index: this.index, body: { query: { match: { active: true } } } }) .then((searchResult) => util.getSourceArrayFromElasticHits(searchResult.hits.hits)); return hits; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "findRecipeIndex(given) {\n var index = -1;\n for (let i=0; i < this.state.recipes.length; i++) {\n let recipe = this.state.recipes[i];\n if (given.id === recipe.id) index = i;\n }\n return index;\n }", "function searchRecipes() {\n showAllRecipes();\n let searchedRecipes = domUpdates.rec...
[ "0.6363257", "0.58072037", "0.57035375", "0.56982964", "0.5644206", "0.56018406", "0.55009544", "0.5434071", "0.5388325", "0.53719735", "0.535207", "0.53029567", "0.52973366", "0.5265642", "0.52621263", "0.5218521", "0.52079785", "0.51781243", "0.51677346", "0.51564866", "0.5...
0.60573465
1
save a new recipe at recipe index
async save(recipe) { await this.client.index({ index: this.index, type: 'recipe', body: recipe }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function updateRecipeIndex(recipeIndex) {\n return recipeIndex += 1;\n}", "function getNewRecipe(recipes, recipeIndex) {\n if (recipeIndex === recipes.length) {\n recipeIndex = 0;\n };\n return recipes[recipeIndex];\n}", "updateRecipe(index, updatedRecipe) {\n const currentDate = new ...
[ "0.6728775", "0.65633345", "0.6540771", "0.6432865", "0.63027304", "0.62731975", "0.62525666", "0.6240305", "0.623022", "0.6198821", "0.6141804", "0.6126434", "0.6121264", "0.61185825", "0.6047725", "0.59907585", "0.5944663", "0.5906219", "0.58754385", "0.5869248", "0.5849228...
0.814804
0
function to calculate age
function calculateAge(birthday) { var ageDifMs = Date.now() - birthday.getTime(); var ageDate = new Date(ageDifMs); var today = new Date(Date.now()); var birthDate = new Date(birthday.getTime()); var ageYear = Math.abs(ageDate.getUTCFullYear() - 1970); if (birthDate.getUTCMonth() > today.getUTCMonth()) { ageYear = ageYear + 1 } return ageYear; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "calculateAge() {\n let date_1 = new Date(age);\n let diff = Date.now() - date_1.getTime();\n var age_date = new Date(diff);\n return Math.abs(age_date.getUTCFullYear() - 1970); \n }", "calculateAge(){\n return new Date().getFullYear() - this.birthYear;\n }", "calcAge() ...
[ "0.83564526", "0.8353982", "0.83460194", "0.8302368", "0.8276029", "0.82673925", "0.82479495", "0.8242147", "0.8242147", "0.82375485", "0.81795377", "0.8158136", "0.8148674", "0.81143963", "0.811438", "0.8108804", "0.8108804", "0.8108804", "0.8108804", "0.8107719", "0.8083613...
0.74391246
86
$('topbar').append( "&times;" + msg + "" ); }
function info(kind, msg){ toastr.options.timeOut = 1500; // 3秒 toastr.options = { "closeButton": true, "debug": false, "newestOnTop": false, "progressBar": false, "positionClass":'',// "toast-top-right", "preventDuplicates": false, "showDuration": "300", "hideDuration": "1000", "timeOut": "3000", "extendedTimeOut": "1000", "showEasing": "swing", "hideEasing": "linear", "showMethod": "fadeIn", "hideMethod": "fadeOut" } Command: toastr["info"]("", msg); $('#linkButton').click(function() { toastr.success('click'); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function addMessage(msg){\n $('#msgs').text(msg+\" \");\n}", "function createToast(msg){\n var sec = '<section class=\"comToast\"><i><em class=\"rotate\"></em>'+msg+'</i></section>'\n $(\"body\").append(sec)\n}", "function log(msg, extra) {\n $(\"#progress\").html(\"[\" + throbber() +\"] \" + msg)...
[ "0.65490794", "0.6164583", "0.6152125", "0.60779345", "0.60326827", "0.60076815", "0.5995997", "0.59660107", "0.5959853", "0.5935639", "0.5929382", "0.5929382", "0.5929382", "0.5915077", "0.5894763", "0.58936036", "0.58762157", "0.58643234", "0.58587724", "0.58537716", "0.584...
0.0
-1
Funcion que se ejecuta automaticamente al momento de crear un objeto
constructor( _aforo = 0, _nroMesas = 0, _direccion = "Sin Dirección", _categoria = "Sin Categoria", _telefonos = [], _nombre = "Sin Nombre", _delivery = false ) { // this : acceder al scope interno de la clase. // this: se usa para acceder a los atributos y métodos de la clase. this.aforo = _aforo; this.nroMesas = _nroMesas; this.direccion = _direccion; this.categoria = _categoria; this.telefonos = _telefonos; this.nombre = _nombre; this.delivery = _delivery; if (this.aforo > 500) { this.tipificacion = "A"; } else if (this.aforo > 300) { this.tipificacion = "B"; } else { this.tipificacion = "C"; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function callCreate(object){ object.create(); }", "function NewObj(){}", "function create() {\n\n}", "function NewObj() {}", "create() {}", "create() {}", "function Obj(nome){\n this.nome = nome;\n\n //Também posso colocar uma função dentro da função utilizando o This.\n this.exec = function()...
[ "0.71256655", "0.6812115", "0.6805432", "0.6586289", "0.6536589", "0.6536589", "0.64986926", "0.64719373", "0.64719373", "0.6470421", "0.63463557", "0.6298698", "0.62736005", "0.6259337", "0.6191941", "0.61126965", "0.6041207", "0.6037765", "0.6026295", "0.6007755", "0.598371...
0.0
-1
! QTip content class
function e(t){var e,i;this.qTipTitle=null,this.qTipText=null,this.qTipInnerHTML=null,null!=(i=/^\(tooltip: ?(.+)\|(.+)(?=\))\)$/.exec(t.text()))&&3==i.length?(this.qTipTitle=i[1],this.qTipText=i[2],e=/^(.+)\|/,this.qTipInnerHTML=(i[1]+"|"+i[2]).replace(e,"")):null!=(i=/^(.+)\|(.+)$/.exec(t.text()))&&3==i.length?(this.qTipTitle=i[1],this.qTipText=i[2],e=/^(.+)\|/,this.qTipInnerHTML=t.html().replace(e,"")):(this.qTipText=t.text(),this.qTipInnerHTML=t.html())}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function QTip() {\n\n var myPos = {\n bot: { target: 'mouse', my: 'top left', at: 'bottom right', adjust: { x: 10, y: 20 } },\n top: { target: 'mouse', my: 'bottom left', at: 'top right', adjust: { x: 5, y: 0 } }\n };\n\n // destroy artifacts before creating again\n $('.qtip').each(functi...
[ "0.7049935", "0.6864895", "0.6725652", "0.6618779", "0.65898836", "0.65264857", "0.65219426", "0.644716", "0.6337036", "0.6306295", "0.62927043", "0.62899566", "0.62856567", "0.6284843", "0.62822443", "0.6251952", "0.6187662", "0.618707", "0.6166852", "0.6110105", "0.6073733"...
0.62565506
15
This functions will show the game rules and how to play.
function showRules() { const rules = document.getElementById('rules'); rules.addEventListener('click', function() { gameBoardDiv.innerHTML = gameRules; document.getElementById('game-options-btn').addEventListener('click', gameSetUp); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function showRules() {\n layer.open({\n type: 2,\n title: 'U Know Uno Rules',\n closeBtn: 1,\n area: ['400px', '600px'],\n shade: 0.5,\n shadeClose: true,\n content: ['/game/rules'],\n });\n}", "function rules() {\n deck1.style.display = \"inline-flex\";\...
[ "0.71473426", "0.6802846", "0.6761807", "0.65881306", "0.6532672", "0.63516384", "0.6320588", "0.63001645", "0.6292882", "0.62219536", "0.61657524", "0.610203", "0.6045461", "0.5962663", "0.5929893", "0.59177315", "0.5852164", "0.5838151", "0.58245564", "0.581334", "0.5797396...
0.6572605
4
This function will show the short game when the button is clicked
function shortGameSwitch() { const shortGameButton = document.getElementById('short-game'); shortGameButton.addEventListener('click', function() { winningScore = 3; gameBoardDiv.innerHTML = playGame; userButtons(); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function showTheGame () {\n\t$(\".game\").show();\n\t$(\".startNowButton\").hide();\n\trun();\n}", "static showGame() {\n document.getElementById('js-player-selection').style.display = 'none';\n document.getElementById('js-game-info').style.display = 'block';\n }", "function startGame() {\n console.l...
[ "0.79256606", "0.7576968", "0.75040317", "0.7369402", "0.7254361", "0.7236237", "0.712868", "0.71195614", "0.70616066", "0.70537007", "0.70470524", "0.7038137", "0.6998007", "0.69747096", "0.69696754", "0.6951997", "0.69408536", "0.693978", "0.693711", "0.6933297", "0.6928311...
0.69350624
19
This function will show the medium game when the button is clicked
function mediumGameSwitch() { const mediumGameButton = document.getElementById('medium-game'); mediumGameButton.addEventListener('click', function() { winningScore = 5; gameBoardDiv.innerHTML = playGame; userButtons(); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function showTheGame () {\n\t$(\".game\").show();\n\t$(\".startNowButton\").hide();\n\trun();\n}", "static showGame() {\n document.getElementById('js-player-selection').style.display = 'none';\n document.getElementById('js-game-info').style.display = 'block';\n }", "function startGame() {\n $(\".land...
[ "0.7501749", "0.749983", "0.7297137", "0.72782695", "0.707593", "0.69698155", "0.6947463", "0.69370395", "0.6928613", "0.69086444", "0.6884923", "0.68679845", "0.68591386", "0.6843045", "0.6814522", "0.6812724", "0.67777157", "0.6763472", "0.6749749", "0.67435306", "0.6741372...
0.660586
56
This function will show the long game when the button is clicked
function longGameSwitch() { const longGameButton = document.getElementById('long-game'); longGameButton.addEventListener('click', function() { gameSwitch(10); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function showTheGame () {\n\t$(\".game\").show();\n\t$(\".startNowButton\").hide();\n\trun();\n}", "function newGame() {\n $(\"#startbtn\").hide();\n $(\"#letsplay\").hide();\n $(\"#timer\").show();\n $(\"#trivia\").show();\n $(\"#results\").hide();\n }", "function startGa...
[ "0.74771273", "0.7464908", "0.71414936", "0.7080001", "0.70581275", "0.7051997", "0.6859884", "0.68432623", "0.68336165", "0.68253654", "0.6760477", "0.6758627", "0.6717905", "0.67132956", "0.6682015", "0.6668874", "0.665851", "0.66489077", "0.6645218", "0.6633046", "0.662999...
0.7024242
6
This function will set the winning score for the correct game
function gameSwitch(score) { winningScore = score; gameBoardDiv.innerHTML = playGame; userButtons(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function trackScore() {\n if (totalScore === goalNum) {\n wins++;\n console.log(\"wins\");\n award();\n reset();\n\n\n }\n else if (totalScore > goalNum) {\n losses++;\n console.log(\"losses\");\n award();\n ...
[ "0.77027047", "0.76365936", "0.7592378", "0.75730866", "0.7558754", "0.75163543", "0.74998707", "0.7494239", "0.7473026", "0.74717087", "0.74711347", "0.74539864", "0.745383", "0.74352354", "0.74344635", "0.7427988", "0.7346863", "0.7344241", "0.73384815", "0.7337046", "0.730...
0.0
-1
This function will store the name. of the user
function userInput() { playButton.addEventListener('click', function() { let userInputName = document.getElementById('fname').value.trim(); firstName = userInputName; if(!userInputName) { document.getElementById('message').innerHTML = '<span style="color:red">Please enter your name to play!</span>'; } else { gameSetUp(); } }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function saveName(text) {\n localStorage.setItem('currentUser', text);\n}", "name(){\n if(this.loggedIn()){\n return localStorage.getItem('user');\n }\n }", "function saveName() {\n\n localStorage.setItem('receivedName', userName);\n}", "function set_user_name(new_name){\n //...
[ "0.7591142", "0.7477006", "0.7373185", "0.73558396", "0.73155993", "0.7300443", "0.72994286", "0.72643137", "0.72085536", "0.7189789", "0.7168493", "0.7141915", "0.7043837", "0.7043837", "0.7006488", "0.70010155", "0.6968903", "0.6947915", "0.6947915", "0.6947915", "0.6940284...
0.0
-1
This function allows the user to select the game of their choice and relays a message back to the user.
function gameSetUp() { userScore = 0; computerScore = 0; gameBoardDiv.innerHTML = gameOptions; document.getElementById('message').innerHTML = ('Hey ' + firstName + ' are you ready to play? Choose from the different game options below'); userInputDiv.classList.add('hide'); showRules(); shortGameSwitch(); mediumGameSwitch(); longGameSwitch(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function startGame() {\n setMessage(\"Select an opponent above\");\n}", "onChooseGame(proceed, game) {\n this.chooseGameScreen.hide();\n if (proceed) {\n this.chosenGame = game;\n }\n this.show();\n }", "function mainGame(player_choice) {\n var p_choice, Com_choice;\n p_choice = play...
[ "0.75555795", "0.7214138", "0.7168789", "0.70475537", "0.700405", "0.69988626", "0.6967422", "0.6944197", "0.6942699", "0.6901377", "0.68435216", "0.6824483", "0.68182784", "0.6790412", "0.67861", "0.67837745", "0.67745197", "0.6753057", "0.6739611", "0.67296934", "0.6723017"...
0.0
-1
This function will display the user and computer choice with a capital first letter to the user.
function convertWord(word) { if(word === 'rock') return 'Rock'; if(word === 'paper') return 'Paper'; if(word === 'scissors') return 'Scissors'; if(word === 'lizard') return 'Lizard'; if(word === 'spock') return 'Spock'; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function displayComputerChoice(ch){\n showcompChooses()\n var cmpch = \"\"\n switch(ch){\n case \"paper\": cmpch = \"✋\"; break;\n case \"rock\": cmpch = \"✊\"; break;\n case \"scissors\": cmpch = \"✌\"; break;\n }\n compChooses.innerHTML = cmpch\n}", "function displayComputer...
[ "0.7598291", "0.7146665", "0.7036675", "0.70187587", "0.6894463", "0.6885317", "0.6761332", "0.67250913", "0.6697743", "0.6684224", "0.6664462", "0.66446096", "0.6632928", "0.65805554", "0.6559557", "0.65559715", "0.6530172", "0.6443079", "0.6442809", "0.6435088", "0.6332778"...
0.0
-1
This function will run if the user wins and display a message and increment the user score.
function win(userChoice, computerChoice) { userScore++; const userScoreSpan = document.getElementById('user-score'); const computerScoreSpan = document.getElementById('computer-score'); const resultDiv = document.querySelector('.result > p'); userScoreSpan.innerHTML = userScore; computerScoreSpan.innerHTML = computerScore; resultDiv.innerHTML = `${convertWord(userChoice)} beats ${convertWord(computerChoice)}. ${firstName} WINS!`; checkWinner(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function checkWin() {\n if (userScore === numToMatch) {\n wins++;\n $(\"#wins\").text(\"Success: \" + wins);\n reset();\n } else if (userScore > numToMatch) {\n losses++\n $(\"#losses\").text(\"Fails: \" + losses);\n reset();\n ...
[ "0.82364523", "0.8164018", "0.80193216", "0.80061406", "0.7931107", "0.7907339", "0.79067934", "0.7886553", "0.78775454", "0.78325224", "0.7827683", "0.7789049", "0.77812016", "0.77715045", "0.7768628", "0.77468544", "0.77444226", "0.77391803", "0.7724045", "0.77147305", "0.7...
0.74610317
62
This function will run if the computer wins and display a message and increment the computer score.
function lose(userChoice, computerChoice) { computerScore++; const userScoreSpan = document.getElementById('user-score'); const computerScoreSpan = document.getElementById('computer-score'); const resultDiv = document.querySelector('.result > p'); userScoreSpan.innerHTML = userScore; computerScoreSpan.innerHTML = computerScore; resultDiv.innerHTML = `${convertWord(userChoice)} loses to ${convertWord(computerChoice)}. ${firstName} LOST!`; checkWinner(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function gameLogic() {\n if (totalScore === computerGuess) {\n wins++;\n $(\"#wins-text\").text(wins); \n initGame(); \n }\n else if (totalScore > computerGuess) {\n losses++;\n $...
[ "0.8016024", "0.7953085", "0.79438645", "0.79312414", "0.7773743", "0.7761908", "0.7760909", "0.77603596", "0.77462745", "0.7731678", "0.77294624", "0.7711659", "0.76931757", "0.76844615", "0.7672323", "0.76701164", "0.7663039", "0.7651839", "0.76193243", "0.7596877", "0.7584...
0.0
-1
This function will run if the game is a draw and display a message.
function draw(userChoice, computerChoice) { const resultDiv = document.querySelector('.result > p'); resultDiv.innerHTML = `${convertWord(userChoice)} equals ${convertWord(computerChoice)}. Its a DRAW!`; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function draw() {\n //If game has just started, show intro screen\n if (!isGameOver && !isGameRunning) {\n displayIntroScreen();\n // if game is over, show end screen\n } else if (isGameOver) {\n displayEndScreen();\n //Otherwise, go to gameplay\n } else {\n gamePlay();\n }\n}", "function isD...
[ "0.7211422", "0.7180911", "0.7165688", "0.7149148", "0.71297437", "0.7115022", "0.7090636", "0.7064064", "0.7040573", "0.7023049", "0.701427", "0.70016897", "0.6991214", "0.6968227", "0.69629675", "0.6950758", "0.6940813", "0.69010484", "0.68815815", "0.6868453", "0.68521374"...
0.0
-1
This function will check if the user or computer wins the game
function checkWinner() { if (winnerCalled()) { gameOver(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function winCheck() {\n if (userScore === computerPick) {\n wins++;\n $(\"#wins\").html(\"Wins: \" + wins);\n alert(\"Winning isn’t everything, it’s the ONLY thing\");\n newGame();\n }\n\n else if (userScore > computerPick) {\n losses++;\n...
[ "0.80144024", "0.7985685", "0.7947991", "0.7864604", "0.7818863", "0.7759701", "0.77021164", "0.7628775", "0.7628163", "0.7592327", "0.75917673", "0.7569227", "0.75686955", "0.75490785", "0.75052685", "0.749643", "0.74655885", "0.74232286", "0.7420035", "0.7384131", "0.736853...
0.7297341
24
This function displays the winning or losing page and returns to the user the final score
function gameOver() { if (userScore > computerScore) { gameBoardDiv.innerHTML = ` <div id="winner-page"> <h2 id="win-msg">Awesome ${firstName}, You Won!!!</h2> <p id="final-score"> ${userScore} : ${computerScore}</p> <button id="play-again-btn" class="btn">Play Again</button> <button id="game-options-btn" class="btn">Game Options</button> <button id="end-game" class="btn">End Game</button> </div>`; } else { gameBoardDiv.innerHTML = ` <div id="loser-page"> <h2 id="win-msg">Unlucky ${firstName}, You Lost!!!</h2> <p id="final-score"> ${userScore} : ${computerScore}</p> <button id="play-again-btn" class="btn">Play Again</button> <button id="game-options-btn" class="btn">Game Options</button> <button id="end-game" class="btn">End Game</button> </div>`; } document.getElementById('play-again-btn').addEventListener('click', resetGame); document.getElementById('game-options-btn').addEventListener('click', gameSetUp); document.getElementById('end-game').addEventListener('click', endGame); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function winLose() {\n\tif (totalScore === startScore) {\n\t\twins++;\n\t\t$('#wins').html(wins);\n\t\t$(\"#resultText\").html(\"YOU WIN. Play again?\");\n\t\t$('#playAgain').show();\n\n// User loses\n\t} else if (totalScore > startScore) {\n\t\tlosses++;\n\t\t$('#losses').html(losses);\n\t\t$(\"#resultText\").htm...
[ "0.7561938", "0.7483988", "0.7315008", "0.73067886", "0.7268102", "0.72070986", "0.71914876", "0.7185188", "0.7169657", "0.71563435", "0.71515816", "0.7139866", "0.71398133", "0.71226203", "0.71150255", "0.70973945", "0.70621175", "0.70476794", "0.704073", "0.7018802", "0.701...
0.0
-1
This function will end the game and return to the starting page where the user can use a different name.
function endGame() { location.reload(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function endGame() {\n location.href = \"index.html\";\n}", "function endGame() {\n window.location.href = \"scores.html\"\n\n}", "function endGame() {\n resetMainContainer();\n loadTemplate(\"result\", displayResults);\n}", "exitGame() {\n // !Maybe solution for AppLogger or similar\n se...
[ "0.7745178", "0.7527758", "0.7447975", "0.7223624", "0.7143854", "0.7098863", "0.7084583", "0.70414895", "0.7024902", "0.7011001", "0.70003265", "0.6953265", "0.6945182", "0.6919845", "0.6907054", "0.6883595", "0.68716943", "0.6857935", "0.68524194", "0.6797928", "0.676351", ...
0.7188817
4
This function will reset the game so the user can play a different game with the score back to 0 0.
function resetGame() { userScore = 0; computerScore = 0; gameSwitch(winningScore); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function gameReset() {\n totalScore = 0;\n setupGame();\n }", "function resetGame () { \n\t\t\t\t\t\t\tblueNum = 0;\n\t\t\t\t\t\t greenNum = 0;\n\t\t\t\t\t\t\tredNum = 0;\n\t\t\t\t\t\t\tyellowNum = 0;\n\t\t\t\t\t\t scoreResult=0;\n\t\t\t\t\t\t\ttargetScore = 0;\n\t\t\t\t\t\t\tgetNumber(); ...
[ "0.8944818", "0.87720746", "0.8692777", "0.86267275", "0.8585004", "0.8514385", "0.8469675", "0.841739", "0.8402897", "0.83945405", "0.8392994", "0.8378604", "0.8367285", "0.8366106", "0.83601063", "0.83186424", "0.8318569", "0.83173645", "0.8314747", "0.83129466", "0.8283629...
0.906749
0
This function determines a winner between the users choice and the computer choice. This will inturn run the win, lose or draw functions Inspiration taken from freecodecamp.org and adapted for this project
function game(userChoice) { const computerChoice = getComputerChoice(); const userMoveButton = document.getElementById(userChoice); userMoveButton.classList.toggle('user-color'); setTimeout(function(){ userMoveButton.classList.toggle('user-color'); }, 1000); const computerMoveButton = document.getElementById(computerChoice); computerMoveButton.classList.toggle('comp-color'); setTimeout(function(){ computerMoveButton.classList.toggle('comp-color'); }, 1000); switch (userChoice + computerChoice) { case 'rockscissors': case 'rocklizard': case 'paperrock': case 'paperspock': case 'scissorspaper': case 'scissorslizard': case 'lizardpaper': case 'lizardspock': case 'spockrock': case 'spockscissors': win(userChoice, computerChoice); break; case 'rockpaper': case 'lizardrock': case 'paperscissors': case 'spockpaper': case 'scissorsrock': case 'lizardscissors': case 'paperlizard': case 'spocklizard': case 'rockspock': case 'scissorsspock': lose(userChoice, computerChoice); break; case 'rockrock': case 'paperpaper': case 'scissorsscissors': case 'lizardlizard': case 'spockspock': draw(userChoice, computerChoice); break; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function checkWinner() {\n\n // Select any random icon \n const computerChoice = pickRandomChoice();\n \n // Display user and computer choice\n updateSelection(user_select, userChoice);\n updateSelection(computer_select, computerChoice);\n\n //GAME RULES \n // D...
[ "0.8365047", "0.80735725", "0.7972716", "0.793198", "0.7917091", "0.7813948", "0.7760188", "0.7735956", "0.77248573", "0.7720769", "0.76940197", "0.7643622", "0.761981", "0.7615635", "0.7604997", "0.7597924", "0.7581282", "0.75706184", "0.7560121", "0.7559949", "0.7554042", ...
0.74767166
29
This function will randomly pick one of the 5 choices to play against the users choice.
function getComputerChoice() { let choices = ['rock', 'paper', 'scissors', 'lizard', 'spock']; let randomNumber = Math.floor(Math.random() * 5); return choices[randomNumber]; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function pickRandomChoice(){\n return choices[Math.floor(Math.random() * choices.length)];\n}", "function chooseRandom(){\n const choices = ['rock', 'paper', 'scissors']\n return choices[Math.floor(Math.random()*3)]\n}", "function choose(choices) {\n var index = Math.floor(Math.random() * choices.length);...
[ "0.7849351", "0.78324777", "0.7793877", "0.7763152", "0.75315994", "0.75022095", "0.7418743", "0.7413068", "0.73982453", "0.7349028", "0.73479474", "0.7345246", "0.73128045", "0.72996026", "0.7270848", "0.7269293", "0.7264135", "0.7263545", "0.72630405", "0.72602814", "0.7259...
0.7288297
14
This function listens for the users input of either Rock, Paper, Scissors, Lizard or Spock and then plays the game function Inspiration taken from freecodecamp.org and adapted for this project.
function userButtons() { const rockDiv = document.getElementById('rock'); rockDiv.addEventListener('click', function() { game('rock'); }); const paperDiv = document.getElementById('paper'); paperDiv.addEventListener('click', function() { game('paper'); }); const scissorsDiv = document.getElementById('scissors'); scissorsDiv.addEventListener('click', function() { game('scissors'); }); const lizardDiv = document.getElementById('lizard'); lizardDiv.addEventListener('click', function() { game('lizard'); }); const spockDiv = document.getElementById('spock'); spockDiv.addEventListener('click', function() { game('spock'); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function game () {\n let playerSelection = prompt(\"type in one of the following three choices. rock, paper, or scissors.\");\n playRound(playerSelection, computerPlay());\n\n}", "function playRound()\n{\n // Creates a playerChoice variable that prompts user to input ONLY one of the three following choi...
[ "0.80014884", "0.7581586", "0.75216043", "0.75149417", "0.74818027", "0.7478868", "0.74580306", "0.74169576", "0.7411759", "0.74061215", "0.74059504", "0.73718745", "0.735976", "0.7359178", "0.73312414", "0.7329085", "0.73248196", "0.7320327", "0.73173445", "0.7314392", "0.73...
0.0
-1
there are the initlisteners that contain the callout listener that allows the user to continue past loggin in
function initListeners(){ $("#submit").click(function(e) { e.preventDefault() let text = $("#callout-text").val(); gsap.to($(".modal"), {ease: "elastic.in", scale: 0, duration: 2, onComplete: showAlert, onCompleteParams: [text]}); console.log("Signing In! Please wait one sec.") }) $("#showModal").click(function(e) { gsap.to($(".modal"), {ease: "elastic.out", scale: 1, duration: 2}); addModalListener(); }); $(window).on("hashchange", route); route(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "_eventLogin() {\n console.info('Successfully logged in! Initializing wiki listeners...');\n this._readLine();\n }", "function onLogin() {}", "function oninitialized() {\n\t // focus once ready\n\t this.once(this.options.mode + ' ready', bind(this.focusInput, this));\n\t\n\t // resolve...
[ "0.70823216", "0.6977942", "0.6829951", "0.6643848", "0.66405976", "0.6632087", "0.6589833", "0.6589091", "0.6523521", "0.6417849", "0.63825136", "0.632465", "0.62928", "0.6292583", "0.6276501", "0.6239415", "0.62298226", "0.62063193", "0.61853784", "0.6179994", "0.6145796", ...
0.6016871
32
this is the alert for the user for when they sign in
function showAlert(info) { console.log("Welcome back " + info) $("callout-text").val("") }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "signIn() {}", "function interactiveSignIn() {\r\n }", "function loginAlert() {\n alert(\" this feature is not available yet\");\n }", "function showSignedIn() {\n\talert(\"sign in success\")\n\tdocument.getElementById(\"signin_btn\").innerHTML = \"Sign Out\"\n}", "function disp_alert(email) {\n ...
[ "0.7271118", "0.7073771", "0.67967427", "0.6783904", "0.6769322", "0.6758762", "0.66974515", "0.66890335", "0.6640013", "0.6554002", "0.6548392", "0.65374345", "0.6531853", "0.65310687", "0.6518337", "0.6494229", "0.6491431", "0.6473778", "0.64708287", "0.6460762", "0.6433345...
0.0
-1
Shuffles words and globalPool arrays.
static shuffle() { shuffleWords(words); shuffleWords(globalPool); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "buildAndShuffleWords() {\n const listLength = this.puzzelWordList.length;\n for (let i = 0; i < listLength; i++) {\n const nextName = this.puzzelWordList[Math.floor(Math.random() * this.puzzelWordList.length)];\n this.words.push(new word_js_1.Word(nextName));\n // rem...
[ "0.7015205", "0.6578831", "0.6428992", "0.63485223", "0.6340124", "0.628616", "0.62177044", "0.6183643", "0.6083685", "0.6029022", "0.591527", "0.58977044", "0.58523756", "0.58316255", "0.5814692", "0.58076155", "0.5798253", "0.5789899", "0.57680595", "0.5757696", "0.5747528"...
0.8206069
0
create index marker for the first string loop over the second string if the current char is the same as the first string at index marker increase index marker check if index marker is equal to length1
function isSubsequence(str1, str2) { let currIdx = 0; for (let i = 0; i < str2.length; i++) { if (str2[i] === str1[currIdx]) { currIdx++; } if (currIdx === str1.length) { return true; } } return false; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function stringRotation(str1, str2) {\n const arr1 = str1.split('')\n const arr2 = str2.split('')\n\n if(arr1.length !== arr2.length) {\n return false\n }\n\n const letter = arr2[0]\n const arr2Index = 0\n let letterIndex = []\n let arr1End = 0\n let arr2End = 0\n \n for(let ...
[ "0.6807782", "0.6552699", "0.65270025", "0.65111965", "0.63857824", "0.6250863", "0.6227726", "0.6168091", "0.61616105", "0.61232793", "0.6122945", "0.6121348", "0.61190605", "0.61175776", "0.6106473", "0.609835", "0.60828555", "0.6081089", "0.6065538", "0.60342467", "0.60143...
0.0
-1
look up table of what the scores corespond to so that we can return X/O rather than a number minimax function called go generate a scare for the comp when placed in position x,y
function minimax(board, depth, isMaximizing) { let result = checkWinner(); // check to see if there is a winner already if (result !== null ) // if a winner is already found... { return scores[result]; // return the winner, don't execute minimax function } // when generating all possible outcomes, maximize score (assuming player will make best possible move) if (isMaximizing) // if it is the user's turn, they will be maximizing { let bestScore = -Infinity; for (let i = 0; i < 3; i++) { for (let j = 0; j < 3; j++) { if (board[i][j] == '') { board[i][j] = ai; // place the comp move and continue with the simulation by placing the next user move let score = minimax(board, depth + 1, false); // increase depth of recursion and set isMaximizing to false to next simulate comp move board[i][j] = ''; // remove user character from the spot after the minimax algorithm has run bestScore = max(score, bestScore); // in this exact series of moves, if the resulting score is bigger than the current, set a new } } } return bestScore; // return the best possible outcome after all the simulations } else // executed when simulating comp's move, minimizing the score to get best move for comp { let bestScore = Infinity; for (let i = 0; i < 3; i++) { for (let j = 0; j < 3; j++) { if (board[i][j] == '') { board[i][j] = human; // place a user move and continue the simulation by placing the next comp move let score = minimax(board, depth + 1, true); // increase depth of recursion and set isMaximizing to true to next simulate user move board[i][j] = ''; // remove the ai character from the spot after the minimax algorithm has run bestScore = min(score, bestScore); // in this exact series of moves, if the resulting score is smaller than the current, set a new } } } return bestScore; // return the best possible outcome after all the simulations } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function resultSimulator(head,score){\r\n\t\r\n\tif(head=='X'){\r\n\t\treturn([score/2,score/2]);\r\n\t}\r\n\tif(score==0){\r\n\t\treturn([0,0]);\r\n\t}\r\n\t\r\n\tvar x = Math.floor(Math.random() * (score + 1));\r\n\tvar y=0;\r\n\t\t\r\n\twhile(x==score/2){\r\n\t\tx = Math.floor(Math.random() * (score + 1));\r\n\...
[ "0.6233208", "0.6190544", "0.61833674", "0.61057615", "0.6072378", "0.60229814", "0.5989123", "0.59828997", "0.59638315", "0.59426564", "0.5934414", "0.5931931", "0.59130037", "0.59123755", "0.58811235", "0.58704615", "0.58664894", "0.58523726", "0.5848824", "0.58366436", "0....
0.0
-1
Calls if the google maps is sucessfully loaded
function googleMapSuccess() { ko.applyBindings(new AppViewModel()); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function handleLoadMapFailure() {\n alert(\"failed to load google map, check your network connection and try again\");\n}", "function googleError() {\n alert('Google Maps has failed to load. Please check your internet connection or try again later.');\n}", "function initMapLoadError() {\n alert('Fehle...
[ "0.7541678", "0.73836994", "0.7383197", "0.73823524", "0.73710126", "0.72662634", "0.72370607", "0.7197095", "0.7150449", "0.7143591", "0.7142924", "0.70954156", "0.7083563", "0.7078327", "0.70665777", "0.7058847", "0.7053018", "0.7031328", "0.70063937", "0.69609493", "0.6848...
0.0
-1
Calls if google maps can't be loaded
function googleMapError() { document.body.innerHTML = "<center><h5>Please Try again !!<br> Unable to load Google Maps</h5></center>"; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function googleError() {\n alert('Google Maps has failed to load. Please check your internet connection or try again later.');\n}", "function handleLoadMapFailure() {\n alert(\"failed to load google map, check your network connection and try again\");\n}", "function googleError() {\n alert('Google Map...
[ "0.7849104", "0.784847", "0.7810143", "0.7744265", "0.76985765", "0.76954156", "0.76680505", "0.7646239", "0.75793844", "0.75786513", "0.75128883", "0.7485629", "0.74768674", "0.73781586", "0.7321989", "0.72910243", "0.72659755", "0.72620153", "0.7260308", "0.72114205", "0.71...
0.68557745
41
This sample demonstrates how to Lists the Alerts for external cloud provider type defined.
async function externalBillingAccountAlerts() { const externalCloudProviderType = "externalBillingAccounts"; const externalCloudProviderId = "100"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); const result = await client.alerts.listExternal( externalCloudProviderType, externalCloudProviderId ); console.log(result); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async function externalSubscriptionAlerts() {\n const externalCloudProviderType = \"externalSubscriptions\";\n const externalCloudProviderId = \"100\";\n const credential = new DefaultAzureCredential();\n const client = new CostManagementClient(credential);\n const result = await client.alerts.listExternal(\n...
[ "0.7066875", "0.5707291", "0.5629416", "0.52275634", "0.52010137", "0.49885908", "0.49273384", "0.48920318", "0.48852083", "0.48751047", "0.48640934", "0.48419085", "0.48086", "0.480104", "0.47766417", "0.4720728", "0.46952936", "0.4681759", "0.4680773", "0.46707687", "0.4669...
0.7009354
1
This sample demonstrates how to Lists the Alerts for external cloud provider type defined.
async function externalSubscriptionAlerts() { const externalCloudProviderType = "externalSubscriptions"; const externalCloudProviderId = "100"; const credential = new DefaultAzureCredential(); const client = new CostManagementClient(credential); const result = await client.alerts.listExternal( externalCloudProviderType, externalCloudProviderId ); console.log(result); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async function externalBillingAccountAlerts() {\n const externalCloudProviderType = \"externalBillingAccounts\";\n const externalCloudProviderId = \"100\";\n const credential = new DefaultAzureCredential();\n const client = new CostManagementClient(credential);\n const result = await client.alerts.listExterna...
[ "0.7008912", "0.570481", "0.56278455", "0.52279264", "0.519938", "0.49880582", "0.4926878", "0.48934814", "0.4882791", "0.48760593", "0.48637012", "0.4840426", "0.48067427", "0.48015043", "0.47771028", "0.47242486", "0.46944013", "0.4680661", "0.46805945", "0.46714103", "0.46...
0.7066711
0
Like Math.max, but for strings too!
function maxString (str1, str2) { return (str1 > str2 ? str1 : str2); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function max() {\r\n\tvar items = max.arguments;\r\n\tvar items2 = new Array();\r\n\tvar thisnum;\r\n\tvar count = 0;\r\n\tfor (i = 0; i < items.length; i++) {\r\n\t\tthisnum = items[i];\r\n\t\tif (isFloat(thisnum) && thisnum != 'NaN') {\r\n\t\t\titems2[count] = thisnum;\r\n\t\t\tcount++;\r\n\t\t} else if (thisnum...
[ "0.7537946", "0.72679615", "0.7242232", "0.7220258", "0.7186435", "0.71606404", "0.7152298", "0.7133245", "0.7074072", "0.70637953", "0.70394176", "0.70247334", "0.7004909", "0.6991145", "0.6988522", "0.69857866", "0.6977116", "0.69591004", "0.6943963", "0.69223094", "0.69159...
0.0
-1
Run command returning stdout as array of string per line
function exec (command) { var result = execFunc(command); // Account for native execSync result vs execSync module result result = ('stdout' in result ? result.stdout : result.toString()); return result.trim().split('\n'); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function gitOutputAsArray(gitCommandResult) {\n return gitCommandResult.stdout.split('\\n').map(function (x) { return x.trim(); }).filter(function (x) { return !!x; });\n}", "function gitOutputAsArray(gitCommandResult) {\n return gitCommandResult.stdout.split('\\n').map(function (x) { return x.trim(); ...
[ "0.64831805", "0.6483013", "0.5807744", "0.5740993", "0.56876534", "0.5661478", "0.5661478", "0.5661478", "0.5652138", "0.5559996", "0.549755", "0.5492934", "0.54576737", "0.54144925", "0.5405259", "0.5397016", "0.53934276", "0.5345099", "0.53272474", "0.5251209", "0.52472997...
0.69529516
0
number we search for
function doBetterLinearSearch(array, arraySize, searchedElement) { var defaultAnswer = "NOT_FOUND"; for (var i = 0; i < arraySize; i++) { array[i] = Math.floor((Math.random() * 100) + 1); /* 10 random numbers from 1 to 100*/ console.log(array[i]); if (array[i] === searchedElement) break; } i < arraySize ? console.log("Index of searched element is " + (i+1)) : console.log("Index of searched element is " + defaultAnswer); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function search(arr, num) {\n for(let i = 0; i< arr.length; i++) {\n if(arr[i] == num) {\n return i;\n }\n }\n return -1\n}", "function findMostOccurence(number) {\n\n}", "function find(num_array, a_num) {\n return num_array.indexOf(a_num);\n }", "function indexCalculator(n...
[ "0.657057", "0.6464939", "0.6423987", "0.63916886", "0.6368185", "0.6367359", "0.6337759", "0.6217666", "0.61769027", "0.6138606", "0.6138606", "0.6130071", "0.6068933", "0.6052394", "0.6050791", "0.60491264", "0.6039345", "0.6021152", "0.59999937", "0.5989115", "0.59857035",...
0.0
-1
Helper to splice json array
function findAndRemove(array, property, value) { array.forEach(function (result, index) { if (result[property] === value) { //Remove from array array.splice(index, 1); } }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function jpt_splice(arr, index) {\n\t for (var i = index, len = arr.length - 1; i < len; i++)\n\t arr[i] = arr[i + 1];\n\n\t arr.length = len;\n\t}", "function RemovePed(array, property, value) {\n var numero, result, i;\n $.each(array, function(index){\n result = array[index];\n switch (r...
[ "0.651407", "0.6455543", "0.6325157", "0.6270657", "0.6177077", "0.6086148", "0.59904134", "0.5972117", "0.5957626", "0.5908305", "0.5905342", "0.58900785", "0.58684945", "0.5857753", "0.584797", "0.5755301", "0.5749916", "0.5683297", "0.5683121", "0.5669927", "0.565693", "...
0.0
-1
Helper to add uuids
function uuid() { var uuid = "", i, random; for (i = 0; i < 32; i++) { random = Math.random() * 16 | 0; if (i == 8 || i == 12 || i == 16 || i == 20) { uuid += "-" } uuid += (i == 12 ? 4 : (i == 16 ? (random & 3 | 8) : random)).toString(16); } return uuid; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function UUID(){}", "function UUID(){}", "function UUID(){}", "function UUID(){}", "function UUID(){}", "function createUUID()\n{\n return [4, 2, 2, 2, 6].map(function(length) {\n var uuidpart = \"\";\n for (var i=0; i<length; i++) {\n var uuidchar = parseInt((Math.random() * 256)).toString(1...
[ "0.67838943", "0.67838943", "0.67838943", "0.67838943", "0.67838943", "0.67485714", "0.6550511", "0.6494143", "0.643249", "0.6407405", "0.63693154", "0.63693154", "0.6346469", "0.6288647", "0.6281401", "0.627499", "0.6269438", "0.6260569", "0.6258233", "0.6252444", "0.6235592...
0.6288897
13
Queue just one URL, with default callback
function initPa() { var arr = []; for (var i = 1; i <= 10; i++) { arr.push('http://www.jianshu.com/c/e50258a6a44b?order_by=added_at&page=' + i) } c.queue(arr) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function DownloadQueue() {}", "function next()\n {\n var params = queue[0];\n\n // Replace or add the handler\n if(params.hasOwnProperty(\"success\")) callback = params.success;\n else callback = null;\n\n params.success = success;\n\n ...
[ "0.6484308", "0.6294898", "0.6264248", "0.5936081", "0.5891363", "0.5865362", "0.5860313", "0.58575255", "0.57867175", "0.576786", "0.57465017", "0.57197493", "0.5709888", "0.56982946", "0.56244236", "0.56225795", "0.5557257", "0.54978865", "0.5490816", "0.54896486", "0.54788...
0.49076253
82
id(integer) PRIMARY KEY owner(User) FOREIGN KEY task_type(string) subject(string) title(string) description(string) options(string[]) DEFAULT NULL solutions(string[])
constructor(id, owner, task_type, subject, title, description, options, solutions){ this.id = id; this.owner = owner; this.task_type = task_type; this.subject = subject; this.title = title; this.description = description; this.options = options; this.solutions = solutions; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Task(name, description, date, difficulty, assigned, notes){\n this.name = name;\n this.description = description;\n this.date = date;\n this.difficulty = difficulty;\n this.assigned = assigned;\n this.notes = notes;\n}", "function addTask({\r\n title,\r\n description,\r\n isUrgent,\r\n ...
[ "0.5874035", "0.5744238", "0.5433376", "0.5329729", "0.5315768", "0.52257776", "0.5157697", "0.5132729", "0.5122021", "0.5114265", "0.5071972", "0.5068221", "0.50493324", "0.5036393", "0.50123864", "0.5007431", "0.49762198", "0.4968908", "0.4958923", "0.49537012", "0.49306732...
0.68013793
0
I can't really figure this out Not even a little
function bres(x1, y1, x2, y2) { loadPixels(); var dx = x2 - x1; var dy = y2 - y1; var d = dy - (dx/2); var x = x1; var y = y1; while(x < x2) { x++; if(d<0) { d = d + dy; } else { d += (dy - dx); y++; } pixels[4 * (x + (y * 500))] = 255; } updatePixels(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private internal function m248() {}", "private public function m246() {}", "protected internal function m252() {}", "static private internal function m121() {}", "transient protected internal function m189() {}", "function Hx(a){return a&&a.ic?a.Mb():a}", "function e(){return [0,0,0,1]}", "transient ...
[ "0.6592177", "0.63448054", "0.6107372", "0.60575783", "0.5846026", "0.56406367", "0.5581179", "0.5579043", "0.5576156", "0.5573803", "0.5565844", "0.5554208", "0.5545147", "0.5542398", "0.5470479", "0.54535687", "0.5363593", "0.5349133", "0.53411114", "0.53127074", "0.5291481...
0.0
-1
Script embedded in popup.html Widens toolbar by custom button width.
function widen() { var minWidth = 685; //prepare array of magics var std_buttons = document.getElementById("std_buttons"); var magic = document.getElementById("magic"); var magic2 = document.getElementById("magic2"); var magic3 = document.getElementById("magic3"); var magic4 = document.getElementById("magic4"); var magic5 = document.getElementById("magic5"); var magic_array = []; if (magic) magic_array.push(magic); if (magic2) magic_array.push(magic2); if (magic3) magic_array.push(magic3); if (magic4) magic_array.push(magic4); if (magic5) magic_array.push(magic5); //sort by length desc magic_array.sort(function (a, b) { return b.offsetWidth - a.offsetWidth; }); var defWidth = std_buttons.offsetWidth; var fixedWidth = 100; var stdWidth = fixedWidth + std_buttons.offsetWidth; console.log("standard width=" + stdWidth); var newWidth = fixedWidth + std_buttons.offsetWidth + (magic ? magic.offsetWidth : 0) + (magic2 ? magic2.offsetWidth : 0) + (magic3 ? magic3.offsetWidth : 0) + (magic4 ? magic4.offsetWidth : 0) + (magic5 ? magic5.offsetWidth : 0); if (newWidth > 795) { //console.log("width calculated to"+newWidth+". shortening labels"); document.getElementById("query").innerText = "Que"; document.getElementById("project_list").innerText = "Lst"; newWidth = fixedWidth + std_buttons.offsetWidth + (magic ? magic.offsetWidth : 0) + (magic2 ? magic2.offsetWidth : 0) + (magic3 ? magic3.offsetWidth : 0) + (magic4 ? magic4.offsetWidth : 0) + (magic5 ? magic5.offsetWidth : 0); } if (newWidth > 795) { //console.log("width calculated to"+newWidth+". shortening labels"); document.getElementById("validate").innerText = "Val"; document.getElementById("project").innerText = "Prj"; newWidth = fixedWidth + std_buttons.offsetWidth + (magic ? magic.offsetWidth : 0) + (magic2 ? magic2.offsetWidth : 0) + (magic3 ? magic3.offsetWidth : 0) + (magic4 ? magic4.offsetWidth : 0) + (magic5 ? magic5.offsetWidth : 0); } if (newWidth > 795) { //console.log("width calculated to"+newWidth+". shortening labels"); document.getElementById("model").innerText = "LD"; document.getElementById("model2").innerText = "LB"; document.getElementById("model3").innerText = "WB"; newWidth = fixedWidth + std_buttons.offsetWidth + (magic ? magic.offsetWidth : 0) + (magic2 ? magic2.offsetWidth : 0) + (magic3 ? magic3.offsetWidth : 0) + (magic4 ? magic4.offsetWidth : 0) + (magic5 ? magic5.offsetWidth : 0); } if (newWidth > 795) { //console.log("width calculated to"+newWidth+". shortening labels"); document.getElementById("explain").innerText = "E"; document.getElementById("schedules_gp").innerText = "G"; newWidth = fixedWidth + std_buttons.offsetWidth + (magic ? magic.offsetWidth : 0) + (magic2 ? magic2.offsetWidth : 0) + (magic3 ? magic3.offsetWidth : 0) + (magic4 ? magic4.offsetWidth : 0) + (magic5 ? magic5.offsetWidth : 0); } if (newWidth > 795) { //console.log("width calculated to"+newWidth+". shortening labels"); document.getElementById("md_export").innerText = "M"; document.getElementById("md_import").innerText = "M"; newWidth = fixedWidth + std_buttons.offsetWidth + (magic ? magic.offsetWidth : 0) + (magic2 ? magic2.offsetWidth : 0) + (magic3 ? magic3.offsetWidth : 0) + (magic4 ? magic4.offsetWidth : 0) + (magic5 ? magic5.offsetWidth : 0); } var x = 0; //to avoid infinite cycle for ( var i = 0; i < magic_array.length && newWidth > 795 && x < 20; magic_array.sort(function (a, b) { return b.offsetWidth - a.offsetWidth; }) ) { //console.log("width calculated to"+newWidth+". shortening longest magic label "+magic_array[i].innerText ); magic_array[i].innerText = magic_array[i].innerText.substring( 0, magic_array[i].innerText.length - 1 ); newWidth = fixedWidth + std_buttons.offsetWidth + (magic ? magic.offsetWidth : 0) + (magic2 ? magic2.offsetWidth : 0) + (magic3 ? magic3.offsetWidth : 0) + (magic4 ? magic4.offsetWidth : 0) + (magic5 ? magic5.offsetWidth : 0); x++; } var newWidthCss = newWidth + "px"; var body = document.getElementsByTagName("body")[0]; var html = document.getElementsByTagName("html")[0]; body.setAttribute("width", newWidth); body.style.setProperty("width", newWidthCss, ""); html.setAttribute("width", newWidth); html.style.setProperty("width", newWidthCss, ""); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "static get tag(){return\"rich-text-editor-toolbar-full\"}", "function resizeWindow_SingleToolbar()\n {\n var objToolbar;\n var ToolbarHeight=28;\n var targetWidth=200;\n var targetHeight=150;\n if (getClientWidth()>targetWidth)\n {\n targetWidth=getClientWidth();\n }\...
[ "0.65099055", "0.6388926", "0.6374526", "0.6292836", "0.61813056", "0.61813056", "0.613992", "0.6109517", "0.60862225", "0.60848254", "0.60006213", "0.596551", "0.5958538", "0.59337145", "0.5889559", "0.5858549", "0.5855262", "0.58485067", "0.58370876", "0.5818137", "0.578852...
0.5825628
19
Add magic custom button if configured (in localStorage).
function addMagicButton(magic_name) { var spacer = document.createElement("span"); spacer.setAttribute("class", "spacer"); var a = document.createElement("a"); a.setAttribute("id", magic_name); a.setAttribute("href", localStorage[magic_name + "_link"]); a.setAttribute("title", localStorage[magic_name + "_help"]); a.appendChild(document.createTextNode(localStorage[magic_name + "_title"])); var classAttr = ""; if (localStorage[magic_name + "_link"].indexOf("${PID}") >= 0) { classAttr += "needpid "; } if (localStorage[magic_name + "_link"].indexOf("${OBJ}") >= 0) { classAttr += "needobj "; } if (localStorage[magic_name + "_link"].indexOf("${OBJURL}") >= 0) { classAttr += "needobj "; } if (localStorage[magic_name + "_link"].indexOf("${DOMAIN}") >= 0) { classAttr += "needdomain "; } a.setAttribute("class", classAttr); //TODO dynamically insert before/after document .getElementById("extra_buttons") .insertBefore(a, document.getElementById("last-spacer")); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function addCustomButton(imageFile, speedTip, tagOpen, tagClose, sampleText, imageId) {\n mwCustomEditButtons[mwCustomEditButtons.length] =\n {\"imageId\": imageId,\n \"imageFile\": imageFile,\n \"speedTip\": speedTip,\n \"tagOpen\": tagOpen,\n \"tagClose\": tagClose,\n \"sampleText\": sam...
[ "0.65999115", "0.6385169", "0.6344161", "0.6185124", "0.59908557", "0.59762394", "0.5886111", "0.5833887", "0.5823125", "0.581567", "0.5779405", "0.5712564", "0.5705462", "0.5694226", "0.5658882", "0.56115085", "0.56084615", "0.5525773", "0.55169374", "0.5508017", "0.54985327...
0.7419585
0
Bloomberg has requested that the Butler dashboard only be available to their Enterprise admins. This function will return whether a user can access the Butler directory on a board
canShowButlerUI() { if (this.hasEnterprise()) { if ( featureFlagClient .get('workflowers.butler-ent-admin-only-allowlist', []) .includes(this.get('idEnterprise')) ) { return ( this.getEnterprise().isAdmin(Auth.me()) || (this.get('idOrganization') && this.getOrganization()?.isAdmin(Auth.me())) ); } } return true; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "checkAdminPageAccess() {\n if (this.state.userLogged == true) {\n if (this.state.userRole == 0) {\n return true;\n }\n }\n return false;\n }", "function isAdmin() {\n\treturn getMe() === getAdmin();\n}", "function isProjectAdmin() {\n var foun...
[ "0.6888655", "0.6483352", "0.62629807", "0.62629807", "0.6227894", "0.62275785", "0.6204156", "0.6194858", "0.6169562", "0.61283135", "0.61136013", "0.60794735", "0.6037678", "0.6021635", "0.5996579", "0.5980871", "0.5931169", "0.5914149", "0.5896536", "0.58845055", "0.587159...
0.7594592
0
We can't necessarily see the org
hasOrganization() { return this.get('idOrganization'); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getOrgUnit(){\n return orgUnit;\n }", "function GetOrg(curDoc){\n // 后续还需要检查附件是否下载到本地 Downloaded API\n // 已经修改为找到 org 文件才可以,还需要修改来让插件自动找到合适的 org 附件,或者找到多个的情况提示选择\n var AttachCount = curDoc.Attachments.Count;\n if(AttachCount === 0){\n return null;\n }\n\n var OrgName = 0;\n var OrgFi...
[ "0.66782194", "0.64889425", "0.6468849", "0.6238052", "0.6146855", "0.61030656", "0.6102946", "0.602464", "0.598113", "0.59741306", "0.5860763", "0.5856237", "0.57438236", "0.57247645", "0.5605471", "0.5604693", "0.55792093", "0.5512924", "0.54409915", "0.5433769", "0.5387743...
0.0
-1
rotate stars around origin
updateStars() { for (var i = 0; i < numStars; i++) { this.rotatePoint(this.starPoints[i], starRotationSpeed, starOriginPoint); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function star(ctx, x, y, r, np, inset)\n{\n ctx3.beginPath();\n ctx3.translate(x, y);\n ctx3.moveTo(0,0-r);\n for (var i = 0; i < np; i++)\n {\n ctx.rotate(Math.PI / np);\n ctx.lineTo(0, 0 - (r*inset));\n ctx.rotate(Math.PI / np);\n ctx.lineTo(0, 0 - r);\n \n }\...
[ "0.6865526", "0.68475986", "0.67532", "0.6516387", "0.65144813", "0.6471062", "0.63902175", "0.63902026", "0.63523895", "0.6338336", "0.63030696", "0.62353384", "0.62086475", "0.61620826", "0.61602473", "0.61393654", "0.60423654", "0.6039291", "0.6009875", "0.59943604", "0.59...
0.65959984
3
will just take first point and make it last point for now. won't be using this, just going to make it static
updateMountainPoints() { for (var i = nMountains; i >= 0; i--) { var curMountain = this.mountainPoints[i]; var updatedMountain = []; updatedMountain.push(curMountain[curMountain.length - 1]); updatedMountain = updatedMountain.concat( curMountain.slice(0, curMountain.length - 1) ); this.mountainPoints[i] = updatedMountain; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function draw_first_line(){\n points.push(start);\n points.push(end);\n}", "function prepForPath(points){\n let arr = points.slice();\n return arr.push(arr[arr.length - 1]);\n}", "returnToLastPos() {\n if (this.previousPos) {\n this.x = this.previousPos.x\n this.y = thi...
[ "0.64695007", "0.6383548", "0.63457274", "0.62057734", "0.61872166", "0.6124776", "0.59706974", "0.5961901", "0.59363025", "0.58434474", "0.5837234", "0.5825008", "0.58121854", "0.5809715", "0.57944083", "0.5751574", "0.5750825", "0.5745803", "0.5741708", "0.5732804", "0.5709...
0.0
-1