query
stringlengths
9
34k
document
stringlengths
8
5.39M
negatives
listlengths
19
20
metadata
dict
check collisions between a hitbox (lookup) and a category
checkCollision(lookupID, category){ //find the hitbox var hitbox = this.getHitbox(lookupID) //compare against category return hitbox.checkCollision(this.hitboxCategories[category]); }
[ "hitBox(collision){\n\t\tswitch(collision.closestEdge(this.pos.minus(new vec2(this.vel.x, 0)))){\n\t\t\tcase 't': this.hitGround(collision.top()); break;\n\t\t\tcase 'l': this.hitRWall(collision.left()); break;\n\t\t\tcase 'r': this.hitLWall(collision.right()); break;\n\t\t\tcase 'b': this.hitCeiling(collision.bott...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Computes a reflection matrix from a plane
static ReflectionToRef(plane, result) { plane.normalize(); const x = plane.normal.x; const y = plane.normal.y; const z = plane.normal.z; const temp = -2 * x; const temp2 = -2 * y; const temp3 = -2 * z; Matrix.FromValuesToRef(temp * x + 1, t...
[ "static Reflection(plane) {\n const matrix = new Matrix();\n Matrix.ReflectionToRef(plane, matrix);\n return matrix;\n }", "transform(transformation) {\n const transposedMatrix = preallocatedVariables_1.MathTmp.Matrix[0];\n Matrix_1.Matrix.TransposeToRef(transform...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
after application exception that function should be called 3 times and then call procedureAfterSystemException
function procedureAfterApplicationException(functionString) { if (callFunction > 2) { procedureAfterSystemException(); } //ime odnosno string funkcije poziva opet funkcija eval(functionString); callFunction++; }
[ "function incrementoError()\n\t{\n\t\tif(presente === false)\n\t\t{\n\t\t\tmasUnError();//Instanciar la función que aumenta los fallos acumulados.\n\t\t}\n\t}", "function errorManager(){\n if(fundamental_vars.retry == true){\n //Collect the domains still pending data. Collect all the domains bypassing w...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function which tries to convert between amCharts zoom level and Google's
function amZoomLevelToGoogle( level ) { // round level = Math.round( level ); var newLevel = Math.round( Math.sqrt( level ) ); // find a zoom level AmCharts.zoomLevels.forEach( function( zoomLevel ) { if ( level >= zoomLevel.am ) newLevel = zoomLevel.g; } ); return newLevel; }
[ "function onZoom()\r\n{\r\n\tevaluateLayerVisibility();\r\n\t$(\"#zoomlevel\").val(Math.floor(map.getView().getZoom()));\r\n}", "getZoomLevel() {\n return this.dynamics.zoom.current;\n }", "function zoom() {\n airbnbNodeMap.zoom();\n mapLineGraph.wrangleData_borough();\n}", "onZoomChange(pointer...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
find characters by sound
static findCharactersBySound(sound) { return SoundToCharacters[sound]; }
[ "static findCharactersWithSingleSound(characters) {\n return _.select(characters, char => { \n return Canigma.findSoundsByCharacter(char).length == 1;\n });\n }", "static findOtherCharactersWithSameSound(originalCharacter, sound) {\n var characters = Canigma.findCharactersBySoun...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
hide add or substract modal
hideAddSubstract(type) { this.setState({modalVisible4: false}); }
[ "function hide_add_product()\n{\n\t//hide the modal box \n\t$('.overlay').hide(); \n\t$('#product_picker').hide(); \n\tonBackKeyDown();\t\n\t//Redraw the screen \n\tredraw_order_list();\n}", "function showHideAddButton() {\n if (count == MAX) {\n addButton.hide();\n } else {\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
filter flights baed on gateId
function filterFlightsByGateId(gateId) { vm.filterByGateId = gateId; var item = $filter('filter')(vm.domain.gates, { GateID: vm.filterByGateId }); if (item != 'undefined' || item != null) { vm.selectedGateName = item[0].GateName; } log(vm.selec...
[ "function filterByDate(flights) {\n var today = new Date();\n if (vm.formData.date == null || vm.formData.date == '') {\n return flights.GateID == vm.filterByGateId;\n } else {\n var arrivalDate = moment(new Date(flights.ArrivalTime),'MM/DD/YYYY').forma...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Set the script on document.
setScript() { if (document.getElementById(this.id)) { // TODO wrap onerror callback for cases where the script was loaded elsewhere this.callback(); return; } const url = this.createUrl(); const script = document.createElement("script"); script.id = this.id; script.type = "tex...
[ "_applyScript(value, old) {\n qx.bom.storage.Web.getSession().setItem(cboulanger.eventrecorder.UiController.CONFIG_KEY.SCRIPT, value);\n if (this.getRecorder()) {\n this.getRecorder().setScript(value);\n }\n }", "run(script) {\n script._init(this.ecs, this.eventsManager, this);...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates a legend in the specified element with graph information
function createLegend(choiceContainer, infos) { // Sort series by name var keys = []; $.each(infos.data.result.series, function(index, series){ keys.push(series.label); }); keys.sort(sortAlphaCaseless); // Create list of series with support of activation/deactivation $.each(keys, fu...
[ "function drawLegend() {\n var legend = $(\"#legend\");\n legend.empty();\n\n var legendContainer = $(\"<div>\");\n legendContainer.addClass(\"legendContainer\");\n\n // Nur die Labels, die wir auch anzeigen!\n for(var lbl of usedLabels.entries()) {\n var catId = lbl[0];\n var catego...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
tts sms twitter to all contacts
function bTtsSmsTwitterAllCon(senderId,broadCast_name,broadCast_message,lCode,x) { $('#takeOneAction').val('false'); var rEmail=0;var rTts=1;var rSms=1;var rTwitter=1; //checks of validations smsCntVal(senderId); generalValidations(broadCast_name,broadCast_message); console.log("voice and email and sms twitter to...
[ "function getTwitterTweets(screen_name) {\n socket.emit('user_tweets', { screen_name: screen_name });\n }", "function bSmsTwitterAllCon(senderId,broadCast_name,broadCast_message,x)\n{\n\t$('#takeOneAction').val('false');\n\tvar rEmail=0;var rTts=0;var rSms=1;var rTwitter=1;\n\t//checks of validations...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
showUserProfile(myId) calls the user's profile view for user: myId and displays the results in the recordView div
function showUserProfile(myId) { if (myId < 1) { return false; } else { clearDiv("recordView"); var myURL = "UsersProfileView.php?U=" + myId; processAjax (myURL, "recordView"); setBlockVis("recordView", "block"); return true; } }
[ "function showUserView(myId) {\r\n if (myId < 1) { \r\n return false; \r\n } else {\r\n clearDiv(\"recordView\");\r\n var myURL = \"UsersRecordView.php?U=\" + myId;\r\n processAjax (myURL, \"recordView\");\r\n setBlockVis(\"recordView\", \"block\");\r\n return true;\r\n }\r\n}", "...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Initialized the regions context menu options
initRegionsContextOptions () { // listen to changes in selected shapes which determines the options this.observers.push( this.bindingEngine.collectionObserver( this.image_config.regions_info.selected_shapes).subscribe( (newValue, oldValue) => this.onRoiSel...
[ "selectAllRegions() {\r\n let r = null;\r\n for (const region of this.regions) {\r\n r = region;\r\n r.select();\r\n if ((typeof this.callbacks.onRegionSelected) === \"function\") {\r\n this.callbacks.onRegionSelected(r.ID);\r\n }\r\n }...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
pas = activity state ls = layer state
function parseLayer(nameOfActivity, numBytesForActivity, pas, ls, desination, source, sourceSize) { pas.currentActivityLeft = (numBytesForActivity) - pas.currentTargetOffset; var amountParsed = parseData(desination, source, pas.currentTargetOffset, pas.currentPacketOffset, pas.currentActivityLeft, sourceSize-pas.cu...
[ "_transferLayerState(oldLayer, newLayer) {\n newLayer._transferState(oldLayer);\n\n newLayer.lifecycle = _lifecycle_constants__WEBPACK_IMPORTED_MODULE_1__[\"LIFECYCLE\"].MATCHED;\n\n if (newLayer !== oldLayer) {\n oldLayer.lifecycle = _lifecycle_constants__WEBPACK_IMPORTED_MODULE_1__[\"LIFECYCLE\"].AW...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Delete all the features on the map.
function deleteAllFeatures(){ if(window.confirm("Delete all features?")){ vectorLayer.destroyFeatures(); $('#info-inner').html(""); } }
[ "function resetData() {\n geoJSON = {\n type: \"FeatureCollection\",\n features: []\n };\n myMap.data.forEach(function(feature) {\n myMap.data.remove(feature);\n });\n }", "function eraseMap() {\n document.body.removeChild(map);\n }", "function clean_map() {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Find the matching bracket for the token at `pos`, scanning / direction `dir`. Only the `brackets` and `maxScanDistance` / properties are used from `config`, if given. Returns null if no / bracket was found at `pos`, or a match result otherwise.
function matchBrackets(state, pos, dir, config = {}) { let maxScanDistance = config.maxScanDistance || DefaultScanDist, brackets = config.brackets || DefaultBrackets; let tree = state.tree, sub = tree.resolve(pos, dir), matches; if (matches = matchingNodes(sub.type, dir, brackets)) return matchMarke...
[ "function matchBrackets(state, pos, dir, config = {}) {\n let maxScanDistance = config.maxScanDistance || DefaultScanDist, brackets = config.brackets || DefaultBrackets;\n let tree = state.tree, sub = tree.resolve(pos, dir), matches;\n if (matches = matchingNodes(sub.type, dir, brackets))\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
create chart based on selected region and province
function makeChart(region, province = "") { var files = [d3.csv("https://raw.githubusercontent.com/CSSEGISandData/COVID-19/master/csse_covid_19_data/csse_covid_19_time_series/time_series_covid19_confirmed_global.csv"), d3.csv("https://raw.githubusercontent.com/CSSEGISandData/COVID-19/master/csse_covid_19_da...
[ "function CreateRegionCharts(region, title) {\n $.getJSON(\"crimes/6-2013/\" + region + \"/json\", function(data) {\n \n // Raw data\n $(\"#searchRegionData\").html(JSON.stringify(data, null,4));\n \n var crimeData = null;\n \n // Need to check for Further Stats, ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
We use the reference of the old task to updated one specific item within the task list.
onTaskUpdated(task, updatedData) { const tasks = this.tasks.slice(); const oldTask = tasks.splice(tasks.indexOf(task), 1, Object.assign({}, task, updatedData))[0]; this.tasksUpdated.next(tasks); // Creating an activity log for the updated task this.activityService.logActivity( this.activitySub...
[ "function findAndUpdateTask(taskID, nextTeamID) {\n\n for (var updateCounter = 0; updateCounter < this.tasksArray.length; updateCounter++) {\n var tempTask = this.tasksArray[updateCounter];\n if (tempTask.taskID == taskID) {\n //alert(nextTeamID + \" \" + taskID);\n if (tem...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Detect a URLSearchParams object ref:
function isURLSearchParams(obj) { // Duck-typing as a necessary condition. if (typeof obj !== 'object' || typeof obj.append !== 'function' || typeof obj.delete !== 'function' || typeof obj.get !== 'function' || typeof obj.getAll !== 'function' || typeof obj.has !== 'function' || typeof obj.set !== 'function') { ret...
[ "function checkURLParams() {\n let params = new URLSearchParams(location.search);\n //Shopping List\n let sl = params.get(\"sl\")\n if (sl != null) {\n processURLShoppingList(sl)\n }\n\n // Recipe\n let r = params.get(\"r\")\n if (r != null) {\n processURLRecipe(r)\n }\n\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sube el nivel del pokemon
lvlUp() { this.lvl ++; console.log("Su pokémon ha subido de nivel, el nivel es: " + this.lvl); // Sube alguno de sus stats dependiendo de la naturaleza del pokemon switch (this.naturaleza) { case 'Audaz': this.stats["ataque"] ++; console.log("...
[ "SetNovaDamage(num) { return [\"3d6\", \"3d6+2\", \"3d8\", \"3d8+2\", \"3d10\"][num-1]; }", "getTotalXpForLevel(player, level) {\n return this.xpTable[level]\n }", "checkGameStatus() {\n if(this.props.player.health <= 0 || this.props.game.level >= 6) {\n this.props.actions.gameOver()\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
closes the modal if a client is passed in or dismisses it
function closeModal(client) { if (client) { $uibModalInstance.close(client); } else { $uibModalInstance.dismiss("cancel"); } }
[ "close() {\n this.showModal = false;\n\n this.onClose();\n }", "function closeModal() {\r\n modal.style.display = 'none';\r\n }", "function closecancelpanel(){\n $.modal.close();\n }", "function close() {\n\tcongratModalEl.style.display = 'none';\t\n}", "hideAcceptGa...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Adds Key Drag Zoom to the map
function keyDragZoom(map) { map.enableKeyDragZoom({ visualEnabled: true, visualPosition: google.maps.ControlPosition.LEFT, visualPositionOffset: new google.maps.Size(35, 0), visualPositionIndex: null, visualSprite: "http://maps.gstatic.com/mapfiles/ftr/controls/dragzoom_btn.png", visualSize: new google.map...
[ "function keyDownZoom(e){\n deleteDefault(e);\n spaceKey(e);\n rightArrowKey(e);\n leftArrowKey(e);\n}", "function zoom() {\n airbnbNodeMap.zoom();\n mapLineGraph.wrangleData_borough();\n}", "function zoomToFeature(e) {\n if (event.shiftKey) {\n map.fitBounds(e.target.getBounds());\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
returns fruits and vegies based on passed argument
getFruitsandVegies(){ if(arguments.length == 0){ fruits.forEach(ele => console.log(ele)); vegetables.forEach(ele => console.log(ele)); } else{ for (let i = 0; i <arguments[0]; i++) { console.log(fruits[i]); } for (let i = 0; i <arguments[0]; i++) ...
[ "function fruitOtVeg(item){\n switch (item)\n {\n case 'banana':\n case 'apple':\n case 'kiwi':\n case 'cherry':\n case 'lemon':\n case 'peach':\n case 'grapes':\n\n console.log('fruit');\n break;\n\n case 'tomato':\n case 'c...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Execute a single task, and either increment the number of runs or remove it from the database.
async __executeTask ({ task, recUser }) { const database = this.__dep(`database`); const workflowManager = this.__dep(`workflowManager`); // Lock the task so no other instances can run it. if (!task.allowConcurrent) { const lockEndDate = moment.utc(task.lockedSinceDate || 0).add(this.maxLockTime, `millise...
[ "update(_task) {\n const { id, task, date, process } = _task\n let sql = `UPDATE tasks\n SET task = ?,\n date = ?,\n process = ?\n WHERE id = ?`;\n return this.dao.run(sql, [task, date, process, id])\n }", "async function updateDB() {\n for (let...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Add tie to conference record
addConferenceTie() { this.addLeagueTie(); this.#records["conference"].addTie(); }
[ "addConferenceWin() {\n this.addLeagueWin();\n this.#records[\"conference\"].addWin();\n }", "addLeagueTie() {\n this.#records[\"league\"].addTie();\n }", "addDivisionTie() {\n this.addConferenceTie();\n this.#records[\"division\"].addTie();\n }", "addConferenceLoss...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sets up the device by connecting to the devices and setting up power polling
async setup() { // connect to the bulbs try { if (this.deviceKind === 'TPLink Bulb') { this.tplink = TPClient.getBulb({host: this.ip}); } else if (this.deviceKind === 'TPLink Plug') { this.tplink = TPClient.getPlug({host: this.ip}); } ...
[ "setUp(options){\n this.setUpDeviceListeners(undefined, this.onOSCMessage);\n this.setUpDevice({ osc: options });\n }", "async function OnDeviceConfiguration() {\r\n try {\r\n client.on(\"connect\", () => {\r\n client.subscribe(topicConfiguration, function (err) {\r\n if (err) {\r...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Executes when the image url is retrieved.
function ongetImageUrlQuerySucceeded() { var serverrelativeurl = this.parentWeb.get_serverRelativeUrl(); var imagepath = this.targetFile.get_serverRelativeUrl(); var filename = this.targetFile.get_name(); if (serverrelativeurl && filename && imagepath) { appData.ImageLibraryFullPath = imagepath....
[ "imageLoaded(){}", "function onImageLoaded() {\r\n\t\t++numImagesLoaded;\r\n\t\t\r\n\t\tif (numImagesLoaded == numImagesRequested) {\r\n\t\t\tnumImagesLoaded = 0;\r\n\t\t\tnumImagesRequested = 0;\r\n\t\t\timagesToLoad = [];\r\n\r\n\t\t\tif (onAllImagesLoadedCallback !== null && onAllImagesLoadedCallback !== undef...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
TopBar Manages top bar layout and keeps track of the game clock. The game clock is the amount of time the user has to make an action during their turn or when buying.
function TopBar() { const { timer, setTimer } = useContext(RoomContext); /** Manages game clock timer */ useEffect(() => { let timeCount; /** If timer is greater than 0 tick 1 second and repeat */ /** If timer is equal to 0 Set activity indicator until timer is set by server */ if (timer > 0) tim...
[ "function pushTopHeight() {\n var menuBarHeight = $('.pageHeader').height();\n\n if (window.innerWidth < 600 && $('#wpadminbar').length > 0) {\n menuBarHeight -= $('#wpadminbar').height();\n }\n\n $('.pushTop').height(menuBarHeight);\n }", "function getTopBar() {\n\tretur...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Load the State/District/AssemblyConstituency dropdowns given a pincode
function populateDropdownsFromPincode(state_dropdown, district_dropdown, assembly_constituency_dropdown, city_dropdown, taluka_dropdown, pincode) { var params = "pincode=" + pincode; var http = new XMLHttpRequest(); http.open("GET", "/pincode?" + params, true); http.send(null); http.onreadystatechange=functi...
[ "function postalCodeLookup() {\n\tlet postalcode = document.getElementById(\"postalcodeInput\").value;\n\tlet selectedCountry = getDataId('countryInput', 'countries');\n\tctry = countryInput.value;\n\n\t//example: http://api.geonames.org/postalCodeLookupJSON?postalcode=6600&country=AT&username=demo\n\tlet request =...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
~~~~~~ SOUND ENGINE ~~~~~~ This section of the code contains the code used to play sounds based on distance to the player. playAudio(sound,distance): Plays the sound 'sound' as though the source was 'distance' rooms away from the player, using audio channel 'channel'.
function playAudio(sound,distance,channel) { var playSound; switch (channel) { case 1: playSound = document.getElementById("channelOne"); break; case 2: playSound = document.getElementById("channelTwo"); break; default: return; } // First stop the old audio if one is playing. playSound.pause(...
[ "function initAudioPlayer() {\n\t// Set up the audio player itself\n\t//console.log(\"setting up audio player\");\n\t$(shell.audio.playerDiv).jPlayer({\n\t\tready: function(){\n\t\t\t//console.log(\"audio player ready\");\n\t\t\t// Call this AFTER the audio player is ready\n\t\t\tloadPageAudio();\n\t\t},\n\t\tswfPa...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
import imgad from '../imgad.jpg';
function Sidead () { return <img src={require("../imgad.jpg")} alt="imgad" />; }
[ "function MySpecial() {\n return (\n <div className=\"MySpecial\">\n <h1 className=\"dashboard__header\">Điểm đặc biệt</h1>\n <UseImages CNAME=\"myspecial\" />\n </div>\n );\n}", "addImage(url) {\n \n }", "static imageSrcUrlForRestaurant(restaurant) {\r\n return (`/img2/${restaura...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
play chord note for beats
playChordForBeats(args){ if(this._peripheral.AllConnected == false) return; if (this.inActionC1C2C3 == true) return; this.inActionC1C2C3 = true; var beatsEach = this._clampBeats(args.BEATS); var durationSecEach = this._beatsToDuration(args, beatsEach); ...
[ "function playNote(keycode) {\n //dont trigger if key is already pressed\n if (!keysPressed.includes(keycode)) {\n //push keycode to pressed\n keysPressed.push(keycode);\n //get respective key from keycode\n var key = document.querySelector(\".key[data-keycode=\\\"\" + keycode + \"\\\"]\");\n //add...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Rotate hedgehog orientation in forward to mouse click. TODO: incorrect behaviour!
function rotateHedgehogOrientation(oldPos, newPos) { var angle = oldPos.angleTo(newPos) * 180 / Math.PI; var cos = cosinusBetweenVectors(oldPos, newPos); hedgehog.rotateOnAxis(new THREE.Vector3(0, 1, 0), angle); }
[ "rotate270() {\n const { x } = this;\n this.x = this.y;\n this.y = -x;\n }", "rotate(axis, angle) {\n var state = this.cam.state;\n if(angle) {\n var new_rotation = Rotation.create({axis:axis, angle:angle});\n Rotation.applyToRotation(state.rotation, new_rotation, state.rotation);\n }...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Checks for a keyfile from a previous instance The keyfile is so that we don't have to create a new environment everytime you use the app
checkKeyFile() { let dir = __dirname + "/../.data"; let filepath = dir + "/keystore.json"; if (!fs.existsSync(filepath)) { this.previousInstance = false; return; } // A keystore file exists, lets see if it contains everything we need try { ...
[ "async prepareCredentials() {\n if (this.env[DEFAULT_ENV_SECRET]) {\n const secretmanager = new SecretManager({\n projectId: this.env.GCP_PROJECT,\n });\n const secret = await secretmanager.access(this.env[DEFAULT_ENV_SECRET]);\n if (secret) {\n const secretObj = JSON.parse(secr...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
cover the canvas in a stack of bands of similar waves
function simpleCover() { var y = 0; var x = 0; var h_shift = 0; var amp = void 0; var h = void 0; var count = void 0; var bandCount = (0, _utils.randomInRange)(10, 40); // number of horizontal bands var interval = ch / (bandCount - 1); // px per stripe ...
[ "function drawFlat(spectrum){\n colorMode(HSB, bands);\n var w = width / (bands * 1.5);\n var maxF = Math.max(spectrum);\n for (var i = 0; i < spectrum.length; i++) {\n var amp = spectrum[i];\n var y = map(amp, 0, 255, height, 10);\n fill(i,255,255);\n rect(width/2 + i*w,y,w-2,height-y);...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
for case "Buy a planet"
function buyPlanet() { inquirer.prompt({ type: "input", name: "whichPlanet", // program needs an accurate but case-insensitive single response result to do cost calculation message: "Confirm the planet you wish to buy:" }).then(function (answers) { connection.query("SELEC...
[ "function visitMarket() {\n let answer = rls.question(\n `The marketplace is booming with activity. \\nThe armory is stocked with wide selection of swords for Ξ7 a piece or leather armor for Ξ4 \\n You now have ${playerGold} gold coins. So, what would you like to buy, sword or armor? \\n`\n );\n if (answer ==...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
coheUpdateMessageHeaders: Iterate through all the current header data we received from mime for this message for each header entry table, see if we have a corresponding entry for that header. i.e. does the particular view care about this header value. if it does then call updateHeaderEntry
function coheUpdateMessageHeaders() { // Remove the height attr so that it redraws correctly. Works around a // problem that attachment-splitter causes if it's moved high enough to // affect the header box: document.getElementById('msgHeaderView').removeAttribute('height'); // iterate over each h...
[ "update() {\r\n this.updateHeader();\r\n }", "_onHeader (header) {\n if (header === 0) {\n // Message boundary\n let message\n switch (this._currentMessage.length) {\n case 0:\n // Keep alive chunk, sent by server to keep network alive.\n return this.AWAITING_C...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
if map was reloaded while expanded, reexpand the previously expanded section
function reexpandSection(){ d = d3.select("#"+refreshSectionID); var data = d.datum(); var box = document.getElementById(d.attr("id")).getBBox(); data.expanded = true; sectExpanded = true; var rotAngle = 0; if (data.startAngle!=null) rotAngle = -(data.startAngle+data.endAngle)/2*180/Math.PI; else if (box.height...
[ "function revertMap(){\n\tif (sectExpanded){\n\t\tsectExpanded = false;\n\t\treplaceDetailsText(textUnexpanded, true);\n\t\thighlightTable(null);\n\n\t\t// unhide everything\n\t\tfor (var i=0; i<hideableElements.length; i++){\n\t\t\thideableElements[i].attr(\"display\", \"\");\n\t\t};\n\n\t\t// revert expanded sect...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Check the abstract is bound.
check(abstract) { let resolved_abstract = this.resolveAbstract(abstract); if (this.bindings[resolved_abstract] === undefined) { return false; } else { return true; } }
[ "function checkBindings () {\n addLog('checkBindings() was Triggered');\n // if dataBoundNodes has elements in it, loop through each one and\n // see if there's a variable for it\n scope.dataBoundNodes = _.chain(scope.dataBoundNodes)\n .filter(function (node) {...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Exponential search (O(log n) logarithmic time) can outperform binary search when the element being searched for is near the beginning of the array. Exponential search narrows down the array first, then calls binary search on the narrowed down array. Time: O(log2 i) where i is the location where searchNum is located. Sp...
function exponentialSearch(sortedNums, searchNum) { if (sortedNums[0] === searchNum) { return true; } // repeatedly double i to quickly narrow down range let i = 1; while (i < sortedNums.length && sortedNums[i] <= searchNum) { i *= 2; } return binarySearch( sortedNums, searchNum, i /...
[ "function binarySearch(arr, value) {\n let low = 0;\n let high = arr.length - 1;\n\n while (low <= high) {\n let mid = Math.floor(low + (high - low) / 2);\n if (arr[mid] === value) {\n return mid\n } else if (arr[mid] < value) {\n low = mid + 1;\n } else { //arr[mid] > value\n high = m...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Uncomment these to check your work! const capLastTestCases = []; capLastTestCases.push(["hello", "hellO"]); capLastTestCases.push(["goodbye", "goodbyE"]); capLastTestCases.push(["howdy", "howdY"]); const shouldCapitalizeLast = makeFuncTester(capLastTestCases); const capLastAttempt1 = str => str.toUpperCase(); const cap...
function makeHistory(limit) { let recentArgs = []; return stringArg => { if (stringArg == "undo" && recentArgs.length == 0) { return "nothing to undo"; } if (stringArg == "undo") { let undoneWord = recentArgs.pop(); return `${undoneWord} undone`; } if (recentArgs.length >= lim...
[ "function upperCaseLastNames(input) {\r\n\r\n // if(!Array.isArray(input)){ \r\n // return false;\r\n // }\r\n\r\n // scenario: we know we have an array of stuff\r\n // and we know we're gonna need to iterate across that array\r\n // (we know we need to loop across that array)\r\n // but ho...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Check if the node is allready under monitoring
isMonitored(node) { let monitoredNode = this.monitoredNodes.find( monitoredNode => monitoredNode === node.id ) if (monitoredNode) { return monitoredNode } }
[ "function check() {\n clearTimeout(timer)\n\n if (device.present) {\n // We might get multiple status updates in rapid succession,\n // so let's wait for a while\n switch (device.type) {\n case 'device':\n case 'emulator':\n willStop = false\n t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Announces that a |player| did a report of |reportedPlayer| because of |reason| to all ingame administrators. It uses the ReportTag for the IRCmessage.
announceReportToAdministrators(player, reportedPlayer, reason) { const formattedMessage = format( Message.ANNOUNCE_REPORT, player.name, player.id, reportedPlayer.name, reportedPlayer.id, reason); server.playerManager.forEach(player => { if (!player.isAdministrator()...
[ "announceReportToAdministrators(player, reportedPlayer, reason) {\n this.manager_.announceReportToAdministrators(player, reportedPlayer, reason);\n }", "function reportStatus(theReason) {\n\tprint(\"thereason is \" + theReason);\n var reason = { \n \"reason\" : theReason\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
generate new debug log
function onGenerateDebugInfo() { clearTimeout(timer); if (po.obj.lstatus.match(/ready/g) == "ready") { blockUI_confirm("Confirm to discard current log and generate new one", sendobjects_setRefreshTimer, setRefreshTimer); return; } if (po.obj.lstatus.match(/waiting for result/g) == "waiting for res...
[ "function createDebugLogger(){\r\n $('BODY') \r\n .prepend(\r\n $('<div />')\r\n .append(\r\n $('<h4 />')\r\n .text('Output log event')\r\n .append(\r\n $('<a />')\r\n .attr('href','#')\r\n .on(ao.confi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Greater than 58.75em (940px)
function is_large( vp_width ) { return vp_width > $(58.75).toCleanPx(); }
[ "function is_medium( vp_width ) {\n return vp_width > $(40).toCleanPx() && vp_width <= $(58.75).toCleanPx(); \n}", "function burningPileFirebrandHeight (flameHt) {\n return Math.max(0.0, 12.2 * flameHt)\n}", "function getHeight() {\n return 2;\n }", "function setnhdrwrapsizerReducedSizePX(){\r\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Color palette to use on the datepicker's calendar.
get color() { return this._color || (this._datepickerInput ? this._datepickerInput.getThemePalette() : undefined); }
[ "function setupColorMap() {\n var c3=colorbrewer.Dark2[8];\n var c1=colorbrewer.Set1[8];\n var c2=colorbrewer.Paired[8];\n colorMap.push('#1347AE'); // the default blue\n for( var i=0; i<8; i++) {\n colorMap.push(c1[i]);\n }\n for( var i=0; i<8; i++) {\n colorMap.push(c2[i]);\n }\n for( var i=0; i<8;...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
add details of new teams to notification email
function new_teams_notification () { var arrayLength = L_new_teams.length; if (arrayLength==0) { L_email_html += "<b>No new teams added to database</b><br><br>"; } // else output the new teams info else { for (var i=0; i<arrayLength; i++) { // get team code var team_code = L_new_teams[i]; ...
[ "function paid_teams_notification ()\n{\n\tvar arrayLength = L_paid_teams.length;\n\tif (arrayLength==0)\n\t{\n\t\tL_email_html += \"<b>No teams updated in database paid</b><br><br>\";\n\t}\n\t\n\t// else output the paid teams info\n\telse\n\t{\n\t\tfor (var i=0; i< arrayLength; i++) \n\t\t{\n\t\t\t// get team code...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Load the statistics from the `stats.json` file and return new object.
static loadFromFile(statsFile = Statistics.defaultLocation) { if (!fs.existsSync(path.dirname(statsFile))) { fs.mkdirSync(path.dirname(statsFile), { recursive: true }); } if (!fs.existsSync(statsFile)) { if (fs.existsSync("./data/stats.json")) { fs.renameS...
[ "load(statsFile = Statistics.defaultLocation) {\n if (!fs.existsSync(path.dirname(statsFile))) {\n fs.mkdirSync(path.dirname(statsFile), { recursive: true });\n }\n if (!fs.existsSync(statsFile)) {\n if (fs.existsSync(\"./data/stats.json\")) {\n fs.renameSyn...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
buzzer() Ring the buzzer and flash the LEDs on the BLEADSL [Arguments] params | Object | Optional | times | Integer | Optional | Number of times the buzzer rings | | | The default value is 40. [Returen value] Promise object Nothing will be passed to the `resolve()`.
buzzer(params = {}) { return (async () => { // Check the parameters let valid = parameterChecker.check(params, { times: { required: false, type: 'integer', min: 1, max: 500 }, }, false); if (!valid) { throw new Error(parameterChecker.error.message); } let times ...
[ "function buzz(){\n connectFactory.buzzBuzzTrial(buzzerRound);\n $rootScope.$emit(rootScopeEvents.buzzTriggered);\n }", "restForBeatsEach(args){\n if(this._peripheral.AllConnected == false)\n return;\n if (this.inActionC1C2C3 == true)\n return;\n\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns an array containing all people who have commented in the discussion
function getCommentors(body) { $ = cheerio.load(body); var commentors = []; $('.user-name', '.activity-item-comment-actor') .each(function(i,elem){ commentors.push($(this).text()); }); return unique(commentors); }
[ "findUsers(comments) {\n\t\tconst users = [];\n\t\tcomments.forEach((c) => {\n\t\t\tusers.push(c.name);\n\t\t});\n\t\treturn users;\n\t}", "participants({includeFrom = true, includeBcc = false} = {}) {\n const seen = {}\n const all = []\n let contacts = [].concat(this.to, this.cc)\n if (includeFrom) {...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Enter a parse tree produced by Java9ParserlastFormalParameter.
enterLastFormalParameter(ctx) { }
[ "FormalParameterList() {\n const params = [];\n\n do {\n params.push(this.Identifier());\n } while (this._lookahead.type === \",\" && this._eat(\",\"));\n\n return params;\n }", "enterInferredFormalParameterList(ctx) {\n\t}", "exitFormalParameters(ctx) {\n\t}", "enterCatchFormalParameter(ctx...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
addCrosshairs: Add and show a cross hair centered on the magnified mouse.
addCrosshairs() { if (!this._crossHairs) this._crossHairs = new Crosshairs(); let thickness = this._settings.get_int(CROSS_HAIRS_THICKNESS_KEY); let color = this._settings.get_string(CROSS_HAIRS_COLOR_KEY); let opacity = this._settings.get_double(CROSS_HAIRS_OPACITY_KEY); ...
[ "addCrosshairs(crossHairs) {\n this._crossHairs = crossHairs;\n\n // If the crossHairs is not already within a larger container, add it\n // to this zoom region. Otherwise, add a clone.\n if (crossHairs && this.isActive()) {\n this._crossHairsActor = crossHairs.addToZoomRegio...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function to iterate over object returned from github API finds avatar URL and username to pass onto downloadImageByURL
function iterateAvatars(err, obj) { if (err) { throw err; } for (var index in obj) { let login = obj[index].login; let path = "avatars/" + login; //missing .jpg or .png here, will be added in downloadImageByURL let avatarURL = obj[index].avatar_url; downloadImageByU...
[ "async function findAvatar(username) {\r\n\ttry {\r\n\t\tconst userData = await axios.get(\r\n\t\t\t`https://api.github.com/search/users?q=${username}`\r\n\t\t);\r\n\t\tconst userAvatar = await userData.data.items[0].avatar_url;\r\n\t\treturn userAvatar;\r\n\t} catch (error) {\r\n\t\tconsole.log(error);\r\n\t}\r\n}...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Assigns workers to chunks in batch, up to at most the value of maxConcurrentConnections
_assignWorkers() { // contains at most the specified number of workers let workersToAssign = this._uploadState.idleWorkers.slice(0, this._options.maxConcurrentConnections); // assign work to all workers workersToAssign.forEach((worker) => { let nextChunk = chunker.next(); if (nextChunk) { ...
[ "function parallelize(data, worker, numWorkers, callback) {\n var reg, slices, start, max, t0, t1,nWorkers,dataSize;\n start = 0\n slices = get_slices(data, numWorkers);\n max = slices.length;\n dataSize = data.length;\n nWorkers = slices.length;\n console.log(\"creating \" + slices.length + \...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
when clicking 'share', generate the link for sharing
function handleShareClick() { setShareUrl(window.location.origin + '/?' + simplifiedSharedParamsString); }
[ "function onShareClick() {\n $('.js-email-button').click(function(e) {\n const id = $(this).closest('article').attr('data-id')\n const petObj = getPetFromStore(id)\n window.location.href = `mailto:?&subject=Pet available for adoption from ${petObj.organization.name}&body=Pet Name: ${petObj.attributes.name...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
load configuration from database to memory
function _loadConfigurationFromDatabaseToMemory(){ return new Promise(function(resolve, reject){ let pool = system.systemVariable.get('pool'); let query = 'SELECT config FROM siteconfig LIMIT 1'; pool.getConnection(function(err, connection){ if(err){ return reject(err); } connection.query(que...
[ "async _loadDbConfig() {\n //dont trow exception for the case where the database is not installed\n try {\n //get config from db\n const configs = await this._configModel.findAll({})\n //set the config on an object\n await utils.asyncMap(configs, config => {\n this._configs[config.c...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
renderViz Creates the viz with the following options: width: 850px, height: 860px renders it into the tableauViz in demo.html
function renderViz() { // Define variables for viz var mainVizDiv = $("#tableauViz"); var mainVizOptions = { hideTabs: true, hideToolbar: true, //toolbarPositon: top, // (or "bottom") width: 850, height: 860, onFirstInteractive: function () { mai...
[ "function showViz() {\n viz.show();\n}", "function renderVizMoreOptions() {\n\n // Define variables for viz\n var mainVizDiv = $(\"#tableauViz\");\n var mainVizOptions = {\n hideTabs: false,\n hideToolbar: false,\n //toolbarPositon: top, // (or \"bottom\") \n width: 8...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Adds the following properties to each feature: color: the color to shade the feature tooltipValue: the feature tooltip text ranges: the feature shading ranges, formatted for display in the legend
addProperties(features, ranges, propertyName, format) { const self = this; features.forEach(function(feature) { let color = "#000"; for (var i = 0; i < ranges.length; i++) { if (feature.properties[propertyName] >= ranges[i].min && feature.properties[propertyName] <= ranges[i].max) { ...
[ "_configureProperties(data, style, summary) {\n var vis = _.extend({}, style), d, key;\n if (vis.strokeColorKey) {\n vis.strokeColor = _.compose(\n geojsonUtil.colorScale(vis.strokeRamp, summary[vis.strokeColorKey]),\n function (props) { return props[vis.stroke...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
generates an invoice number (MPMonthDateMinuteSeconds)
function getInvoice(){ let date = new Date(); let monthStr = ('0' + (date.getMonth()+1)).slice(-2); let dateStr = ('0' + date.getDate()).slice(-2); let minutesStr = ('0' + date.getMinutes()).slice(-2); let secondsStr = ('0' + date.getSeconds()).slice(-2); let invoiceNumber = monthStr + dateSt...
[ "static generateInvoiceNumber(nrOfInvoices, creationDate) {\n const maxSize = 2; // max 99 invoiceNumbers can be made each year === enough room for growth\n if (nrOfInvoices === 99) {\n throw new Error(\"Max nr of invoices already reached. Aborting.\");\n }\n nrOfInvoices++;\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
determine if the studnet is in graduate school
function isGraduateStudent(data) { switch (data) { case "M.A.": result = true; break; case "M.B.A.": result = true; break; case "M.ED.": result = true; break; case "M.J.A.": result = true; break; case "M.S.": result = true; break; case "M.S.M....
[ "function schoolInGrades(school) {\n if (selectedGrades.indexOf(school.grade_low) >= 0) {\n return true;\n } else if (selectedGrades.indexOf(school.grade_high) >= 0) {\n return true;\n }\n return false;\n}", "function graduation (credits, thesis){\n\tif (credits >= 120 || thesis === true){\n\t\treturn \...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Draws all entities as rectangles, that have a position and a size. Draws the entity with a color, if the enity has a color.
function drawEntities() { for (let i = 0; i < entities.length; i++) { push(); const entity = entities[i]; if(entity.position) { translate(entity.position.x - camera.x, entity.position.y - camera.y); } if(entity.rotate) { rotate(entity.rotate); ...
[ "draw() {\r\n this._ctx.clearRect(0, 0, this._ctx.canvas.width, this._ctx.canvas.height);\r\n this._ctx.save();\r\n for (let i = 0; i < this._entities.length; i++) {\r\n this._entities[i].draw(this._ctx);\r\n }\r\n this._ctx.restore();\r\n }", "function drawRects()...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This sample demonstrates how to Queries policy events for the resource.
async function queryAtSubscriptionLevelResourceScope() { const subscriptionId = process.env["POLICYINSIGHTS_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; const policyEventsResource = "default"; const resourceId = "subscriptions/fff10b27-fff3-fff5-fff8-fffbe01e86a5/providers/Microsoft.SomeNa...
[ "async function queryAtResourceScope() {\n const subscriptionId =\n process.env[\"POLICYINSIGHTS_SUBSCRIPTION_ID\"] || \"00000000-0000-0000-0000-000000000000\";\n const policyEventsResource = \"default\";\n const resourceId =\n \"subscriptions/fff10b27-fff3-fff5-fff8-fffbe01e86a5/resourceGroups/myResourceG...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
init slider for Media page
function initMediaSlider(){ var wasActive, willActive, curIndex = 0; $(".thumb-element li a").click(function(event) { event.preventDefault(); }); $(".thumb-element li").click(function() { // see if same thumb is being clicked if ($(this).hasClass("active")) return; curIndex = $(this).index(); swit...
[ "function slider() {\n if (position) {\n buildSlidePositionHtml(numSlides);\n }\n\n if (navigation) {\n buildSlideNavHtml();\n }\n\n if (autoPlay) {\n play();\n }\n}", "function init(set) {\n // Make settings available to all functions\n settings = set;\n\n // Selec...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
smooth scroll to infos
function infoscroll() { $('html, body').animate({ 'scrollTop': $('#infos').offset().top }, 900); }
[ "function learnMore() {\n $('html, body').animate({\n scrollTop: $('#ps-home-description').offset().top + 'px'\n }, 'slow');\n }", "smoothScrollTo( scrollToElement ) {\n\n if( scrollToElement.length < 1 ) {\n return;\n }\n\n const new_position = scrollToEl...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Deletes all selected webhooks.
deleteSelectedWebhooks() { const webhooks = this.selectedWebhooks.getSelected(); if (webhooks.length === 0) { this.toastService.info('You have to select at least one webhook.'); return; } this.webhookResource.removeMany(webhooks) ...
[ "function delete_all() {\n return apiWithAuth.delete(`/notifications/delete_all`);\n}", "deleteAll() {\n return spPost(Versions(this, \"deleteAll\"));\n }", "function deleteAllProducts() {\n API.deleteAll()\n .then(res => {\n loadProducts();\n })\n\n }",...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Cancel stops the requestAnimationFrame callback on a resize so it isn't run twice. Override this if you need to do something before the draw() call runs.
cancel() { if (this.raf) { cancelAnimationFrame(this.raf); } }
[ "function stopVisualization(){\n\t\twindow.cancelAnimationFrame(request_animation);\n\t\tamplitude_container.innerHTML = '';\n\t}", "resetResize() {\n\t\tconst {\n\t \tisResizing\n\t } = resizeState;\n\n\t if (isResizing) {\n\t \tassign(resizeState, resizeDefaults);\n\t\t removeClass(this.container, RESIZE_C...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
returns value of the current input element
function spinputvalue () { if (!isContentEditable) return element.value; return element.innerText; }
[ "function inputvalue(){\n return input.value\n}", "function getElementValue(element) {\n switch (element.tagName) {\n case 'SELECT':\n var value = element.options[element.selectedIndex].value;\n if (value.indexOf(';') == 1)\n return value.substr(2);\n return value;\n case 'INPUT':\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
shrink all words to original size
function shrink() { document.querySelectorAll('.word').forEach((element) => { element.style.fontSize = '16px'; }); }
[ "function resizeWordcloud() {\n wordCloudDiv.empty();\n $scope.wordCloud = wordcloud.WordCloud(wordCloudDiv.width(), wordCloudDiv.width() * 0.75,\n 250, $scope.addSearchString, \"#wordCloud\");\n $scope.wordCloud.redraw($scope.wordCount.getWords());\n wordC...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Make final adjustments to row lenghts (stretch images)
function realignRows() { /* realign can happen after multiple createRows so always start at top */ var last_index = -1, img_index = 0, box_w = $box.width()-1, li = null, $img = null; //$("li.first, li.last", $box).removeClass("first").removeClass("last"); $.each(img_rows, function (i, row) { var...
[ "adjustToFill(currentWidth, availableRowWidth, domRow, imageCount) {\n let i = 0;\n while (currentWidth < availableRowWidth) {\n const imageContainer = domRow.querySelector('.image-wrapper:nth-child(' + (i + 1) + ') .gallery-image');\n imageContainer.style.width = (imageContainer...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Dispatches an event to notify that entries are changed (created or deleted).
dispatchEntryChangedEvent_() { const deletedEntries = []; const createdEntries = []; for (const url in this.pendingDeletedEntries_) { deletedEntries.push(this.pendingDeletedEntries_[url]); } for (const url in this.pendingCreatedEntries_) { createdEntries.push(this.pendingCreatedEntries_[...
[ "changed() {\n ++this.revision_;\n this.dispatchEvent(EventType.CHANGE);\n }", "itemsChanged() {\n this._processItems();\n }", "function notifyChange(attrHolder, key, newValue, oldValue) {\n var listeners = attrHolder.changeListeners;\n for (var i=0, len=listeners.length; i<len; i++...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Move forward, stepping to the next frame or finishing this AI
function stepForwardOrFinish () { if (memento.frame < N_FRAMES) stepForward(); else finish(); }
[ "function _nextFrame() {\n \n // Increment (or decrement) the frame counter based on animation direction\n _frame += _direction;\n\n // Test if requested frame lies outside specified array of frames\n if (_frames.length > 1 && (_frame >= _frames.length -1 || _frame < 0)) {\n \n // Varies depending on desi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Updates the post title with the updated content.
function updatedTitle(){ var postTitle = document.getElementById('postTitle'); var editedText = postTitle.innerText; postTitle.innerHTML = "UPDATED: "+editedText; postTitle.classList.remove("edit"); postTitle.contentEditable = "false"; }
[ "function editableTitle(){\n var postTitle = document.getElementById('postTitle');\n var titleText = postTitle.innerText;\n if(titleText.startsWith(\"UPDATED: \"))\n titleText = titleText.replace(\"UPDATED: \",\"\");\n postTitle.innerHTML = titleText;\n postTitle.contentEditable = \"true\";\n postTitle...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Draw new tiles and remove the old ones
function drawTiles() { m_this._removeTiles(); m_this.draw(); delete m_pendingNewTilesStat[m_updateTimerId]; }
[ "function draw_bg_tiles() {\n\n // remove previous bg tiles\n bg_tile_ids.forEach(function(bg_tile_id) {\n remove_element(bg_tile_id);\n });\n bg_tile_ids = [];\n\n // add new background tiles\n for (var x = 0; x < grid_size[0]; x++) {\n for (var y = 0; y < grid_size[1]; y++) {\n\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
To add or reduce left margin of an element
function changeLeftMargin(element, changeMode, amount){ var marginleft = element.style.marginLeft; switch ( changeMode ) { case "add": if(isNaN(marginleft)){ marginleft = parseInt(marginleft.replace("px","")); element.style.marginLeft=(marginleft + amount)+"px"; }...
[ "function setMargin(bed, margin) {\n\tbed.margin = margin;\n}", "function getMargin(bed) {\n\tif(!bed.hasOwnProperty('margin') || bed.margin == undefined){\n\t\tbed.margin = 1;\n\t}\n\treturn bed.margin;\n}", "mover() {\n\n // Desloca o Pterossauro '1px' pra esquerda\n this.element.style.r...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
metoda provadi nastaveni jednotlivych slideru amountslider, repaymentperiodslider a procentualrepaymentslider ma argument objekt options, ktery obcahuje udaje o nastaveni. options nabizi jednu ze trech moznosti: electronics, car nebo reality
function sliderInit(options) { // na strance mame tri bloky pro zobrazeni aktualnich hodnot, ktere mame nastavene pomoci slideru // id bloku: #amount, #repayment-period a #procentual-repayment /* -------------------------------------------------------------------------------------------------------...
[ "function installSlider(){\n\t\t $(\"#slider\").rangeSlider({\n\t\t \tbounds:{\n\t\t \t\tmin: 1995,\n\t\t \t\tmax: 2014\n\t\t \t\t},\n\t\t \tdefaultValues:{\n\t\t \t\tmin: 1995,\n\t\t \t\tmax: 2014\n\t\t \t\t},\n\t\t \tstep: 1,\t \n\t\t\t\tscales : [\n\t\t\t\t\t// primary scale\n\t\t\t\t\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Promisefactory for actually driving a visit
function visitDriver(params) { // Parse details out of "config" object (no validation--that's handled by experiment()) const { browser, // The browser instance itself log, // per-page logger adapter (maintains state of the page-visit) page, // puppeteer Page instance for tab we're using ...
[ "runGeneratorPromise (it) {\n return new Promise((resolve, reject) => {\n this.runGenerator(it, resolve)\n })\n }", "function makePromise(arg) {\n return new Promise(function(resolve, reject) {\n setTimeout(resolve(arg), 1000);\n });\n }", "function waitAndClick(selector)...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
converti tableau de tableaux de lignes en tableau de tableaux de colonnes
static ligne2Colonne(tabDeTabs){ let tab2Col = create2DArray(tabDeTabs.length); for (let i = 0; i < tabDeTabs.length; i++){ for (let j = 0; j < tabDeTabs.length; j++){ tab2Col[j][i] = tabDeTabs[i][j]; } } return tab2Col }
[ "function table(){\n var input = document.getElementById(\"input\");\n var output = document.getElementById(\"output\");\n var rows = input.innerHTML.split(\";\"); \n var table = \"<table border='1' >\" + \"<tr> <td>Product Number</td><td>Description</td><td>Quantity</td><td>Price</td></tr>\" ;\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
ogg_stream_state contains the current encode/decode state of a logical Ogg bitstream
function ogg_stream_state(p) { p = p||{}; // unsigned char *body_data; /* bytes from packet bodies */ // long body_storage; /* storage elements allocated */ // long body_fill; /* elements stored; fill mark */ // long body_returned; /* elements of fill returned */ ...
[ "function getSoundState()\n {\n return ( lastState.sound !== undefined ) ? lastState.sound : settings.soundOn;\n }", "get stream() { return ($(\"home_stream\") || $(\"pagelet_intentional_stream\") || $(\"app_stories\") || $(\"pagelet_wall\") || $(main.streamID)); }", "get state() {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
================ CUSTOM FUNCTIONS ================ addInline
function addInline(label) { var list = $('#' + label + '-list'); var length = list.children().length; switch (label) { // Build facilitator element case 'facilitator': var elem = '<div class="inline inline-input clearfix">' + '<div class="facilitator-text clearfix">' + '<in...
[ "function addInline(payload, inline) {\n return addAttachment(payload, inline, true);\n }", "static showInlineBlockStuffs(){\r\n\t\tstuff.style.display = \"inline-block\";\r\n\t}", "isInline(editor, value) {\n return Element$1.isElement(value) && editor.isInline(value);\n }", "function addAt...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
let str2 = preOrderToString(t2, "");
function preOrderToString(node, arr) { if (node === null) { arr.push('X'); return; } arr.push(node.val); preOrderToString(node.left, arr); preOrderToString(node.right, arr); return arr; }
[ "asRevString() {\n const out = [];\n let n = this;\n\n while (n) {\n out.push(n.data.toString());\n n = n.next;\n }\n\n return out.reverse().join('');\n }", "function twoSort(s) {\n return s.sort()[0].split('').join('***');\n}", "function reverseOrder(s){\n return s.split('').reverse...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
createRibbonArcs Create rectangle group forming a full circle.
createRectCircle(parentObj, arc, fill="#425563"){ //Container for the inner rectangle group that has Node Number label var nodeRectGroup = parentObj.append("g") .attr("class", "nodeRectGroup") .selectAll("g") .data(function(chords) { return chords.groups; }) ...
[ "function shapegroup3() {\n circle(-150, shapeY3, bgshapesize);\n ellipse(-50, shapeY3, 40, bgshapesize);\n rect(50, shapeY3, 30, bgshapesize);\n square(150, shapeY3, bgshapesize, 5);\n}", "_createMortarAttachments() {\n this.minRangeCircle = new Circle(this.defLatlng, {\n draggable: \"false\"...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
get Bootstrap's keydown event handler for either Bootstrap 4 or Bootstrap 3
function keydownHandler () { if ($.fn.dropdown) { // wait to define until function is called in case Bootstrap isn't loaded yet var bootstrapKeydown = $.fn.dropdown.Constructor._dataApiKeydownHandler || $.fn.dropdown.Constructor.prototype.keydown; return bootstrapKeydown.apply(this, arguments); ...
[ "function keyhandlerBindingFactory(keyCode) {\n return {\n init: function(element, valueAccessor, allBindingsAccessor, data, bindingContext) {\n var wrappedHandler, newValueAccessor;\n\n // wrap the handler with a check for the enter key\n wrappedHandler = function(data, event...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns whether a platform id represents a web worker UI platform.
function isPlatformWorkerUi(platformId) { return platformId === PLATFORM_WORKER_UI_ID; }
[ "function isUI16() {\n if (!window.top.angular) return false;\n var a = window.top.angular.element('overviewhelp').attr('page-name');\n return a == 'ui16' || a == 'helsinki';\n }", "function isRBMPlatform (currentPlatform) {\n return currentPlatform == HIGH_DIMENSIONAL_DATA[\"rbm\"].platform ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
AUTHOR: nakul DATE : 4/28/2019 BRIEF : Parse the top level itinerary object.
function jnParseItineraryObj(username, itJSONObj) { //var rand = new Person('Rand McNally', 33, 'M'); //var id = 4; //var jnIt = new jnItineraryObj1(id); var consoleLog = ""; // --------- BEGIN CONSOLE MESSAGE { ------------------------ consoleLog = "Parsing JSON for user name: " + username; jnDebugConsole...
[ "function getIndi(item) {\n var indi = {};\n var refid = cleanPointer(item.pointer);\n indi['indi'] = refid;\n indi['even'] = [];\n indi['fams'] = [];\n indi['birt'] = {};\n indi['deat'] = {};\n var tree = item.tree;\n for (i in tree) {\n var tag = tree[i]['tag'];\n var tag_...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
take current product and add to customerobj products collection
AddProduct() { this.customerObj.products.push(this.productObj); this.productObj = new _CustomerApp_CustomerApp_CustomerModel__WEBPACK_IMPORTED_MODULE_0__["Product"](); }
[ "onCustomProductAdd() {\n\t\tconst customProduct = new Product();\n\t\tthis.onProductAdd(customProduct);\n\t}", "addProducts() {\n document.querySelector('#product-list').innerHTML = '';\n document.querySelector('#update').innerHTML = '';\n Product.all.forEach(\n product => (document.querySelect...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Parse a backgroundposition definition: horizontal [vertical]
function parseBackgroundPosition(value) { var bgPos = (value || '').split(/ /); var presets = {center: '50%', left: '0%', right: '100%', top: '0%', bottom: '100%'}; var decodePos = function(index) { var pos = (presets[bgPos[index]] || bgPos[index] || '50%'). match(/^([+-]=)?([+-]?\d+(\.\d*)?)(.*)$/); bgPos[in...
[ "setBackgroundSizeConfig() {\n let backgroundSizeConfig = [];\n for (let xAxisIndex = 0; xAxisIndex < 4; xAxisIndex++) {\n for (let yAxisIndex = 0; yAxisIndex < 3; yAxisIndex++) {\n backgroundSizeConfig.push((xAxisIndex * this.blockWidth) + 'px ' + (yAxisIndex * this.blockHei...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function to take the canvas and convert it to a tensor with the format of MobileNet
function createWebcamTensor(){ // Get the img from the canvas and normalize the values let webcamImg = []; loadPixels(); for(let j=0 ; j<height ; j++){ for(let i=0 ; i<width ; i++){ let pix = (i + j*width)*4; webcamImg.push(map(pixels[pix+0], 0, 255, -1, 1)); webcamImg.push(map(pixels[pix+1], 0, 255, -1,...
[ "toBatchTensor(inputSize, isCenterInputs = true) {\n this._inputSize = inputSize;\n return tf.tidy(() => {\n const inputTensors = range(this.batchSize, 0, 1).map(batchIdx => {\n const input = this.getInput(batchIdx);\n if (input instanceof tf.Tensor) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Logs a message containing PII (when enabled).
pii(msg, ...vals) { if (this.piiLogging) { this.write(LogLevel.Pii, msg, vals); } }
[ "noisy( msg ) {\n const self = this;\n if ( !self.useNoisyLogging ) { return; }\n Y.log( `${self.pid()} ${msg}`, 'info', NAME );\n }", "log() {\n return this._send(format.apply(this, arguments), SysLogger.Severity.notice);\n }", "log(_a) {\n var { s...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Check if player / AI is touching border
function checkBorderCollision() { //Player if (player_x >= (canvas_w - player_w)) rightKey = false; if (player_x <= (0)) leftKey = false; if (player_y <= (0)) upKey = false; if (player_y >= (canvas_h - player_h)) downKey = false; //AI if (AI_x >= (canvas_w - AI_w)) rightAI = false; ...
[ "hitBorder() {\n let head = this.state.rat[0]\n if (head[0] >= 100 || head[1] >= 100 || head[0] < 0 || head[1] < 0) {\n this.gameOver()\n }\n }", "function collisionTopBorder(circle){\n /*******************\n * PARTIE A ECRIRE */\n return circle.y-circle.radius<0;\n //return false;\n /*********...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
exported position takes a list and a number and returns the index of the place to insert the number in the list
function position(list, num) { for(var i=0; i<list.length ;i++){ if(list[i]>=num &&i<list.length ) { return i; } } return list.length; }
[ "function nth(list, num) {\n let placeHolder = [];\n placeHolder = listToArray(list);\n return placeHolder[num];\n}", "insertAt(idx, val) {\n try {\n if (idx > this.length || idx < 0) throw new Error('Index is invalid!');\n\n //case add before first node (unshift)\n if (idx === 0) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Highlights the move from `sourceIndex` to `destinationIndex`.
highlightMoveSD(sourceIndex, destinationIndex) { // TODO }
[ "highlightSelected() {\n\n this.highlighter.setPosition(this.xStart + this.selected * this.distance, this.yPosition + this.highlighterOffsetY);\n\n }", "function applyNodeMove(index) {\n const n = allNodes[index],\n // In the case of a reversed graph, we negate the x-move:\n myXMove = n.mov...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Read OAuth2 parameters and sends them off to the window opener through `window.postMessage`.
receiveAuthParms() { var authData = {}; if (document.location.search) { // Applies to authorizationCode flow var params = new URLSearchParams(document.location.search); var code = params.get('code'); var error = params.get('error'); var state = params.get('state'); authData ...
[ "function getOauth2RedirectHTML() {\n return `\n <!doctype html>\n <html lang=\"en\">\n <body onload=\"process()\">\n </body>\n </html>\n <script>\n \\'use strict\\';\n function process () {\n var sentState = undefined;\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Initializes ACF Blocks logic and registration.
function initialize() { // Add support for WordPress versions before 5.2. if (!wp.blockEditor) { wp.blockEditor = wp.editor; } // Register block types. var blockTypes = acf.get('blockTypes'); if (blockTypes) { blockTypes.map(registerBlockType); } } // Run the initialize callback...
[ "initialize() {\n this.chain.push(new Block(0, {Name: \"Genesis !\"}, 0));\n }", "constructor() { \n \n BlockLastCommitPrecommits.initialize(this);\n }", "function init() {\n cache.set(\"appName\", \"Lunch Box\");\n cache.set(\"currency\", \"ETH\");\n cache.set(\"showAddBalance\", ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns a list of nodes that match a predicate.
filter(predicate) { let reducer = (node, acc, parents) => { if (predicate(node)) acc.push(node); return acc; }; return this.reduce(reducer, []); }
[ "function list(root, predicate = TRUE_PREDICATE) {\n debugging.assert(typeof predicate === 'function',\n 'Predicate must be a function');\n\n return new Promise((resolve, reject) => {\n var entities = [];\n var walker = walk.walk(root, { followLinks: false });\n\n walker.on('directory',...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
const otheritem = [1,2,3,4,5,6,7,8]; const otheritem = ['abc', 'bcd', 'asd', 'efg'] console.log(everyOtherItem(otheritem)); 3. smallestNItems
function smallestNItems(items, n) { // Replace this with your code const sortedItems = items.sort((a, b) => a - b); const sortedNItems = sortedItems.slice(0,n); sortedNItems.reverse(); console.log(sortedNItems); }
[ "function smallEnough(a, limit){\n // const isBelowThreshold = (currentValue) => currentValue < limit;\n return a.every(currentValue => currentValue <= limit)\n\n}", "function indexed_minimumm_calculator(arr, n){\n\tlet least;\n\tfor(i = 0; i < n; i++){\n\t\tleast = Math.min(...arr);\n\t\tleast_index = arr.i...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Given a 2D array of the triangle, returns a vertex weight array
function makeWeightArray(tri2DArr){ var vertexWeights = new Array(getNumNodes(tri2DArr));; var count = 0; for(var i = 0; i < tri2DArr.length; i++){ for (var j = 0; j < tri2DArr[i].length; j++){ vertexWeights[count] = tri2DArr[i][j]; count++; } } return vertexW...
[ "function makeAdjMatTriangle(tri2DArray) {\n var rows = tri2DArray.length;\n var columns = tri2DArray[rows - 1].length;\n var numNodes = getNumNodes(tri2DArray);\n var adjmat = new Array(numNodes);\n var r, c;\n\n for (r = 0; r < numNodes; r++){\n adjmat[r] = new Array(numNodes);\n f...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
justNumber Used internally to parse the value into a floating point number. Replace all characters that are not 09, a decimal point, or a negative sign. A number can be entered using special notation. For example, the following is a valid number: 0.0314E+2 v1.0.2 new v1.5.0 modified v1.5.1 modified v1.5.2 modified
function justNumberNF(val) { newVal = val + ''; var isPercentage = false; // check for percentage // v1.5.0 if (newVal.indexOf('%') != -1) { newVal = newVal.replace(/\%/g, ''); isPercentage = true; // mark a flag } // Replace everything but digits - + ( ) e E var re = new RegExp('[^\\' + this.input...
[ "function putMask_Number_Value(aValue, aintDigits, aintDecimals)\n{\n lstrValue = \"\"+aValue;\n re = new RegExp(\",\",\"g\");\n lstrValue = lstrValue.replace(re,\"\");\n\n // Curtailing Blank spaces from the begining and end of the entered text\n lstrValue = trimString(lstrValue);\n\n if( lstrVal...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get a unique ID for the given subject. This is normally the URI; if the subject has no URI, a unique ID is assigned.
function getSubjectId (subject) { if ('uri' in subject) { return subject.uri } else if ('_subject_id' in subject) { return subject._subject_id } else { const result = '' + subjectIdCounter subject._subject_id = result ++subjectIdCounter return result } }
[ "findUniqueIdentifier() {\n const metadataId = this.attributes[\"unique-identifier\"];\n if (metadataId) {\n const uidMetadata = this.metadata.findItemWithId(\n \"dc:identifier\",\n metadataId\n );\n if (uidMetadata) {\n return uidMetadata.value;\n }\n }\n }", "g...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Return the path of qb.exe. This relies on knowledge of the directory structure of the quickuimarkup project. In this case, we walk up from the tasks folder to get to the output directory for the .Net build tool.
function getQbExecutablePath() { var path = require( "path" ); var modulePath = path.dirname( module.filename ); var qbPath = path.resolve( modulePath + "/../qb/bin/Release/qb.exe" ); return qbPath; }
[ "function getBinScript(name) {\n // Global install or npm@2 local install, dependencies in local node_modules\n let paths = glob.sync(`../node_modules/.bin/${name}`, {cwd: __dirname})\n if (paths.length > 0) return path.join(__dirname, paths[0])\n // Local npm@3 install, .bin and dependencies are siblings\n pa...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Asynchronously run Python code and return the value returned from Python. If an error occurs, pass the error message to this.stderrCallback() and return undefined.
async runPyAsync(code, { returnResult = "none", printResult = false } = { returnResult: "none", printResult: false }) { const response = await this.postMessageAsync({ type: "runPythonAsync", code, returnResult, printResult }); if (response.error) { const err...
[ "function nodeCB(code, stdout, stderr, cb) {\n if (code !== 0) {\n console.log('Program stderr:', stderr);\n shell.exit(1);\n } else {\n cb();\n }\n}", "run(callback) {\n let self = this;\n async.series([\n (xcallback) => {\n self.runInitScript...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Replaces all ocurrences of emoticons in the given html with images
function emoticons(html){ for(var emoticon in emotes){ for(var i = 0; i < emotes[emoticon].length; i++){ /* css class of images is emoticonimg for styling them*/ html = html.replace(" " + emotes[emoticon][i], " <img src=\""+icon_folder+"/"+emoticon+".gif\" class=\"emo...
[ "function replace_all_html_emoticons(text_element){\n\n var working_copy = text_element.clone();\n\n // emoticon's img elements\n var imgs = working_copy.find('img[class=\"emoticon\"]');\n imgs.each(function () {\n var html_emoticon_element = $(this);\n replace_html_emoticon(html_emoticon_...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }