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
TODO: generic function for returning tertial chord tones.
function mod (x, n) { return (x % n + n) % n; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function createChord(qtd, onFinish){\n\tvar count = 0;\n\treturn {\n\t\tnotify: function(){\n\t\t\tcount++;\n\t\t\tif(count == qtd){\n\t\t\t\tonFinish();\n\t\t\t}\n\t\t},\n\t\tgetCount: function(){\n\t\t\treturn qtd;\n\t\t},\n\t\tgetOnFinishFunction: function(){\n\t\t\treturn onFinish;\n\t\t}\n\t};\n}", "chordIn...
[ "0.63290584", "0.61489767", "0.6141282", "0.61235756", "0.61214584", "0.61050826", "0.60393286", "0.6036396", "0.6036396", "0.6036396", "0.60181284", "0.60001016", "0.59827065", "0.59666485", "0.5966271", "0.59393525", "0.583903", "0.5816135", "0.5765871", "0.57472646", "0.57...
0.0
-1
Start Total price Section
function updateTitalPrice(){ const bestPrice=document.getElementById("best-price"); const bestPriceInner=parseInt(bestPrice.innerText); const memoryPrice=document.getElementById("memory-cost"); const memoryPriceInner=parseInt(memoryPrice.innerText); const storagePrice=document.getElementById("storage-cost"); const storagePriceInner=parseInt(storagePrice.innerText); const delivaryCost=document.getElementById("Delivery-charge"); const delivaryCostInner=parseInt(delivaryCost.innerText); const totalPrice=document.getElementById("total"); totalPrice.innerText=bestPriceInner+memoryPriceInner+storagePriceInner+delivaryCostInner; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function calculateTotal() {\r\n\t\tvar Amount =getPrice() *getPages();\r\n\t\t//display cost.\r\n\t\tvar obj =document.getElementById('totalPrice');\r\n\t\tobj.style.display='block';\r\n\t\tobj.innerHTML =\" Cost of the paper: \\t $\"+ Amount;\r\n\t}", "function totalPrice() {\n let ttlPrice = 0;\n cus...
[ "0.66693866", "0.6484684", "0.64808106", "0.63282895", "0.63199127", "0.63037604", "0.6267874", "0.62595713", "0.6197429", "0.6196644", "0.61493343", "0.6082301", "0.6071953", "0.6065644", "0.6043585", "0.60393846", "0.6020132", "0.60201204", "0.6019365", "0.60152024", "0.600...
0.0
-1
ON SELECT VIEW CHANGE This function is called when the "View: " select box is changed This function will change the filter list to display one of three options: All MY GROUPS FOLLOWED GROUPS
onViewChange(e){ const view = e.target.value; var oldSort = this.state.sort; this.setState({ sort: 'date' }); this.setState({ view: view }); const originalList = this.state.items; var newList = []; switch (view){ case 'mygroups': newList = this.state.myGroups; break; case 'followed': newList = this.state.followedGroups; break; case 'all': newList = this.state.items; break; } this.setState({ viewItems: newList }); this.sortChange(oldSort, newList); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function selectViewGroups() {\n viewTotal = document.getElementById(\"view-total-groups-sel\").value;\n\n checkGroupsSidebar();\n getAllGroups();\n}", "function applyFilter() {\n $(\"select\").change(function() {\n displayWikiEntries();\n });\n}", "function country_select(view_name, option) {\n ...
[ "0.67307514", "0.64616853", "0.64076674", "0.6392293", "0.6259595", "0.6043788", "0.60186267", "0.6018032", "0.6012051", "0.5991891", "0.59443146", "0.59274036", "0.5918514", "0.59144443", "0.5912902", "0.5895914", "0.58931386", "0.58783895", "0.58698887", "0.5856069", "0.583...
0.6134126
5
ON SELECT SORT CHANGE This function is called when the "Sort By: " select box is changed This function will call sortChange
onSortChange(e){ const sort = e.target.value; const viewList = this.state.viewItems; this.sortChange(sort, viewList); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function onSortValueChanged() {\n $scope.options.filter = { sort: $scope.sortValue };\n }", "function sortSelectCallback() {\n let sortType = $(this).val();\n setStatus(\"sortType\", sortType);\n\n console.log(\"sort clicked\");\n\n //TODO: Can we do this without ref...
[ "0.7887432", "0.7607547", "0.7379757", "0.735196", "0.73405117", "0.7321879", "0.70538723", "0.7052784", "0.69722575", "0.6880879", "0.6872265", "0.6821036", "0.6816971", "0.6798275", "0.67950207", "0.67900306", "0.67745024", "0.6745036", "0.6701516", "0.66981304", "0.6653831...
0.76273346
1
ON FILTER INPUT CHANGE This function is called when the "Filter" input box is changed This function will change the filter list to display only what matches user input. This function is performed on the final layer of the list. The first layer is determined by ON VIEW CHANGE and saved in state.viewItems The final layer (This one) is saved in state.filteredItems.
onFilterInputChange(e){ const sortedList = this.state.sortedItems; const updatedList = sortedList.filter(function(item){ return (item.value.title.toLowerCase().search( e.target.value.toLowerCase()) !== -1) || (item.value.field.toLowerCase().search( e.target.value.toLowerCase()) !== -1); }); this.setState({ filteredItems: updatedList }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function onFilterChange(event, payload) {\n\t\tconst entry = getEntry(props.titleMap, payload.value);\n\t\tupdateValue(event, entry, false);\n\t\tshowFilteredSuggestions();\n\n\t\t// resetting selection here in order to reinit the section + item indexes\n\t\tresetSelection();\n\t}", "_onFilterSelected(event) {\n...
[ "0.76139957", "0.70537287", "0.6965417", "0.68645287", "0.68261755", "0.6780433", "0.67711717", "0.67572856", "0.67322963", "0.66584", "0.6629181", "0.6620172", "0.6617736", "0.6582838", "0.65362555", "0.6498765", "0.64757866", "0.64467114", "0.64336044", "0.64252657", "0.642...
0.6817216
5
COMP WILL MOUNT This function is called when the Compounent is ready to mount This function will populate the filter list to have the ability to display one of three options: All MY GROUPS FOLLOWED GROUPS
componentDidMount() { const email = localStorage.getItem('email'); this.setState({email: email}); const setGroups = (view) => { ax.get('/' + 'group' + '/_design/dashboard/_view/' + view + '?key=\"' + email + '\"') .then(res => { const viewArray = res.data.rows; const itemsArray = this.state.items; itemsArray.push.apply(itemsArray, viewArray); this.setState({ items: itemsArray }); this.setState({ filteredItems: itemsArray }); this.setState({ viewItems: itemsArray }); switch(view) { case 'mygroups': this.setState({ myGroups: viewArray }); break; case 'followed': this.setState({ followedGroups: viewArray }); break; } }); } setGroups('mygroups'); setGroups('followed'); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function populateGroupFilter(e) {\n if (e) {\n e.stopPropagation();\n }\n var $groupInput = $(groupfilterSel + \" input.coral-Textfield\");\n var query = $groupInput.val();\n var filter = \"\";\n if (query) {\n filter = \"&filter=[{\\\"operation\\\":\...
[ "0.61164826", "0.5953688", "0.5677055", "0.5568935", "0.55401564", "0.553617", "0.5519596", "0.5513404", "0.54939336", "0.5488044", "0.5487178", "0.54823476", "0.54426986", "0.54346806", "0.5426425", "0.5395327", "0.5387934", "0.53759915", "0.53618705", "0.532826", "0.5326285...
0.0
-1
RENDER This Renders the List from "class List" with options to view and sort items, as well as a user input filter
render() { return( <div> {this.state.items.length !== 0 && <Container> <br/> <Row> <Col md={{ size: 4, offset: 2 }} xs={{ size: 6, offset: 0 }}> <FormControl fullWidth> <InputLabel htmlFor="view">View:</InputLabel> <Select value={this.state.view} onChange={this.onViewChange.bind(this)} name="view" displayEmpty inputProps={{ name: 'view', id: 'view', }} > <MenuItem value="all">All</MenuItem> <MenuItem value="mygroups">My Groups</MenuItem> <MenuItem value="followed">Followed Groups</MenuItem> </Select> </FormControl> </Col> <Col md={{ size: 4, offset: 0 }} xs={{ size: 6, offset: 0 }}> <FormControl fullWidth> <InputLabel htmlFor="sort">Sort By:</InputLabel> <Select value={this.state.sort} onChange={this.onSortChange.bind(this)} name="sort" displayEmpty inputProps={{ name: 'sort', id: 'sort', }} > <MenuItem value="date">Date Added</MenuItem> <MenuItem value="abc">Alphabetical</MenuItem> <MenuItem value="subject">Subject</MenuItem> <MenuItem value="school">School</MenuItem> </Select> </FormControl> </Col> </Row> <Row> <Col md={{ size: 8, offset: 2 }} xs={{ size: 12, offset: 0 }}> <TextField id="filterInput" label="Filter" type="search" margin="normal" className="filter" onChange={this.onFilterInputChange.bind(this)} fullWidth autoComplete='off' /> <MuiThemeProvider theme={theme}> <ul> {this.state.filteredItems.map(item => <div key={item.id}> <Row> <Col xs={{ size: 12 }}> <Button variant="contained" color="secondary" fullWidth classes={{ root: 'light', label: 'lightLabel' }} component={Link} to={`/group/${item.id}`} > <span className='lightLabel' > {item.value.label === 'mygroups' && <MyGroupIcon />} {item.value.label === 'followed' && <FollowedGroupIcon />} <span> {item.value.title} <br/> {this.state.field} {item.value.field} </span></span> </Button> </Col> </Row> <Row></Row> </div> )} </ul> </MuiThemeProvider> </Col> </Row> </Container> }</div> ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function _renderList(caseSensitive){\n\t\t\t_clear();\n\n\t\t\tlet rerenderOnEachItem = false;\n\t\t\tlet $listItems = $([]);\n\t\t\tconst textFilter = _formatText(caseSensitive, _$filter.val())\n\n\t\t\t_items.forEach( item => {\n\t\t\t\tconst text = _formatText(caseSensitive, item.text)\n\t\t\t\tif(text.indexOf(...
[ "0.7169459", "0.7048155", "0.6728061", "0.6710696", "0.66697717", "0.6663484", "0.6654072", "0.66330683", "0.6591733", "0.6587289", "0.65233797", "0.6522895", "0.649228", "0.6455813", "0.6301149", "0.62860274", "0.6256848", "0.6237304", "0.62213665", "0.6217386", "0.61753315"...
0.0
-1
Returns an array with ExcessAndDisjoint in slot 0 and AvgWeightDifference in slot 1
getInformation(brain1, brain2) { let matching = 0, totalDiff = 0.0; brain1.genes.forEach((val1) => { for (let i = 0; i < brain2.genes.length; i++) if (val1.innovationNumber === brain2.genes[i].innovationNumber) { matching++; totalDiff += Math.abs(val1.weight - brain2.genes[i].weight); break; } }); return [brain1.genes.length + brain2.genes.length - 2 * matching, (matching) ? totalDiff/matching : 100]; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "getWeights() {\r\n let w1 = this.w1.flatten().selection.data;\r\n\r\n let w2 = this.w2.flatten().selection.data;\r\n\r\n return [...w1, ...w2];\r\n }", "function getWeights(measurements) {\n\tvar returnArray = []\n\tvar deviations = exportArray(sigmas)\n\tvar distancesFromMean = subtractF...
[ "0.5554079", "0.5404743", "0.5319898", "0.5318785", "0.52919424", "0.5139239", "0.51053286", "0.51053286", "0.5103475", "0.5079333", "0.50251013", "0.501556", "0.5008845", "0.4994719", "0.496287", "0.49360883", "0.49174115", "0.48936528", "0.4883484", "0.488154", "0.4880407",...
0.4890878
18
=== Color Methods ===
function flipColor(color) { return color === Color.BLACK ? Color.WHITE : Color.BLACK; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Color() { }", "function Color() {}", "get color() {}", "function Colour(){\n\n /* Returns an object representing the RGBA components of this Colour. The red,\n * green, and blue components are converted to integers in the range [0,255].\n * The alpha is a value in the range [0,1].\n */\n thi...
[ "0.81735957", "0.81422204", "0.75469166", "0.74490345", "0.7423291", "0.7374847", "0.73697495", "0.73633343", "0.7304399", "0.7269121", "0.72538364", "0.7250641", "0.7240868", "0.7237023", "0.7221279", "0.7209358", "0.7198963", "0.7132244", "0.7114271", "0.7108806", "0.707935...
0.0
-1
=== ColorPiece Methods ===
function colorPieceEquals(cp1, cp2) { return cp1.color === cp2.color && cp1.piece === cp2.piece; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function pColor(piece){ return piece.charCodeAt(0) }", "function gamePiece(color, size, x, y) {\r\n this.color = color;\r\n this.size = size;\r\n this.x = x;\r\n this.y = y;\r\n}", "function wallColorizer() {\n return 'rgb(150,150,150)';\n}", "function check_piece(piece) {\n\t\t\t\tif (piece[pie...
[ "0.7583976", "0.6762088", "0.66884845", "0.6621083", "0.6583089", "0.64976186", "0.6361044", "0.63522065", "0.6313041", "0.6312103", "0.6295497", "0.6279556", "0.6257866", "0.6250732", "0.62094414", "0.6164515", "0.6117326", "0.61147994", "0.61090344", "0.61015224", "0.609408...
0.64704674
6
=== Square Methods ===
function squareToBoardIndex(sq) { return (9 - sq[0]) + (sq[1] - 1) * 9; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Square() {}", "function calculateSquareAround(s){\n \n return s * 4;\n}", "function isSquare(arr) {\n \n}", "function square(x) { return(x*x); }", "function square() {\n this.currentInput = this.currentInput * this.currentInput;\n this.displayCurrentInput();\n}", "function Square(...
[ "0.8144675", "0.71525824", "0.7108561", "0.708343", "0.7079378", "0.70606405", "0.70457006", "0.7035996", "0.7010344", "0.70054144", "0.69907147", "0.69783944", "0.6959994", "0.6920514", "0.69030195", "0.68996245", "0.68899226", "0.6870355", "0.68588305", "0.6832284", "0.6807...
0.0
-1
=== Board Methods ===
function getBoardSquare(board, sq) { return board[squareToBoardIndex(sq)]; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Board(){}", "createBoard() {\n\t\tfor (let i = 0; i < 6; i++) {\n\t\t\tfor (let j = 0; j < 6; j++) {\n\t\t\t\tlet tile = new MyTile(this.scene, this);\n\t\t\t\tlet pieceSize = 0.395 + 0.005;\n\t\t\t\ttile.addTransformation(['translation', -3 * pieceSize + pieceSize * j, -3 * pieceSize + pieceSize * i, 0...
[ "0.8018523", "0.763567", "0.7590316", "0.75241286", "0.74909925", "0.74703526", "0.746442", "0.746442", "0.746442", "0.7443112", "0.74243397", "0.74083924", "0.7375574", "0.73513615", "0.7318914", "0.73105264", "0.72664833", "0.72521746", "0.72381717", "0.7222123", "0.7217537...
0.0
-1
=== Hand(s) Methods ===
function pieceToKeyOfHand(piece) { return piece; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Hand(props) {\n var els = [];\n if (!!props.currentHand.result) {\n els.push(e(HandResult, props));\n }\n return e('div', null, 'The hand is going');\n}", "function PebbleChain () {}", "function Mechanism() {\n\t }", "function Mechanism() {\n\t }", "function Mechanism() {\n\t ...
[ "0.6051889", "0.6048035", "0.6010854", "0.6010854", "0.6010854", "0.6010854", "0.6001224", "0.59798765", "0.5923961", "0.5845651", "0.5819092", "0.5819092", "0.57929933", "0.57884955", "0.57811755", "0.5758958", "0.57544553", "0.5744306", "0.5726359", "0.5725018", "0.5714356"...
0.0
-1
=== State Methods ===
function cloneState(state) { return { board: cloneBoard(state.board), hands: cloneHands(state.hands), nextTurn: state.nextTurn, }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function State() {\n\n }", "function State() { }", "get state() { return this._state; }", "function State() {\n\n }", "get state(){return this._state;}", "get state(){return this._state;}", "get state(){return this._state;}", "get state() {return this._p.state;}", "...
[ "0.82575643", "0.81956786", "0.79932654", "0.7989977", "0.78277767", "0.78277767", "0.78277767", "0.76826525", "0.7646476", "0.76231533", "0.7518186", "0.7514058", "0.7483096", "0.744144", "0.7432784", "0.7385541", "0.7376441", "0.7376441", "0.7376441", "0.73617727", "0.73581...
0.0
-1
=== Event Methods ===
function cloneEvent(event) { return Object.assign({}, event); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "onEvent() {\n \n }", "function Event() { }", "function Event() { }", "handleEvent() {}", "handleEvent() {}", "handleEvents() {\n }", "_evtChange(event) { }", "function InternalEvent() { }", "function InternalEvent() { }", "function InternalEvent() { }", "function InternalEvent() { }", "fu...
[ "0.7784141", "0.7323476", "0.7323476", "0.7317965", "0.7317965", "0.72933525", "0.7260881", "0.7178237", "0.7178237", "0.7178237", "0.7178237", "0.7178237", "0.70956945", "0.7048784", "0.6989015", "0.68882585", "0.6863407", "0.6863407", "0.6863407", "0.6863407", "0.6863407", ...
0.0
-1
a class to handle gps coordinate retrieval
constructor (){ this.latitude = null; this.longitude = null }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getCoordinatesObj(gps){\n let latLong = gps ? gps.split('|') : [];\n return latLong.length > 0 ?\n {\n lat:Number(latLong[0]),\n lng:Number(latLong[1])\n }:\n handleError(gps,'Getting GPS data');\n}", "function handle_geolocation_query(position){ \n\tdlat=position.coords.latitude;\...
[ "0.74414635", "0.71207523", "0.7061247", "0.70171684", "0.69733185", "0.69158024", "0.68667144", "0.68492687", "0.683708", "0.6815077", "0.67721486", "0.67599237", "0.6750074", "0.6733372", "0.6717924", "0.6717889", "0.6682859", "0.66750413", "0.6649346", "0.6647706", "0.6621...
0.0
-1
Export can also be used on functions
function test() { console.log("tested!"); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function exports() {}", "function exports() {}", "function exports() {}", "function myOtherExportedFunction () {\n console.log(\"i did another something here\");\n }", "export() {\n\t\treturn {}\n\t}", "function actuallyExports(name) { }", "function Export(f) {\n f(exports_container);\n}",...
[ "0.77360934", "0.77360934", "0.77360934", "0.72317827", "0.71461505", "0.6887907", "0.68128544", "0.6761082", "0.6761082", "0.6572861", "0.6510094", "0.6344232", "0.6314384", "0.6275858", "0.6191926", "0.6167217", "0.6167217", "0.6167217", "0.6164563", "0.6164563", "0.6164563...
0.0
-1
updates the current tab
function updateTab(tab) { var index = tab; $("#pokemon-title").text(currentTeam.pokemon[index]); $("#pokemon-input").val(currentTeam.pokemon[index]); $("#ability-input").val(currentTeam.abilities[index]); $("#level-input").val(currentTeam.levels[index]); $("#item-input").val(currentTeam.items[index]); $("#shiny-input").prop("checked", currentTeam.shinies[index]); $("#nature").val(currentTeam.natures[index]); $(".base-stat").each(function(elem) { $(this).text(pokedex[toId(currentTeam.pokemon[index])].baseStats[$(this).data("stat")]); calculateStatTotal($(this).data("stat")); }); var mon = pokedex[toId(currentTeam.pokemon[index])].species; var sets; try { sets = Object.keys(setdex[mon]); } catch (e) { sets = []; } $('#smogdex-dropdown').html("<option value='custom'>Custom Set</option>") for (var i = 0; i < sets.length; i++) { $('#smogdex-dropdown').append($('<option>', { value: sets[i], text : sets[i] })); } updateEVs(tab); updateIVs(tab); updateMoves(tab); loadDataFile(pokedex, "species", "pokemon", tab); loadDataFile(items, "name", "item", tab); loadDataFile(learnsets, "name", "move", tab); loadDataFile(pokedex, "name", "ability", tab); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function refreshCurrentTab()\n{\n jsobj.swap_tabs(XPCNativeWrapper.unwrap($(\"tabs\")).down(\".tabon\").getAttribute(\"val\"));\n}", "function updateActiveTab () {\n let gettingActiveTab = browser.tabs.query({active: true, currentWindow: true})\n gettingActiveTab.then(updateTab, onError)\n}", "function up...
[ "0.7943055", "0.78092164", "0.75093377", "0.7451019", "0.73306435", "0.72802526", "0.72141856", "0.71567965", "0.7136022", "0.7116171", "0.7111221", "0.7046916", "0.70157844", "0.69606274", "0.69239527", "0.68917596", "0.6846809", "0.68405855", "0.6717265", "0.6695", "0.66752...
0.0
-1
get legal moves for a Pokemon (forme)
function getMoves(moves_in, pokemon, learnsets) { if (!learnsets[pokemon]) return moves_in; var genNo = 8; if (teamGen === "SM") genNo = 7; if (teamGen === "XY") genNo = 6; if (teamGen === "BW") genNo = 5; if (teamGen === "DPP") genNo = 4; var moves = Object.keys(learnsets[pokemon]['learnset']); var moves_out = moves_in; for (var i = 0; i < moves.length; i++) { if (moves_out.includes(moves[i])) continue; var learnArray = learnsets[pokemon]['learnset'][moves[i]]; var learnMethod = learnArray[learnArray.length - 1]; if (Number(learnMethod[0]) <= genNo) moves_out.push(moves[i]); } return moves_out; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function possibleMoves(p) {\n return [\n { dir: 'right', x: p.x + 1, y: p.y, score: 0 },\n { dir: 'left', x: p.x - 1, y: p.y, score: 0 },\n { dir: 'up', x: p.x, y: p.y - 1, score: 0 },\n { dir: 'down', x: p.x, y: p.y + 1, score: 0 },\n ];\n}", "function getLegalMoves(tile) {\n\t// highlight le...
[ "0.6723246", "0.66348606", "0.6532427", "0.6431369", "0.6394653", "0.6364732", "0.63309336", "0.6311898", "0.62990725", "0.62624145", "0.61862165", "0.6158471", "0.6148017", "0.61456996", "0.61417705", "0.6117061", "0.60841775", "0.60662395", "0.6051488", "0.59914833", "0.597...
0.6531795
3
Unused at the moment, but likely to be required for fetching any initial data that may be needed appwide or on first load. Best approach is to have the retrieve data maintained in redux's store, then have lowerlevel containers connect/listen to the store. Avoids needing to map the props directly to children components/containers.
componentDidMount() { const { dispatch } = this.props; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "fetchData() {\n this.props.fetchData(this.props.query);\n }", "componentWillReceiveProps() {\n if(this._isMount){\n this.getData()\n }\n }", "componentWillMount() {\n // this.props.fetchMovies(movies) //**(15) for chap14 only where movies are directly retrieved via require('../../movies.json...
[ "0.6427696", "0.63886684", "0.6336148", "0.6313781", "0.6267191", "0.62489796", "0.6206155", "0.6201545", "0.6196122", "0.6195768", "0.6189494", "0.6163803", "0.615049", "0.6139259", "0.61355853", "0.6130278", "0.61283624", "0.6116598", "0.6092856", "0.60745126", "0.60628045"...
0.0
-1
Render child components as outlined in ../routes.jsx
render() { return ( <div> {this.props.children} </div> ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "render() {\n\n return (\n <Routes/> \n )\n }", "render() {\n const routes = (\n <Switch>\n <Route\n path=\"/\"\n exact\n render={() => (\n <AsyncMarketOverview\n rowCount={this.props.rowCount}\n currencyData={this.props...
[ "0.6970992", "0.67825365", "0.6698587", "0.6640794", "0.66112727", "0.66007245", "0.65588295", "0.65464926", "0.6532754", "0.6504948", "0.6434097", "0.6415795", "0.6415644", "0.640086", "0.6340319", "0.6332256", "0.6319391", "0.62953484", "0.6287357", "0.62849635", "0.6265888...
0.62697977
21
converir primera letra de string en mayuscula
function MaysPrimera(string) { return string.charAt(0).toUpperCase() + string.slice(1); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function convertidor(text) {\n let convrtm = text.toLowerCase();\n let frLett = convrtm.charAt(0);\n let convrtM = frLett.toUpperCase();\n let restTxt = convrtm.substr(1,9999);\n console.log(`Your converted phrase is: ${convrtM}${restoTxt}`);\n // console.log(`Su frase convertida es: ${convrtM}${...
[ "0.6881414", "0.63297224", "0.63160765", "0.6303483", "0.63016933", "0.62830764", "0.6239843", "0.6172094", "0.6166873", "0.61548084", "0.6139514", "0.6116929", "0.6100175", "0.6072269", "0.60699743", "0.60178626", "0.5990636", "0.5981581", "0.59328467", "0.59289616", "0.5914...
0.63104993
3
Gets all dependencies recursively on a codebook. Only works where getDirectDeps has been used to populate directDependencies
function getDepsRecursive(field, visited = []) { if (visited.indexOf(field) !== -1) return visited.push(field) for (let dep of field.directDependencies) getDepsRecursive(dep, visited) return visited }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getDependencies() {\n logger.info('Fetching dependencies');\n return new Promise((resolve, reject) => {\n const dependencies = {};\n\n (0, _readPackageTree2.default)('./', (err, data) => {\n if (err) {\n logger.error('Error fetching dependencies');\n return reject(err);\n }...
[ "0.6216771", "0.6191409", "0.591352", "0.584134", "0.56730884", "0.56607074", "0.5646538", "0.5615499", "0.5601988", "0.55997866", "0.5598915", "0.5596652", "0.5558506", "0.55505353", "0.5544376", "0.5540254", "0.55269617", "0.55110514", "0.55070966", "0.550581", "0.5504508",...
0.61925787
1
Converts a parsed csv codebook to internal format Also calculate field dependencies
function csvToCodebook(csv) { let columns = csv[0] let codebook = [] // Create items for (let i = 1; i < csv.length; i++) { let o = {} for (let j = 0; j < columns.length; j++) o[columns[j]] = csv[i][j] codebook.push(o) } for (let field of codebook) field.directDependencies = getDirectDeps(field, (e) => codebook.find((d) => d.name === e) ) for (let field of codebook) field.dependencies = getDepsRecursive(field) return codebook }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "parseInputData(csv) {\n const lines = csv.split(\"\\n\");\n let i;\n for (i = 0; i < lines.length; ++i) {\n lines[i] = lines[i].split(\",\");\n }\n const echelon = lines[0][1];\n this.echelonRef.current.setState({echelon: parseInt(echelon)});\n\n i = 1;\...
[ "0.65200263", "0.6224067", "0.6217271", "0.61175054", "0.609903", "0.5964658", "0.5936103", "0.59125036", "0.58283424", "0.58017915", "0.5798679", "0.5795237", "0.57747024", "0.5766139", "0.5732697", "0.56692064", "0.5603033", "0.5577659", "0.55305666", "0.5526983", "0.552630...
0.7547464
0
Basic Function to give random integer in a range
function ranNumInRange( min, max) { return Math.floor(Math.random()*(max-min+1)+min); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function randInt(range) {\n return Math.floor(Math.random()* range);\n}", "function randomInteger(range){\n\treturn Math.floor( (Math.random() * range) );\n}", "function getRandomInt(range) {\n return 1 + Math.floor(Math.random() * Math.floor(range));\n }", "function randomInt(range) {\n return Mat...
[ "0.8619807", "0.86038774", "0.8478319", "0.8473897", "0.84737885", "0.84737885", "0.84737885", "0.84737885", "0.84579843", "0.84266543", "0.838607", "0.83776385", "0.8357402", "0.83047277", "0.82405835", "0.82372546", "0.8209494", "0.8209494", "0.82075006", "0.82075006", "0.8...
0.0
-1
compare elements in array to see if they are all the same
function isUniform(array){ var first = array[0]; for(i = 1; i < array.length; i++){ if(array[i] !== first){ return false; } } return true; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "static allEqualElements(array) {\n let firstElement = array[0]\n for (let i = 1; i < array.length; i++) {\n if (array[i] !== firstElement) {\n return false;\n }\n }\n return true;\n }", "function allSame(array) {\n\tvar test = array[0];\n\tfor (var i = 1, n = array.length; i < n; i+...
[ "0.82527214", "0.8134318", "0.8130309", "0.80995584", "0.7874294", "0.7804192", "0.7714166", "0.7693793", "0.76286024", "0.7624353", "0.75807405", "0.75742596", "0.73598874", "0.73011553", "0.7300187", "0.72794807", "0.72286886", "0.7211575", "0.7211575", "0.72108084", "0.721...
0.6959307
30
sum all the elements in array
function sumArray(array) { var result = 0 array.forEach(function(element) { result += element; }); return result }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function sumArr(array){\n\n}", "function sumArray(array){\n\tvar total = 0;\n\tarray.forEach(function(element){\n\t\ttotal += element;\n\t\n\t});\n\treturn total;\n}", "function sumArray(array) {\n return array.reduce(function (prev, cur) {\n return prev + cur;\n }, 0);\n ...
[ "0.84384453", "0.82795733", "0.81848747", "0.8175737", "0.8158236", "0.8156284", "0.8149095", "0.8146506", "0.81426555", "0.81393033", "0.8121696", "0.8116467", "0.81116194", "0.81077546", "0.8106488", "0.8089912", "0.80859715", "0.8082965", "0.80771184", "0.80372703", "0.802...
0.8307777
1
return max of function
function max(array) { var currentmax = array[0]; array.forEach(function(element) { if(element > currentmax) { currentmax = element; } }); return currentmax; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "get maximum() {\r\n return function(a, b) {\r\n return this._compareMax(a, b) > 0 ? this.max(a) : this.max(b)\r\n }\r\n }", "max() {}", "function max(arr, fn){\n\tif (fn){\n\t\tarr.forEach(fn());\n\t\treturn Math.max(arr)\n\t}\n\treturn Math.max(arr)\n}", "function max(){\n r...
[ "0.7935401", "0.7897814", "0.78311855", "0.7825351", "0.76183325", "0.75359696", "0.74576825", "0.74543613", "0.74329376", "0.7379171", "0.7370555", "0.7361776", "0.7360886", "0.73498136", "0.73212224", "0.73138547", "0.7305029", "0.72468656", "0.72398037", "0.7237289", "0.72...
0.6899705
71
This function searches for all elements with the class name "vmCartModule" and updates them with the contents of the page "shop.basket_short" after a cart modification event
function updateMiniCarts() { var callbackCart = { success : function(o) { carts = document.getElementsByClassName( 'vmCartModule' ); if( carts ) { for (var i=0; i<carts.length; i++){ carts[i].innerHTML = o.responseText; new Effect.Highlight( carts[i] ); } } }, failure : function( hxr ) { alert( hxr.statusText ) } } option = { method: 'get', onSuccess: callbackCart.success,onFailure: callbackCart.failure } new Ajax.Request('index2.php?only_page=1&page=shop.basket_short&option=com_virtuemart', option); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function updateShoppingCart(){\n\t\"use strict\";\n\n\t\t$j('body').bind('added_to_cart', add_to_cart);\n\t\tfunction add_to_cart(event, parts, hash) {\n\t\t\tvar miniCart = $j('.shopping_cart_header');\n\t\t\tif ( parts['div.widget_shopping_cart_content'] ) {\n\t\t\t\tvar $cartContent = jQuery(parts['div.widget_s...
[ "0.67036283", "0.66117615", "0.637926", "0.63623977", "0.62695074", "0.623118", "0.6191522", "0.61724985", "0.6134941", "0.6080991", "0.6031651", "0.60217434", "0.60215133", "0.60180527", "0.5995665", "0.59633714", "0.5958319", "0.595564", "0.59544957", "0.59362006", "0.59360...
0.66700846
1
This function allows you to present contents of a URL in a really nice stylish dhtml Window It uses the WindowJS, so make sure you have called vmCommonHTML::loadWindowsJS(); before
function fancyPop( url, parameters ) { parameters = parameters || {}; popTitle = parameters.title || ''; popWidth = parameters.width || 700; popHeight = parameters.height || 600; popModal = parameters.modal || false; window_id = new Window('window_id', {className: "mac_os_x", title: popTitle, showEffect: Element.show, hideEffect: Element.hide, width: popWidth, height: popHeight}); window_id.setAjaxContent( url, {evalScripts:true}, true, popModal ); window_id.setCookie('window_size'); window_id.setDestroyOnClose(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function viewHtml() {\n var entry = ProjectManager.getSelectedItem();\n if (entry === undefined) {\n entry = DocumentManager.getCurrentDocument().file;\n }\n var path = entry.fullPath;\n var w = window.open(path);\n w.focus();\n }", "function showDoc(URL, t...
[ "0.6539493", "0.6449007", "0.6387347", "0.6310311", "0.623285", "0.6222279", "0.6216834", "0.61398554", "0.61398554", "0.59924084", "0.59874666", "0.5983112", "0.5970419", "0.5925913", "0.5924262", "0.5905112", "0.586926", "0.5860808", "0.58484364", "0.58288026", "0.5806386",...
0.0
-1
When the user clicks on the button, scroll to the top of the document
function topFunction() { document.body.scrollTop = 0; // For Safari document.documentElement.scrollTop = 0; // For Chrome, Firefox, IE and Opera }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function scrollToTop () {\n //getting the currentPosition position of the button\n let currentPosition = document.documentElement.scrollTop || document.body.scrollTop;\n //if the position is greater than 0 then we'll scroll to the top of the page\n if (currentPosition > 0) {\n ...
[ "0.8500354", "0.8494407", "0.823897", "0.8031184", "0.80240875", "0.8013301", "0.79951185", "0.7957891", "0.7950808", "0.7946424", "0.7924129", "0.79108864", "0.79088783", "0.78972363", "0.7891453", "0.7872319", "0.7842605", "0.7819863", "0.78190035", "0.78024554", "0.7774074...
0.0
-1
START anime js code
componentDidMount() { var human = false; var canvasEl = document.querySelector('canvas'); var ctx = this.refs.canvas.getContext('2d'); var cH; var cW; var bgColor = "#000"; var animations = []; var circles = []; var colorPicker = (function() { var index = 0; function next() { index = index++ < colors.length - 1 ? index : 0; return colors[index]; } function current() { return colors[index] } return { next: next, current: current } })(); function removeAnimation(animation) { var index = animations.indexOf(animation); if (index > -1) animations.splice(index, 1); } function calcPageFillRadius(x, y) { var l = Math.max(x - 0, cW - x); var h = Math.max(y - 0, cH - y); return Math.sqrt(Math.pow(l, 2) + Math.pow(h, 2)); } function addClickListeners() { document.addEventListener("mousedown", handleEvent); }; // Note - I changed from using pageX and pageY to using x and y function handleEvent(e) { // If click outside of Fireworks element if (!e.isTriggered && !e.target.className.toString().includes('CanvasOverlay')) { return; } // If click inside one of the links if (!e.isTriggered && e.target.className.toString().includes('CanvasOverlay__Link')) { return; } if (!e.isTriggered) { human = true; } if (e.touches) { e.preventDefault(); e = e.touches[0]; } var currentColor = colorPicker.current(); var nextColor = colorPicker.next(); var targetR = calcPageFillRadius(e.x, e.y); var rippleSize = Math.min(200, (cW * .4)); var minCoverDuration = 750; var pageFill = new Circle({ x: e.x, y: e.y, r: 0, fill: nextColor }); var fillAnimation = anime({ targets: pageFill, r: targetR, duration: Math.max(targetR / 2 , minCoverDuration ), easing: "easeOutQuart", complete: function(){ bgColor = pageFill.fill; removeAnimation(fillAnimation); } }); var ripple = new Circle({ x: e.x, y: e.y, r: 0, fill: currentColor, stroke: { width: 3, color: currentColor }, opacity: 1 }); var rippleAnimation = anime({ targets: ripple, r: rippleSize, opacity: 0, easing: "easeOutExpo", duration: 900, complete: removeAnimation }); var particles = []; for (var i=0; i<32; i++) { var particle = new Circle({ x: e.x, y: e.y, fill: currentColor, r: anime.random(24, 48) }) particles.push(particle); } var particlesAnimation = anime({ targets: particles, x: function(particle){ return particle.x + anime.random(rippleSize, -rippleSize); }, y: function(particle){ return particle.y + anime.random(rippleSize * 1.15, -rippleSize * 1.15); }, r: 0, easing: "easeOutExpo", duration: anime.random(1000,1300), complete: removeAnimation }); animations.push(fillAnimation, rippleAnimation, particlesAnimation); } function extend(a, b){ for(var key in b) { if(b.hasOwnProperty(key)) { a[key] = b[key]; } } return a; } var Circle = function(opts) { extend(this, opts); } Circle.prototype.draw = function() { ctx.globalAlpha = this.opacity || 1; ctx.beginPath(); ctx.arc(this.x, this.y, this.r, 0, 2 * Math.PI, false); if (this.stroke) { ctx.strokeStyle = this.stroke.color; ctx.lineWidth = this.stroke.width; ctx.stroke(); } if (this.fill) { ctx.fillStyle = this.fill; ctx.fill(); } ctx.closePath(); ctx.globalAlpha = 1; } var animate = anime({ duration: Infinity, update: function() { ctx.fillStyle = bgColor; ctx.fillRect(0, 0, cW, cH); animations.forEach(function(anim) { anim.animatables.forEach(function(animatable) { animatable.target.draw(); }); }); } }); var resizeCanvas = function() { if (!(window.innerWidth < 500 && window.scrollY >= window.innerHeight)) { cW = window.innerWidth; cH = window.innerHeight; canvasEl.width = cW; canvasEl.height = cH; } }; (function init() { resizeCanvas(); window.addEventListener("resize", resizeCanvas); addClickListeners(); triggerFakeClicks(); })(); function sleep(ms) { return new Promise(resolve => setTimeout(resolve, ms)); } async function triggerFakeClicks() { if (human) return; await sleep(3000); fakeClick(anime.random(cW * .2, cW * .8), anime.random(cH * .2, cH * .8)); triggerFakeClicks(); } function fakeClick(x, y) { if (human) return; var fakeClick = new Event("mousedown"); fakeClick.x = x; fakeClick.y = y; fakeClick.isTriggered = true; document.dispatchEvent(fakeClick); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "start(){\n timeline.play();\n }", "start() {// [3]\n }", "function startOneCommandArtyom(){\n artyom.fatality();// use this to stop any of\n\n setTimeout(function(){// if you use artyom.fatality , wait 250 ms to initialize again.\n artyom.initialize({\n lang:\"en-...
[ "0.63775885", "0.6372635", "0.6358977", "0.63144594", "0.6310187", "0.62911373", "0.6229094", "0.62011254", "0.6196265", "0.6195684", "0.61652154", "0.61515146", "0.61210394", "0.6115121", "0.61129504", "0.6107099", "0.6107099", "0.6107099", "0.6107099", "0.6107099", "0.61070...
0.0
-1
Note I changed from using pageX and pageY to using x and y
function handleEvent(e) { // If click outside of Fireworks element if (!e.isTriggered && !e.target.className.toString().includes('CanvasOverlay')) { return; } // If click inside one of the links if (!e.isTriggered && e.target.className.toString().includes('CanvasOverlay__Link')) { return; } if (!e.isTriggered) { human = true; } if (e.touches) { e.preventDefault(); e = e.touches[0]; } var currentColor = colorPicker.current(); var nextColor = colorPicker.next(); var targetR = calcPageFillRadius(e.x, e.y); var rippleSize = Math.min(200, (cW * .4)); var minCoverDuration = 750; var pageFill = new Circle({ x: e.x, y: e.y, r: 0, fill: nextColor }); var fillAnimation = anime({ targets: pageFill, r: targetR, duration: Math.max(targetR / 2 , minCoverDuration ), easing: "easeOutQuart", complete: function(){ bgColor = pageFill.fill; removeAnimation(fillAnimation); } }); var ripple = new Circle({ x: e.x, y: e.y, r: 0, fill: currentColor, stroke: { width: 3, color: currentColor }, opacity: 1 }); var rippleAnimation = anime({ targets: ripple, r: rippleSize, opacity: 0, easing: "easeOutExpo", duration: 900, complete: removeAnimation }); var particles = []; for (var i=0; i<32; i++) { var particle = new Circle({ x: e.x, y: e.y, fill: currentColor, r: anime.random(24, 48) }) particles.push(particle); } var particlesAnimation = anime({ targets: particles, x: function(particle){ return particle.x + anime.random(rippleSize, -rippleSize); }, y: function(particle){ return particle.y + anime.random(rippleSize * 1.15, -rippleSize * 1.15); }, r: 0, easing: "easeOutExpo", duration: anime.random(1000,1300), complete: removeAnimation }); animations.push(fillAnimation, rippleAnimation, particlesAnimation); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "pageLocation() {\n return new HPoint(this.pageX(), this.pageY());\n }", "get_tile_pos(pageX, pageY){\n var canvas_left = this.canvas.offsetLeft;\n var canvas_top = this.canvas.offsetTop;\n var x = pageX - canvas_left,\n y = pageY - canvas_top\n \n var grid_x = Ma...
[ "0.72004586", "0.6654255", "0.65678394", "0.65448093", "0.65252995", "0.65252995", "0.65209377", "0.65112746", "0.65080786", "0.64741766", "0.6453291", "0.6453291", "0.6453291", "0.6453291", "0.6453291", "0.6393584", "0.63574725", "0.63095635", "0.63043725", "0.6272771", "0.6...
0.0
-1
END anime js code
render() { return ( <div className={classes.Fireworks}> <canvas ref="canvas" className={classes.Canvas}/> <CanvasOverlay/> </div> ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "mateEnd() {}", "onLineEnd() { }", "endTease() {\r\n this.endScript();\r\n this.cycler.end();\r\n }", "function end(){\n return end;\n}", "end() {\n this.log('end');\n }", "function END() {}", "endScript() {\r\n this._endScript = true;\r\n }", "end(event) {\n\n ...
[ "0.6792718", "0.6503079", "0.63731515", "0.621669", "0.617648", "0.6162653", "0.6133915", "0.6123566", "0.6107871", "0.6093632", "0.60659564", "0.60659564", "0.60608315", "0.6023497", "0.6006814", "0.59961414", "0.59562796", "0.59499913", "0.5947837", "0.5914146", "0.59090585...
0.0
-1
mouse scroll end event handlers
function fixEventPost(e){ return JSON.parse(JSON.stringify(e));//fix bug }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function end(event) {\r\n\t\tvar el = event.target\r\n\t\tel.blur();\r\n\t\tself.endScroll();\r\n\t\tevent.stopPropagation();\r\n\t}", "function touchEnd(e) {\n\t\t\t\t\tif (!scrolling) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tscrolling = false;\n\t\t\t\t\t\n\t\t\t\t\tif (moved) {\n\t\t\t\t\t\t...
[ "0.7675147", "0.71554714", "0.693285", "0.68298364", "0.674189", "0.6640283", "0.6575097", "0.64494133", "0.6430673", "0.6428979", "0.64002585", "0.6393841", "0.635892", "0.634723", "0.63292", "0.6320082", "0.6314975", "0.63034356", "0.63034356", "0.63034356", "0.63034356", ...
0.0
-1
Renders an OrderActivity Comment
function ActivityComment({ activity }) { const [showReplyCreate, setShowReplyCreate] = useState(false); const currentUser = useCurrentUser(); const firstName = activity?.user?.firstName || ''; const lastName = activity?.user?.lastName || ''; const finalName = currentUser.id === activity?.user?.id ? 'You' : `${firstName} ${lastName}`; return ( <Activity activity={activity} setShowReplyCreate={setShowReplyCreate} leftCol={ <div style={{ marginLeft: '2px' }}> <IconUserInitials text={currentUser.initials} size={32} /> </div> } middleCol={ <Fragment> <MessageText name={finalName} date={formattedDate(activity.createdAt)} message={activity.message} activity={activity} showReplyCreate={showReplyCreate} setShowReplyCreate={setShowReplyCreate} showReplyButton={true} /> {activity.answers?.map(answer => ( <MessageAnswer key={answer.id} answer={answer} showReplyCreate={showReplyCreate} setShowReplyCreate={setShowReplyCreate} /> ))} </Fragment> } > {showReplyCreate && ( <Box m="25px -26px 0px -26px" borderTop="1px solid rgba(0, 0, 0, 0.1)" p="15px 25px 0px 25px" > <Box> <MessageCreate replyToMessageId={activity.id} onCancel={() => setShowReplyCreate(false)} /> </Box> </Box> )} </Activity> ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "render(commentObject) {\n $(`#comments-${commentObject.image.id}`).append(commentObject.commentEl());\n }", "function renderSingleComment(comment) {\n return `\n <div class=\"comment\" id=\"comment-${comment.id}\">\n <h1>${comment.name}</h1>\n <p>${comment.content}</p>\n <button class=\"de...
[ "0.6519076", "0.63870585", "0.63691646", "0.62450874", "0.6216095", "0.62117994", "0.62007374", "0.6161732", "0.61486185", "0.61458766", "0.614516", "0.6093915", "0.60930455", "0.6090593", "0.6090593", "0.60782754", "0.60704195", "0.60704195", "0.6067377", "0.60623115", "0.60...
0.6041597
23
propagates the color property to the various elements that make up the applause button
_updateRootColor() { if (!this._styleRootElement) { return; } const rootColor = this.getAttribute("color") || "green"; const style = this._styleRootElement.style; style.fill = rootColor; style.stroke = rootColor; style.color = rootColor; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function buttonColorIn(ev) {\n ev.target.style.backgroundColor = \"orange\";\n}", "function updateButtonColors(button, parent) {\n parent.selectAll(\"rect\")\n .attr(\"fill\",defaultColor)\n\n button.select(\"rect\")\n .attr(\"fill\",pressedColor)\n}", "function buttonColorOut(ev) {\n ev.target.s...
[ "0.69421077", "0.6834445", "0.67679036", "0.6710815", "0.6687246", "0.6621616", "0.6598744", "0.6581982", "0.65760946", "0.65628594", "0.6558353", "0.6507397", "0.6427027", "0.6358498", "0.63014704", "0.6299273", "0.62476647", "0.62444514", "0.62444514", "0.62422526", "0.6237...
0.5905074
58
keep routes in my switch staetment
function App(){ const [posts, setPosts] = useState([]); const fetchPosts = ()=>{ const res = getPosts(); res.then((posts) => { console.log(posts) setPosts(posts.reverse()) }); } useEffect(()=>{fetchPosts()}, []) return( <> <Router> <Navbar/> <Switch> <Route path='/' exact component={Home}/> <Route path='/platforms' component={Platforms} /> <Route path='/niches' component={Niches} /> <Route path='/signup' component={SignUp} /> <Route path='/login' component={Login} /> <Route path='/dashboard' render={(props)=><Dashboard {...props} posts={posts} /> } /> <Route path='/post' render={(props) => <Post {...props} posts={posts} fetchPosts={fetchPosts}/>} /> {/* <Route path='/logout' component={Logout} /> */} </Switch> </Router> </> ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function dinamicRoutes() {\n var otherRoutes = routes.filter(function (item) { return item.path.includes(':'); });\n var getRouteCurrent = location.pathname.split('/');\n var request = {};\n otherRoutes.map(function (route) { return request = getRouteCurrent[1] == (route.path.split('/'))[1] ? { 'status...
[ "0.6569607", "0.6569607", "0.6446169", "0.6411483", "0.6370922", "0.63314754", "0.63187236", "0.63117963", "0.6267992", "0.6239418", "0.6227154", "0.6222221", "0.6187545", "0.61768776", "0.6142326", "0.61108357", "0.6074876", "0.6062031", "0.6056193", "0.60258186", "0.5970683...
0.0
-1
Generic function for capturing the cartoon show title from the dataattribute
function alertCartoonShowName() { // var cartoonName = $(this).attr("data-name"); // alert(cartoonName); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "title() {\n if (arguments.length) {\n title = arguments[0];\n return column;\n }\n return purifyHtml(title || name);\n }", "getTitle() {}", "function title(titleinfo) /* (titleinfo : titleinfo) -> string */ {\n return titleinfo.title;\n}"...
[ "0.6541021", "0.65350163", "0.6532111", "0.650518", "0.64376587", "0.64158726", "0.64043415", "0.6389701", "0.6360439", "0.633933", "0.6333066", "0.6306018", "0.62834406", "0.624153", "0.62387955", "0.6229952", "0.62261647", "0.62261647", "0.62184805", "0.621337", "0.61842954...
0.6349183
9
Function for displaying cartoon data
function renderButtons() { // Deleting the cartoons prior to adding new cartoon shows // (this is necessary otherwise we will have repeat buttons) $("#buttons-view").empty(); // Looping through the array of cartoon titles for (var i = 0; i < topics.length; i++) { // Then dynamicaly generating buttons for each show in the array // This code $("<button>") is all jQuery needs to create the start and end tag. (<button></button>) var a = $("<button>"); // Adding a class of cartoon to our button a.addClass("cartoon"); // Adding a data-attribute a.attr("data-name", topics[i]); // Providing the initial button text a.text(topics[i]); // Adding the button to the HTML $("#buttons-view").append(a); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function printCualities(array) {\n var txtPC=\"\";\n for (let i = 0; i < array.length ; i++) {\n txtPC+=array[i].brand+\" \"+array[i].type+\" \"+array[i].content+\" \"+array[i].price+\"<br>\";\n//Se guarda en txtPC como cadena de carácteres\n \n }\n ...
[ "0.6681223", "0.65480417", "0.64522284", "0.62826014", "0.62233347", "0.61627793", "0.6110506", "0.6101912", "0.6098493", "0.60257655", "0.60208344", "0.59999925", "0.599729", "0.5981867", "0.596556", "0.59615165", "0.593546", "0.5897117", "0.5889219", "0.5885048", "0.5860859...
0.0
-1
game logic event handlers
onkeyup(event) { if(event.keyCode === KEYS.S || event.keyCode === KEYS.DOWN) (this.fps = 1) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function registerPlayerGameEvents(){\r\n\t\t\r\n\t\tev.sub(\"game.start\",function(){\r\n\t\t\t\r\n\t\t\thud.drawGameStatistics(score,level,lifes);\r\n\t\t});\r\n\t\t\r\n\t\tev.sub(\"game.levelObjectsCreated\",function(){\r\n\r\n\t\t\t//reset paddle, ball and camera when new scene is created\r\n\t\t\tgame.resetPad...
[ "0.721058", "0.70730937", "0.6999664", "0.69328916", "0.6911907", "0.68959785", "0.68958724", "0.6864211", "0.68057686", "0.67481184", "0.6733339", "0.6731308", "0.6725124", "0.67150885", "0.66999406", "0.6678595", "0.66702276", "0.6654117", "0.6635092", "0.6635092", "0.66315...
0.0
-1
will recive the state from store
function mapStateToProps(state){ return{ mydata:state.films } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "getState() {\n\n }", "function getState () {\n return state\n }", "function getState () {\n return state\n }", "onStoreChange() {\n this.setState(this._getStateFromStore);\n }", "getState() {\n return state;\n }", "getState () {\n return _data;\n }", "function getState() {\n ...
[ "0.70418525", "0.69434786", "0.69434786", "0.6832658", "0.6763439", "0.67323285", "0.67132777", "0.6611618", "0.6611618", "0.6611618", "0.66025716", "0.65743786", "0.6538194", "0.65254617", "0.6512142", "0.64911085", "0.64895767", "0.6489281", "0.6485223", "0.6485223", "0.648...
0.0
-1
Calls an arguments parser that conforms to the signature: function([argv, opts]) The return value is pushed on to the stream. If the stream chunk is an array it is used as the input arguments for the parser otherwise process.argv is used.
function Argv(opts) { this.opts = opts; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function argv(/* chunk */) {\n return this.args.slice(0);\n}", "function getArguments() {\n return process.argv.slice(2);\n }", "function parseArguments(parser) {\n\t return peek(parser, _lexer.TokenKind.PAREN_L) ? many(parser, _lexer.TokenKind.PAREN_L, parseArgument, _lexer.TokenKind.PAREN_R) : [];\n\t}...
[ "0.6785014", "0.5961546", "0.5821191", "0.57765454", "0.5739295", "0.5715276", "0.5667878", "0.5601603", "0.5589171", "0.556117", "0.54874104", "0.5392359", "0.53736544", "0.5370027", "0.5359784", "0.5339419", "0.533624", "0.5331652", "0.5331652", "0.5331652", "0.5331652", ...
0.0
-1
make this chronological based on the the stage of creating game
componentDidMount() { this.props.socket.on("OnPlayerInit", e => { console.log(e.itter); this.setState({ player: e.player, stage: "join_room", roomlist: e.itter, navMessage : "Open Rooms" , }); }); this.props.socket.on("NewRoomAdded", (e)=>{ console.log(e); this.setState({ roomlist: e.itter, }); }); this.props.socket.on("OnRoomInit", e => { this.setState({ stage: "waiting_room", player: e.player, navMessage : "Waiting Room" , }); }); this.props.socket.on("OnGameInit", d => { this.setState({ player: d.playerState, stage: "game_room", navMessage : "In Play" , }); console.log(d.playerState); }); this.props.socket.on("onShipCmd", d => { this.setState({ shipMsg: d.msg }); }); /** * Litsener to update the update the list of user in the waiting room */ this.props.socket.on("prePlayerList",(d)=>{ console.log(d); this.setState({ waitinglist : d.list, }) }) /*this listener is essentially hidden, it just lets the client know that its waiting on the correct move to be done. */ this.props.socket.on("onPersonalCMD", d => { this.setState({ cmdHolder: d }); this.cmdHolder = d; console.log(d); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "prepAndStartNewGame() {\n this.resetPlayers(Player.TOWN);\n this.assignRoles(this.options.numMafia, this.options.numCops, this.options.numDoctors);\n this.updateRoleCounts();\n this.gameState = MAFIA_TIME;\n }", "function newGame() {\n //Reseta a score\n score = 0;\n ...
[ "0.6480369", "0.63440794", "0.6231629", "0.623005", "0.6092987", "0.60903496", "0.606563", "0.60410094", "0.6015772", "0.5999265", "0.59909576", "0.59827596", "0.59814304", "0.5967276", "0.59465367", "0.5942865", "0.5941537", "0.5926342", "0.5920328", "0.5910092", "0.587167",...
0.0
-1
this function will decide if a button is correct and worth sending
onClickCMDValidator(e, id) { console.log(this.state.cmdHolder); if (this.state.cmdHolder == null) return; if (id === this.state.cmdHolder.id) { this.props.socket.emit("Command", { id: this.id, name: this.name }); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function buttonSaveCheck() {\n if (game.gameMessageBtn == 0) {\n gameMessageBtnDisabled();\n console.log(game.gameMessageBtn+\" gamemsg btn dis\");\n } else {\n gameMessageBtnEnabled();\n console.log(game.gameMessageBtn+\" gamemsg btn enb\");\n }\n if...
[ "0.69402766", "0.6873408", "0.67779243", "0.67201555", "0.670045", "0.66827816", "0.6679502", "0.66723627", "0.6648146", "0.6581923", "0.65678936", "0.65324616", "0.65052253", "0.64652526", "0.64212614", "0.6417484", "0.6392546", "0.6380143", "0.63670987", "0.63528204", "0.63...
0.0
-1
FUNCTIONS reset game defaults
function reset() { resetButton.innerHTML = "RESET"; winner.classList.add("hide"); numShotsOne.innerHTML = 0; numShotsTwo.innerHTML = 0; numGoalsOne.innerHTML = 0; numGoalsTwo.innerHTML = 0; resetSpan.classList.remove("hide"); leftDiv.classList.add("possessionIndicator"); rightDiv.classList.remove("possessionIndicator"); toggleTeamDivs(); running = true; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function resetGameVars() {\n diffSetting = gameDiffSettings[diffSelector.value - 1]\n gameClock = null\n isGameOver = true\n motherShipInPlay = false\n }", "function restoreDefaults() {\n console.log('[PROTOCOL restoreDefaults()]', arguments);\n var newGame = angular.copy(club.defaultG...
[ "0.7791668", "0.7627031", "0.7563275", "0.7509454", "0.746985", "0.7443275", "0.74223095", "0.7399305", "0.7386558", "0.7356437", "0.7351094", "0.73429024", "0.73272145", "0.7322458", "0.7322458", "0.73154503", "0.72941136", "0.72837615", "0.7253863", "0.7241528", "0.7238907"...
0.0
-1
stops running the game and shows the winning team
function gameOver() { running = false; gameTitle.classList.add("hide"); winner.classList.remove("hide"); resetSpan.classList.add("hide"); resetButton.innerHTML = "PLAY AGAIN"; toggleTeamDivs(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function endGame () {\n\tif(player1.hasWon) {\n\t\t$('#board').hide()\n\t\t$('.player1-winner').show();\n\n\t} else if(player2.hasWon) {\n\t\t$('#board').hide()\n\t\t$('.player2-winner').show();\n\t}\n}", "gameOver(winning) {\n document.getElementById(\"main-game\").removeEventListener('click', MODIFIER.tur...
[ "0.71241033", "0.70795846", "0.6988509", "0.69559026", "0.69268775", "0.68851274", "0.679567", "0.67915666", "0.677819", "0.67658734", "0.676548", "0.6699394", "0.668816", "0.66657317", "0.66604406", "0.6621561", "0.66212565", "0.6619454", "0.6598976", "0.6597058", "0.6596544...
0.6955066
4
toggles the possession indicator class
function changePossession() { leftDiv.classList.toggle("possessionIndicator"); rightDiv.classList.toggle("possessionIndicator"); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function showHideRanking () {\n if (!!document.querySelector('.opened')) {\n document.getElementById('ranking-container').classList.remove('opened');\n document.getElementById('ranking-container').classList.add('closed');\n document.querySelector('.arrow-up').classList.remove('arrow-open');...
[ "0.63407874", "0.62081236", "0.59952676", "0.5958171", "0.58692276", "0.5857468", "0.5845423", "0.58351785", "0.5772964", "0.5761842", "0.57190996", "0.5715361", "0.56927", "0.56871164", "0.56395596", "0.56392854", "0.5637211", "0.56359226", "0.5619984", "0.5613556", "0.56118...
0.7589035
0
Create a play functions which will play either "swish" or "brick" if the team scores or not
function playSwish() { swishSound.play(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function playRock () {\n play(\"rock\");\n}", "play(playerOne, playerTwo) {\n switch (playerOne.move.sign + playerTwo.move.sign) {\n case \"rockscissors\":\n case \"scissorspaper\":\n case \"paperrock\":\n playerOne.win();\n gametext.innerHTML = `${playerOne.name} wins! Next roun...
[ "0.69231856", "0.6871254", "0.68141156", "0.6735613", "0.6732343", "0.67130077", "0.66615677", "0.661856", "0.6617396", "0.6602944", "0.660016", "0.6595117", "0.6572305", "0.6560655", "0.6545195", "0.6533401", "0.65325403", "0.6508934", "0.64774835", "0.6475341", "0.6465327",...
0.0
-1
Function will create a random number, which will be compared to the variable field goal rate
function generateRandomNumber(max) { let number = Math.floor(Math.random() * max) + 1; return number; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function generateNum() {\n goalNumber = Math.floor((Math.random() * 120) + 19);\n }", "function randomNumberGoal () {\n\n numberGoal = Math.floor(Math.random() * 102) +19;\n\n }", "function gen_random(){\r\n\treturn 0.3\r\n}", "function random() {\n\treturn ((Math.random()*99)+1).toFixed...
[ "0.7934637", "0.7716557", "0.7556225", "0.7347875", "0.73236936", "0.73002297", "0.72908044", "0.72757626", "0.7230004", "0.7200641", "0.71909934", "0.7189962", "0.71887195", "0.71730006", "0.7168871", "0.7138831", "0.7117647", "0.70658886", "0.7059387", "0.70523167", "0.7043...
0.0
-1
Switches possession of the "ball"
function toggleTeamDivs() { leftDiv.classList.toggle("hide"); rightDiv.classList.toggle("hide"); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "ballPathMovement() {\n\t\tthis.ball.setAlpha(1);\n\t\tif(this.ball.y > this.pitchPoint) {\n\t\t\tthis.ball.setScale(this.ball.scale + 0.01);\n\t\t\tthis.ball.y += 8;\n\t\t\tthis.ball.x -=6;\n\t\t\tthis.ball.setPosition(this.ball.x,this.ball.y);\n\t\t} else {\n\t\t\tthis.ball.y += 10;\n\t\t\tthis.ball.x -=1;\n\t\t\...
[ "0.69582343", "0.6869972", "0.68500304", "0.68025225", "0.67826194", "0.6760476", "0.6752294", "0.67221016", "0.67143136", "0.6710543", "0.6687446", "0.66577256", "0.6657561", "0.66461545", "0.6630799", "0.6618495", "0.65799683", "0.6576206", "0.6572174", "0.65304226", "0.652...
0.0
-1
Write an algorithm which searches through a 2D array, and whenever it finds a 0 should set the entire row and column to 0. Input: [[1,0,1,1,0], [0,1,1,1,0], [1,1,1,1,1], [1,0,1,1,1], [1,1,1,1,1]]; Output: [[0,0,0,0,0], [0,0,0,0,0], [0,0,1,1,0], [0,0,0,0,0], [0,0,1,1,0]];
function twoD(arr) { const zeroArr = [...arr] const col = [] const row = [] for (let i = 0; i < arr.length; i++) { if (arr[i].includes(0)) { for (let j = 0; j < arr[i].length; j++) { if (zeroArr[i][j] === 0 && arr[i].includes(0)) { col[j] = true row[i] = true } } } } for (let i = 0; i < zeroArr.length; i++) { for (let j = 0; j < zeroArr.length; j++) { if (row[i] || col[j]) { zeroArr[i][j] = 0 } } } console.log(zeroArr) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function zeroRowsAndCols(arr) {\r\n\tif(arr.length == 0) return arr;\r\n\r\n\t//array to hold coordinates of the zeros found \r\n\tvar coordinates = [];\r\n\r\n\t//loop through the rows \r\n\tfor(var y = 0; y < arr.length; y++) {\r\n\t\t//loop through the columns \r\n\t\tfor(var x = 0; x < arr[y].length; x++) {\r\...
[ "0.79185754", "0.776488", "0.7545264", "0.74999195", "0.7497253", "0.74829", "0.74065346", "0.7399838", "0.73928577", "0.7243474", "0.7208734", "0.71588004", "0.7022825", "0.7017211", "0.7010906", "0.6828268", "0.6702739", "0.6697767", "0.6675574", "0.6662391", "0.6640263", ...
0.7912751
1
Carregar a tabela com os dados das categorias
function loadTable() { const url = '/categoria/data'; let req = new XMLHttpRequest(); req.open('GET', url, true); req.onload = function () { let data = JSON.parse(req.responseText); if (req.readyState == 4 && req.status == "200") { createTableRows(data); } else { console.error('Falha ao carregar dados!'); } } req.send(null); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function categoryTable() { }", "function setData() {\t\n\t\n\tvar db = Ti.Database.install('../products.sqlite','products');\n\n\tvar rows = db.execute('SELECT DISTINCT category FROM products');\n\n\t// create the array\n\tvar dataArray = [];\n\t\t\t\n\twhile (rows.isValidRow())\n\t{\n\t dataArray.push({title...
[ "0.7032024", "0.61849326", "0.61097586", "0.5960809", "0.5885535", "0.58406", "0.583311", "0.5800815", "0.57645154", "0.5759791", "0.57151175", "0.5680299", "0.55812", "0.55771613", "0.5552941", "0.5550499", "0.5525965", "0.5514976", "0.55090094", "0.5495049", "0.5492014", ...
0.5805555
7
handles initialization of app upon login...
_changeLoginToApp() { this.setState({ login: false, app: true, }); // versionCheck calls -> syncRequest -> syncRequest calls syncStatus + emits data to listener here in componentDidMount }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function initApp() {\n // Listening for auth state changes.\n firebase.auth().onAuthStateChanged(function(user) {});\n}", "function initApp() {\n // Listening for auth state changes.\n // [START authstatelistener]\n firebase.auth().onAuthStateChanged(function(user) {\n showHomePage();\n if (user) ...
[ "0.7413315", "0.73419005", "0.7302301", "0.72809494", "0.71405154", "0.70777977", "0.70669764", "0.7051788", "0.7045886", "0.703902", "0.703437", "0.7017912", "0.6991487", "0.6988325", "0.69461995", "0.6932656", "0.69177574", "0.69039106", "0.68899727", "0.68772626", "0.68498...
0.0
-1
Submits email to Mailchimp using Mailchimp plugin.
function handleSubmit(e) { e.preventDefault() addToMailchimp(emailState) e.target.reset() }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function submitMailChimp(data) {\r\n\t reset(data);\r\n\r\n\t var form = data.form;\r\n\t var payload = {};\r\n\r\n\t // Skip Ajax submission if http/s mismatch, fallback to POST instead\r\n\t if (/^https/.test(loc.href) && !/^https/.test(data.action)) {\r\n\t form.attr('method', 'post');\r\n\t...
[ "0.7729354", "0.76197875", "0.7598546", "0.7444702", "0.65136397", "0.6402637", "0.6345875", "0.6299135", "0.62609637", "0.6134049", "0.61149216", "0.61000127", "0.6023223", "0.5808217", "0.57869583", "0.5714253", "0.5699441", "0.5693219", "0.565462", "0.56519896", "0.5648899...
0.53828907
41
Takes change event, and sets it to useState.
function handleChange(event) { setEmailState(event.target.value) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function handleChange() {\n onChange(currentState);\n }", "function handleChange(event, newValue) {\n setValue(newValue);\n }", "function handleChange(event) {\n const value = event.target.value;\n setState({\n ...state,\n [event.target.name]: value\n });\n }", "fu...
[ "0.6883824", "0.66574395", "0.6506019", "0.6469281", "0.6404075", "0.6390731", "0.6369126", "0.63619083", "0.6348322", "0.63371086", "0.6323564", "0.62997067", "0.6267987", "0.62458515", "0.6228428", "0.622762", "0.6180706", "0.61701316", "0.61389023", "0.61268926", "0.612266...
0.0
-1
Get the status of the web server
status() { return __awaiter(this, void 0, void 0, function* () { return { status: 'OK', }; }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getStatusServer() {\r\n _doGet('/status');\r\n }", "function get_server_status() {\n var target = 'cgi_request.php';\n var data = {\n action: 'is_online'\n };\n var callback = parse_server_status;\n send_ajax_request(target, data, callback, true);\n}", "function getStatus() {\n\tapi(...
[ "0.8517325", "0.7675565", "0.7190328", "0.70824456", "0.70177543", "0.6988344", "0.68751395", "0.67996144", "0.67958903", "0.677003", "0.67192703", "0.6668177", "0.6651617", "0.65528524", "0.65231115", "0.64894253", "0.6471328", "0.6460829", "0.64595324", "0.64273244", "0.641...
0.6029554
74
Generate a user avatar thumbnail
GenerateThumbnail(user) { return __awaiter(this, void 0, void 0, function* () { console.log('gen thumb'); let cook; let cookieOk = false; while (!cookieOk) { console.log('while true'); cook = cookie.get(); try { yield client.get('https://users.roblox.com/v1/users/authenticated', { headers: { 'cookie': '.ROBLOSECURITY=' + cook.cookie, } }); cookieOk = true; } catch (err) { console.log('[info] bad cookie'); } } console.log('[info] cookie ok. rendering'); try { let assets = user.assets.map(val => { return val.id; }); let colors = user.bodyColors; let conf = { headers: { 'cookie': '.ROBLOSECURITY=' + cook.cookie, } }; // set to r6 yield client.post('https://avatar.roblox.com/v1/avatar/set-player-avatar-type', { playerAvatarType: 'R6' }, conf); // update colors yield client.post('https://avatar.roblox.com/v1/avatar/set-body-colors', colors, conf); // wear items let wear = { data: { final: false } }; while (!wear.data.final) { wear = yield client.get('https://avatar.roblox.com/v1/try-on/2d?assetIds=' + encodeURIComponent(assets.join(',')) + '&width=420&height=420&format=png&addAccoutrements=false', conf); if (!wear.data.final) { console.log('[info] loading thumb...'); yield sleep(500); } } console.log('wear results', wear.data); return wear.data.url; } catch (e) { console.error(e); cook.done(); throw e; } }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function renderAvatar(user) {\n\tvar img = document.createElement('img')\n\timg.className = \"avatar\"\n\timg.src = user.avatarURL\n\timg.alt = \"\"\n\treturn img\n}", "function AvatarURL( fn )\n{\n return 'https://steamcdn-a.akamaihd.net/steamcommunity/public/images/avatars/' + fn.substring( 0, 2 ) + '/' + f...
[ "0.7406368", "0.669521", "0.6665964", "0.66539186", "0.66479784", "0.66235197", "0.65994495", "0.659487", "0.6493422", "0.6474211", "0.62796855", "0.62284356", "0.6220941", "0.6194841", "0.6145178", "0.61239505", "0.61203814", "0.61081856", "0.6095656", "0.6087183", "0.608431...
0.5953946
28
visually update board based on board state
function updateBoard() { if (playing) { //update values for (var r = 0; r < boardSize; r++) { for (var t = 0; t < boardSize; t++) { var key = tileKey(t, r); var tile = document.querySelector("#" + key); board[key] != null ? tile.innerHTML = board[key] : tile.innerHTML = ""; tile.className = "tile"; tile.classList.add("tile-" + board[key]); } } //update score scoreSpan.innerHTML = score; //check if game is over gameOver(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "updateBoard() {\r\n for (let tile in this.gameState.state) {\r\n if (this.gameState.state[tile] !== 0) {\r\n $(\"#\"+tile).html((this.gameState.state[tile] === 1) ? this.playerSymbols[0] : this.playerSymbols[1]);\r\n } else {\r\n $(\"#\"+tile).html(\"\");\...
[ "0.7683064", "0.76329094", "0.73351574", "0.7306328", "0.7279114", "0.71831036", "0.70624936", "0.70597583", "0.7054293", "0.7040854", "0.6987622", "0.6970598", "0.6961721", "0.693184", "0.6918077", "0.6914939", "0.691238", "0.69088876", "0.68995625", "0.6886931", "0.68528414...
0.6612579
32
add new tile at random location
function addNewTile() { var empties = availableCells(); var value = Math.random() < TWO_CHANCE ? 2 : 4; var newKey = empties[Math.floor(Math.random() * empties.length)]; board[newKey] = value; //save game state localStorage.setItem("board", JSON.stringify(board)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "placeRandomTile(tile) {\n let pos = this.floor.get(randInt(this.floor.length));\n this.tiles[pos.y][pos.x] = tile;\n this.removeRadius(pos.x, pos.y, 1);\n this.placeStatue(pos.x, pos.y);\n }", "addRandomTile() {\n // adds a random tile in an empty spot\n if (!this.gameState.board.inclu...
[ "0.79047316", "0.77845746", "0.7565906", "0.73947644", "0.73252887", "0.7306482", "0.7218508", "0.71204746", "0.69947445", "0.6980951", "0.69595253", "0.6866999", "0.6819915", "0.68080866", "0.6767877", "0.6731082", "0.6715074", "0.67030185", "0.67030185", "0.6677936", "0.665...
0.73171157
5
get all empty cells
function availableCells() { var cells = []; for (var r = 0; r < boardSize; r++) { for (var t = 0; t < boardSize; t++) { var key = tileKey(t, r); if (board[key] == null) cells.push(key); } } return cells; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getAllEmptyCells() {\n const cells = [];\n\n loopGrid((x, y) => {\n if (!grid[y][x]) {\n cells.push({\n x,\n y,\n });\n }\n });\n\n return cells;\n}", "function emptyCells() {\n\treturn cellsArray.filter((cell) => !cell.classList.contains(X_CLASS) && !cell.classList.con...
[ "0.82479066", "0.7879978", "0.7847457", "0.7766346", "0.77084285", "0.77077794", "0.7478327", "0.7416143", "0.7367845", "0.70313674", "0.6892995", "0.6859124", "0.67677164", "0.67340815", "0.6674615", "0.66709346", "0.66440296", "0.66334635", "0.6620267", "0.6609561", "0.6587...
0.6514129
24
game logic to combine numbers
function combine(row, addScore) { var newRow = []; for (var i = 0; i < row.length; i++) { if (row[i] == row[i + 1]) { newRow.push(row[i] + row[i + 1]); if (addScore) score += (row[i] + row[i + 1]); i++; } else { newRow.push(row[i]); } } return newRow; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function mergeNumbers(digit1, digit2, digit3) {\n let merge = `${digit1}${digit2}${digit3}`; \n let newNumber = merge; \n return newNumber; \n}", "function gameAddition() {\n const min1 = Math.ceil(0);\n const max1 = Math.floor(100);\n const firstNumber = Math.floor(Math.random()*(max1-min1+1)+...
[ "0.63399035", "0.6300718", "0.613293", "0.61282885", "0.610029", "0.60405487", "0.60290766", "0.6018308", "0.5869751", "0.5845816", "0.5838707", "0.5822381", "0.5814605", "0.5802692", "0.57922536", "0.57819533", "0.5715307", "0.57123977", "0.5711862", "0.5699545", "0.5695581"...
0.0
-1
get row at rowNum
function getRow(rowNum, reverse) { var row = []; if (reverse) { for (var i = (boardSize - 1); i >= 0; i--) { var key = tileKey(i, rowNum); var tile = document.querySelector("#" + key); if (board[key] != null) { row.push(board[key]); } } } else { for (var i = 0; i < boardSize; i++) { var key = tileKey(i, rowNum); var tile = document.querySelector("#" + key); if (board[key] != null) { row.push(board[key]); } } } return row; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getRow(rownum) {\n \n var row = document.getElementById('row' + rownum);\n \n if(row != null) {\n \n return row;\n \n }\n \n return false;\n }", "getRow(n) {\n return this.grid[n];\n }", "function ...
[ "0.7776719", "0.71563697", "0.71043056", "0.69924515", "0.6985392", "0.6703956", "0.66862655", "0.66038364", "0.6391925", "0.6336074", "0.6331012", "0.6310905", "0.62983006", "0.6295259", "0.6191269", "0.61545324", "0.6106421", "0.61001056", "0.6056467", "0.605522", "0.602671...
0.5880943
28
get col at colNum
function getCol(colNum, reverse) { var col = []; if (reverse) { for (var i = (boardSize - 1); i >= 0; i--) { var key = tileKey(colNum, i); var tile = document.querySelector("#" + key); if (board[key] != null) { col.push(board[key]); } } } else { for (var i = 0; i < boardSize; i++) { var key = tileKey(colNum, i); var tile = document.querySelector("#" + key); if (board[key] != null) { col.push(board[key]); } } } return col; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function WGetCol(col)\n{\n return this.WGetItem(this.currow, col);\n}", "getColumn (colIdx) {\n\t\treturn this.board.filter((e, idx) => {\n\t\t\treturn position.toCol(idx) === colIdx;\n\t\t});\n\t}", "function getColumnCells(colNumber){\n\t\treturn $(table + \"tr td:nth-child(\" + colNumber + \")\");\n\t}", ...
[ "0.764052", "0.72953516", "0.7062047", "0.6973979", "0.6889072", "0.6876986", "0.6609084", "0.6599791", "0.65788954", "0.6548236", "0.65194446", "0.65181506", "0.64030343", "0.63895005", "0.6313452", "0.62912434", "0.62862885", "0.6284183", "0.6276272", "0.6271045", "0.626487...
0.6575173
9
check if any more moves are possible
function gameOver() { var fakeOldBoard = Object.assign({}, board); var fakeNewBoard = Object.assign({}, board); //horizontal check for (var row = 0; row < boardSize; row++) { var newRow = combine(getRow(row, false), false); for (var col = 0; col < newRow.length; col++) { var newKey = tileKey(col, row); fakeNewBoard[newKey] = newRow[col]; } } if (boardsEqual(fakeOldBoard, fakeNewBoard)) { //vertical check for (var col = 0; col < boardSize; col++) { var newCol = combine(getCol(col, false), false); for (var row = 0; row < newCol.length; row++) { var newKey = tileKey(col, row); fakeNewBoard[newKey] = newCol[row]; } } } if (boardsEqual(fakeOldBoard, fakeNewBoard) && availableCells().length == 0) { playing = false; lossText.style.display = "block"; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function hasMoves() {\n for (var x = 0; x < cols; ++x) {\n for (var y = 0; y < cols; ++y) {\n if (canJewelMove(x, y)) {\n return true;\n }\n }\n }\n\n return false;\n }", "function checkPossibleMoves()\n{\n\tif(squares[0].innerHTML && squares[1].innerHTML && squares[2]....
[ "0.77478796", "0.7745572", "0.75722814", "0.7528684", "0.75165015", "0.7332254", "0.7132618", "0.7099039", "0.7060205", "0.7053343", "0.70490307", "0.700276", "0.6976387", "0.6962974", "0.6934658", "0.6934658", "0.6899761", "0.6894075", "0.68529457", "0.6822669", "0.68176085"...
0.0
-1
Common command init wrapper with error reporting.
function init(cmd) { return function() { var args = Array.prototype.slice.call(arguments, 0); cmd.apply(program, args) .catch(function(err) { console.error(err); process.exit(1); }); }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "init() {\n this._checkOptions();\n this._sendErrors();\n }", "function init()\n\t{\n\t\tif (options.info)\n\t\t{\n\t\t\tlog = new Log('info');\n\t\t}\n\t\tif (options.debug)\n\t\t{\n\t\t\tlog = new Log('debug');\n\t\t}\n\t\toptions.log = log;\n\t\tfor (var operation in syntaxes.commandMap)\n\t\t{\n\t\t\ts...
[ "0.6486814", "0.6226673", "0.61067957", "0.61067957", "0.6065396", "0.6031841", "0.59624225", "0.59624225", "0.59624225", "0.59624225", "0.59624225", "0.59624225", "0.59624225", "0.59624225", "0.59624225", "0.59624225", "0.59198534", "0.5871797", "0.5816837", "0.5794707", "0....
0.69210666
0
Adds a message to the screen declaring the winner.
function declareWinner() { const $winner = $('<h2>') .addClass('winner') .text(getWinner()), $board = $('.board'), $reset = $('<button>') .addClass('reset-game') .text('Play Again'); $board.after($winner, $reset); $reset.on('click', resetGame); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function winMessage() {\n // updating the UI for the end screen to display the correct values\n moveHolder.textContent = moves;\n starHolder.textContent = stars;\n secondsContainer.textContent = seconds;\n\n // add the class that will view the wining screen\n winContainer.classList.add('win-scree...
[ "0.6855023", "0.67673206", "0.6655713", "0.660704", "0.645852", "0.6386536", "0.63781047", "0.63481355", "0.62774503", "0.627744", "0.62731755", "0.62378895", "0.6237367", "0.6236394", "0.6235183", "0.62286043", "0.62071073", "0.6191508", "0.61885494", "0.61454165", "0.614072...
0.0
-1
Repeat an array. The argument 'shuff' is True if the elements of the array should be shuffled in each repetition. Very useful for interleaving blocks of trials in counterbalancing. Example: repeatArray([1, 2, 3], 2, true) => [2, 1, 3, 3, 2, 1]
function repeatArray(arr, count, shuff) { shuff = shuff || false; new_array = new Array(); for(i=0; i<count; i++) { p = shuff ? _.shuffle(arr) : (arr); new_array = new_array.concat(p); } return new_array }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function shuffle(array) {\n var currentIndex = array.length, temporaryValue, randomIndex;\n\n while (currentIndex !== 0) {\n randomIndex = Math.floor(Math.random() * currentIndex);\n currentIndex -= 1;\n temporaryValue = array[currentIndex];\n array[currentIndex] = arr...
[ "0.6710646", "0.67063725", "0.6700379", "0.66977406", "0.6696252", "0.6693695", "0.66927963", "0.6686247", "0.6684939", "0.6684939", "0.6684939", "0.6684939", "0.6684939", "0.6671153", "0.6668661", "0.66655886", "0.66642076", "0.66624117", "0.6660669", "0.6659945", "0.6658767...
0.76142645
0
Function to load Search section
function loadProjectsInSearch(){ $('#searchAll').html(""); $.ajax({ type: 'GET', url: '/employerDB/busqueda-proyectos' }).done(function(data){ for(let i=0; i<data.length; i++){ $('#searchAll').append( "<div class='card'><div class='card-header'>"+"Id: " +JSON.stringify(data[i].identifier) +"</div><div class="+"card-body"+">" + "<h5 class="+"card-title"+">" + JSON.stringify(data[i].name) + "</h5>"+ "<p class="+"card-text"+">" + JSON.stringify(data[i].description) +"</p>"+ "</div></div><br>"); } }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function load()\n{\n\tsetupParts();\n\ts = document.getElementById('search');\n\tscroll = document.getElementById('scrollArea');\n\tresult = document.getElementById('scrollArea').object;\n}", "init() {\n if (!this.isInit) {\n return this.loadSearch();\n }\n }", "function stationCont...
[ "0.6799423", "0.63829964", "0.631476", "0.62739456", "0.62172645", "0.61945075", "0.61920583", "0.6187011", "0.6174915", "0.6147228", "0.6130188", "0.60284746", "0.59997034", "0.59997034", "0.59785026", "0.5927264", "0.5872322", "0.5858088", "0.58487433", "0.58253133", "0.580...
0.0
-1
End Function to load Search section Function to load Search section
function loadPersonsInSearch(){ $('#oPersons').html(""); $.ajax({ type: 'GET', url: '/employerDB/busqueda-personas' }).done(function(data){ for(let i=0; i<data.length; i++){ $('#oPersons').append( "<div class='card'><div class='card-header'>"+"Id: " +JSON.stringify(data[i].email) +"</div><div class="+"card-body"+">" + "<h5 class="+"card-title"+">" + JSON.stringify(data[i].name) + "</h5>"+ "<p class="+"card-text"+">" + JSON.stringify(data[i].skills) +"</p>"+ "</div></div><br>"); } }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function load()\n{\n\tsetupParts();\n\ts = document.getElementById('search');\n\tscroll = document.getElementById('scrollArea');\n\tresult = document.getElementById('scrollArea').object;\n}", "function firstLoadForTab_Search()\n{\n //console.log('first load for search tab');\n \n tryPopulateDB();\n \...
[ "0.6858083", "0.64589185", "0.6446536", "0.623739", "0.608885", "0.60123265", "0.5986671", "0.5982573", "0.59813684", "0.59712744", "0.59599197", "0.5924053", "0.59172666", "0.5908163", "0.5902197", "0.5879657", "0.5875863", "0.58703905", "0.5857591", "0.58337367", "0.5821862...
0.0
-1
End Function to load Search section Function to load HOME section
function loadProjectsInHome(){ let userLogged= localStorage.getItem('user'); console.log('userLogged: ', JSON.parse(userLogged)); let userParsed = JSON.parse(userLogged); console.log(userParsed); $('.followedProjects').html(""); console.log(userParsed.email); $.ajax({ type: 'GET', url: '/employerDB/busqueda-proyectosHome/'+ userParsed.email }).done(function(data){ console.log(data); console.log(data[0]); let a = data[0].listProjects.length; // por cada identifier.. for(let i=0; i<a; i++){ // ajax filter by identifier console.log(data[0].listProjects[i]); $.ajax({ type: 'GET', url: '/employerDB/busqueda-proyecto/' +data[0].listProjects[i] }).done(function(data){ // Devuelve objeto completo de projects console.log(data); console.log(JSON.stringify(data[0].identifier)); $('.followedProjects').append("<div class='card'><div class='card-header'>"+"Id: " +JSON.stringify(data[0].identifier) +"</div><div class="+"card-body"+">" + "<h5 class="+"card-title"+">" + JSON.stringify(data[0].name) + "</h5>"+ "<p class="+"card-text"+">" + JSON.stringify(data[0].description) +"</p></div></div><br>"); }).fail(function(data){ alert(data.responseText); }); } }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function home() {\n\t\t\tself.searchText('');\n\t\t\tconfigData.page = 1;\n\t\t\tgetPhotos();\n\t\t}", "function loadSetup() {\r\n document.querySelector(\"nav ul li:first-of-type\").className = \"current\";\r\n document.querySelector(\"nav ul li:last-of-type\").className = \"\";\r\n document.getElementByI...
[ "0.670963", "0.6389713", "0.6276855", "0.6244179", "0.6204045", "0.6159594", "0.61508906", "0.61432755", "0.61221015", "0.6105897", "0.60910326", "0.598157", "0.59738624", "0.59644413", "0.59583133", "0.5925595", "0.5920442", "0.5910305", "0.5892975", "0.5892181", "0.5885166"...
0.0
-1
sayHello() Display input values as message
function sayHello() { let message1 = document.getElementById("hello"); let message2 = document.getElementById("firstName").value; let message3 = document.getElementById("lastName").value; let quote = document.getElementById("quote"); message1.classList.remove("hide"); result.classList.remove("hide"); result.style.width = input.offsetWidth + "px"; document.getElementById("helloTo").innerHTML = message2 + " " + message3; setTimeout(()=>{ quote.classList.remove("hide"); }, 2000); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function sayHello() {\n console.log('Hello, ' + name);\n }", "function sayHello(message){\n if(arguments.length == 0){\n console.log(\"default Hello!\");\n return;\n }\n console.log(message);\n}", "function sayHello(){}", "sayHello() {\n return 'Hello,Molecular'\n ...
[ "0.7094042", "0.6986562", "0.6864396", "0.68301785", "0.68288994", "0.68247014", "0.6811797", "0.6791847", "0.678366", "0.6734398", "0.6733822", "0.67277867", "0.6722048", "0.6721163", "0.6720676", "0.6707099", "0.6698611", "0.669038", "0.66808313", "0.6672818", "0.66562873",...
0.0
-1
Conditionally pushes file to list returns true if pushed, false otherwise (e.g. prevents hidden files to be included unless explicitly told so)
function pushFile(file, query) { // console.log(file,query) // hidden file? if (path.basename(file)[0] === '.') { // not explicitly asking for hidden files? if (!options.all && !(path.basename(query)[0] === '.' && path.basename(query).length > 1)) return false; } if (platform() === 'win') file = file.replace(/\\/g, '/'); list.push(file); return true; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function pushFile(file, query) {\n // hidden file?\n if (path.basename(file)[0] === '.') {\n // not explicitly asking for hidden files?\n if (!options.all && !(path.basename(query)[0] === '.' && path.basename(query).length > 1))\n return false;\n }\n \n i...
[ "0.6725154", "0.6051597", "0.59479606", "0.57999605", "0.5557223", "0.55292946", "0.54454684", "0.53361726", "0.5302144", "0.51968294", "0.5192904", "0.51854026", "0.5172493", "0.5159069", "0.51478344", "0.5131427", "0.5119291", "0.511389", "0.51109594", "0.510256", "0.509867...
0.6745698
0
Returns a histogram of peak intervals
function countIntervalsBetweenNearbyPeaks (peaks) { const intervalCounts = []; peaks.forEach(function (peak, index) { for (let i = 0; i < 10; i++) { const interval = peaks[index + i] - peak; const foundInterval = intervalCounts.some((intervalCount) => { if (intervalCount.interval === interval) { return intervalCount.count++; } return false; }); if (!foundInterval) { intervalCounts.push({ interval: interval, count: 1, }); } } }); return intervalCounts; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function peakFinder(array) {\n var newArr = [];\n array.forEach(function(ele, i) {\n if (i === 0 && ele > array[i+1]) {\n newArr.push(i);\n }\n else if (i === array.length - 1 && ele > array[i-1]) {\n newArr.push(i);\n }\n else if (ele > array[i+1] && ele > array[i-1]) {\n newArr.p...
[ "0.60209495", "0.59201413", "0.58469224", "0.58144265", "0.57831776", "0.5716887", "0.5707824", "0.56694806", "0.5661895", "0.5562816", "0.55601454", "0.551454", "0.5490184", "0.5487928", "0.5447781", "0.5349116", "0.53420293", "0.52411145", "0.52083683", "0.51916313", "0.516...
0.57441366
5
Returns a histogram of tempo candidates.
function groupNeighborsByTempo (intervalCounts, sampleRate) { const tempoCounts = []; intervalCounts.forEach(function (intervalCount, i) { if (intervalCount.interval !== 0) { // Convert an interval to tempo let theoreticalTempo = 60 / (intervalCount.interval / sampleRate); // Adjust the tempo to fit within the 90-180 BPM range while (theoreticalTempo < 90) { theoreticalTempo *= 2; } while (theoreticalTempo > 180) { theoreticalTempo /= 2; } theoreticalTempo = Math.round(theoreticalTempo); const foundTempo = tempoCounts.some((tempoCount) => { if (tempoCount.tempo === theoreticalTempo) { return tempoCount.count += intervalCount.count; } return false; }); if (!foundTempo) { tempoCounts.push({ tempo: theoreticalTempo, count: intervalCount.count, }); } } }); return tempoCounts; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function groupNeighborsByTempo(intervalCounts, sampleRate) {\n var tempoCounts = [];\n intervalCounts.forEach(function(intervalCount, i) {\n if (intervalCount.interval !== 0) {\n // Convert an interval to tempo\n var theoreticalTempo = 60 / (intervalCount.interval / sampleRate );\n\n // Adjust ...
[ "0.54655993", "0.54540515", "0.5448284", "0.52690977", "0.52690977", "0.5099412", "0.50402135", "0.5006685", "0.5001678", "0.4983231", "0.49772388", "0.49772388", "0.49488866", "0.49470556", "0.49342453", "0.4925666", "0.48979735", "0.4880985", "0.48361814", "0.48341292", "0....
0.5343272
3
Diese Methode richtet unser Spiel ein. Sie erzeugt einen Layer und platziert unseren Sprite darauf.
function gameSetup(){ var mySprite, myTimer; //Unsere Canvas wird nur ein Element enthalten. //Es würde seltsam aussehen, wenn wir die Canvas nicht bei jedem //Frame leeren würden. gamekit.clearCanvas(); //Wir brauchen einee Ebene auf der wir unseren Sprite platzieren können. gamekit.createLayer(); //Hier erzeugen wir den neuen Sprite und weisen ihm unser //zuvor geladenes Bild zu. mySprite = new gamekit.Sprite(gamekit.a.ship); //Lass uns den Sprite noch an eine etwas schönere Position schieben. mySprite.x = 50; mySprite.y = 50; //Jetzt fügen wir den Sprite unserer erzeugten Ebene hinzu. gamekit.layer[0].attach(mySprite); //Dauerhafte Bewegung Einstellen. mySprite.direction = 90; mySprite.speed = 2; //Wir erzeugen einen Timer um die Richtung alle paar Sekunden //um 180 Grad zu drehen, sonst geht unser Raumschiff verloren! myTimer = new gamekit.Timer(2000); myTimer.then(function(){ mySprite.direction -= 180; }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Sprite_LayerGraphicS(id) {\n\tthis.id = id;\n this.initialize(...arguments);\n}", "function slimeBoss(x,y){\n this.width = 128;\n this.height = 128;\n id=\"slimeBoss\";\n type=\"motion\";\n layer=2;\n var tags=[\"damaging\",\"enemy\"];\n Entity.call(this,x,y,id,layer,type,tags);\...
[ "0.64816505", "0.6449811", "0.641142", "0.6335259", "0.6333409", "0.6284155", "0.62762547", "0.6226448", "0.6209069", "0.62089354", "0.6205352", "0.6183438", "0.6183438", "0.61820054", "0.61740094", "0.61740094", "0.61620176", "0.61568916", "0.6155881", "0.61552256", "0.61533...
0.0
-1
display count character type in textarea description
function CharTextarea(){ var maxChar = 350; var textAreaDesc = $('.description_textarea'); var lengthLeft = $('.length-left'); lengthLeft.html( textAreaDesc.val().length ); textAreaDesc.on('keyup', function(){ if( $(this).val().length > maxChar ){ return false; } lengthLeft.html( $(this).val().length ); }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function countChar(val) {\t\t\t\t\t\n var tlen = val.value.length;\n\t\tif(tlen > 459)\n\t\t{\n\t\t\tvar text = $('textarea').val();\n\t\t\tvar subst = text.substring(0,459);\n\t\t\talert('Text message length could not exceed 459 character');\n\t\t\t$('textarea').val(subst);\t\t\t\n\t\t}\n\t\tvar len = val....
[ "0.72348285", "0.71872324", "0.7071965", "0.7014789", "0.69863725", "0.68769044", "0.6868367", "0.6835808", "0.6820537", "0.67981744", "0.6751603", "0.6751603", "0.6751603", "0.6751603", "0.67484295", "0.669579", "0.669579", "0.669579", "0.669579", "0.669579", "0.66881245", ...
0.6608807
26
readURLimg read url of input file image for previewing image
function readURLimg( input, eq ){ // console.log( eq ); if( input.files && input.files[0]){ var reader = new FileReader(); reader.onload = function(e){ $('.neu-upload-cover-image img.img-cover-preview').eq(eq).attr('src', e.target.result ); // $('.cm-upload-del').eq(eq).show(); // $('.cm-uploader label').eq(eq).hide(); // $('.cm-preview-wrapper').eq(eq).css('min-height', 100+'px'); // $('.cm-preview-wrapper').eq(eq).css('height', 100+'px'); } reader.readAsDataURL( input.files[0] ); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function readURL(input) {\n if (input.files && input.files[0]) {\n var reader = new FileReader();\n \n reader.onload = function (e) {\n //id <img scr=\"#\"\n $('#imagePreview').attr('src', e.target.result);\n }\n \n reader.readAsD...
[ "0.83907485", "0.8206855", "0.8099671", "0.8093745", "0.80933565", "0.806837", "0.8043551", "0.8010346", "0.79968", "0.7975843", "0.7958736", "0.7926845", "0.7897096", "0.7881924", "0.7873219", "0.7867568", "0.7858843", "0.7851364", "0.77905893", "0.7775124", "0.775673", "0...
0.7716434
24
from i to n(length of arr), we are gonna sift through the complete binary tree. presume that except i, others already formed a complete binary tree.
function siftDown(arr, i, n) { var tmp = arr[i]; // temporarily store variable, for future exchange when loop is over. for (var j = i * 2 + 1; j <= n; j = j * 2 + 1) { if (j <= n && j + 1 <= n && arr[j] < arr[j + 1]) { ++j; } if (tmp > arr[j]) { break; } else { arr[i] = arr[j]; i = j; } } arr[i] = tmp; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function inOrder_iterative(tree, index) {\n \n var stack = [];\n \n while (stack.length > 0 || !isUndefined(tree[index])) {\n if (!isUndefined(tree[index])) {\n stack.push(index);\n index = left(index);\n } else {\n index = stack.pop();\n consol...
[ "0.6409596", "0.6205185", "0.60394555", "0.5934791", "0.5933425", "0.5932404", "0.5909703", "0.5902522", "0.58957946", "0.5892405", "0.5873776", "0.5868014", "0.58546937", "0.584252", "0.58255565", "0.58255565", "0.58244234", "0.5776652", "0.5766386", "0.5748791", "0.5736481"...
0.5511704
33
When add new customer is clicked
function addNewCustomer() { var name = $('#customer-name').val(); var address = $('#customer-address').val(); if (!$('#err-alert').hasClass('hidden')) { $('#err-alert').addClass('hidden'); } var customer = new Object(); customer.name = name; customer.address = address; db.insertTableContent('customers', customer, (succ, msg) => { $('#err-alert').removeClass('hidden'); if (succ) { $('#err-alert').addClass('alert-success'); $('#err-alert').html("Customer added successfully!"); } else { $('#err-alert').addClass('alert-danger'); $('#err-alert').html("Error adding the customer. Please contact administrator."); } }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function on_customer_new(username) {\n $(\"div#widget-customers-manage table tr#new\").html($(\"#widget-customers-new table tr#new_active\").html());\n $(\"div#widget-customers-manage input#username\").focus();\n $(\"#save\").click(on_customer_save);\n $(\".button\").mousedown(function() { $(this).addC...
[ "0.77193207", "0.7676207", "0.72332937", "0.71784246", "0.7126307", "0.69738895", "0.688269", "0.68677545", "0.68306106", "0.6762276", "0.6752653", "0.6749436", "0.67489934", "0.6719055", "0.66190225", "0.66057", "0.6563029", "0.65175605", "0.65056103", "0.6477172", "0.643830...
0.73890746
2
Constructs a new CreateBinRequest. Request needed for creating a new bin
constructor() { CreateBinRequest.initialize(this); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function CreateBucketCommand(input) {\n var _this = \n // Start section: command_constructor\n _super.call(this) || this;\n _this.input = input;\n return _this;\n // End section: command_constructor\n }", "async createRequest(ctx, supplyRequestNumber, state, paid, ite...
[ "0.5642105", "0.5639927", "0.53857887", "0.5119158", "0.5076296", "0.49476135", "0.49351484", "0.4931083", "0.49013814", "0.48532367", "0.48532367", "0.48507434", "0.48486698", "0.4837291", "0.48300388", "0.48300388", "0.48002663", "0.47790077", "0.47439548", "0.47359577", "0...
0.71598876
0
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) { }
{ "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.71304363", "0.69625974", "0.68127793", "0.67444557", "0.67142457", "0.66413975", "0.6632343", "0.66005135", "0.6579658", "0.65621394", "0.640833", "0.64050597", "0.6333516", "0.6303421", "0.6296224", "0.62814873", "0.62681186", "0.62406695", "0.62398356", "0.62336767", "0....
0.0
-1
function left is to navigate the screen to left. If the screen is the last left screen it won't navigate left.
function left() { if (remote.getGlobal('window') == "mainWindow.html"){ new_window = 'settingsWindow.html' } else if (remote.getGlobal('window') == "newsWindow.html"){ new_window = 'mainWindow.html' } else if (remote.getGlobal('window') == "trainWindow.html"){ new_window = 'newsWindow.html' } else if (remote.getGlobal('window') == "appWindow.html"){ new_window = 'trainWindow.html' } if (new_window != null){ //fade all elements out for a "smooth" transition document.getElementById('content').classList.add('fadeOutRight'); document.getElementById('topIcon').classList.add('fadeOut'); //after the function is done, wait one second for all animations and send the main javascript the new window name. setTimeout(function(){ ipc.send('newwindow', new_window) }, 1000); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "goLeft(data = {}){\n data.cameFrom = \"left\";\n this.launchSceneAt(\n this.activeScene.coordinate.x - 1, \n this.activeScene.coordinate.y,\n data\n );\n }", "function moveLeft() {\n moveOn();\n }", "function moveLeft() {\n\n\t\ttry {\n\t\t ...
[ "0.7403715", "0.7358313", "0.72509915", "0.7191645", "0.70652723", "0.695022", "0.6917687", "0.6915715", "0.690897", "0.6884505", "0.68810564", "0.688078", "0.686173", "0.68523884", "0.6839257", "0.6839037", "0.68017626", "0.67876124", "0.6786186", "0.6761624", "0.6760583", ...
0.6354215
51
function right is to navigate the screen to right. If the screen is the last right screen it won't navigate right.
function right() { if (remote.getGlobal('window') == "settingsWindow.html"){ new_window = 'mainWindow.html'; } else if (remote.getGlobal('window') == "mainWindow.html"){ new_window = 'newsWindow.html'; } else if (remote.getGlobal('window') == "newsWindow.html"){ new_window = 'trainWindow.html'; } else if (remote.getGlobal('window') == "trainWindow.html"){ new_window = 'appWindow.html'; } else if (remote.getGlobal('window') == "appWindow.html"){ new_window = null; } if (new_window != null){ //fade all elements out for a "smooth" transition document.getElementById('content').classList.add('fadeOutLeft'); document.getElementById('topIcon').classList.add('fadeOut'); //after the function is done, wait one second for all animations and send the main javascript the new window name. setTimeout(function(){ ipc.send('newwindow', new_window) }, 1000); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function userRight() {\n if (!isStopped) {\n FallingShape.moveRight();\n drawGame();\n }\n }", "function moveRight() {\n\n\t\ttry {\n\t\t\t// Pass in the movement to the game.\n\t\t animation.move(\"x\", moveTypes.right);\n\t\t}\n\t\tcatch (err) {\n\t\t\tconsole.log(err)...
[ "0.7263929", "0.72373885", "0.72025365", "0.71441233", "0.7080945", "0.7066752", "0.70581293", "0.70526177", "0.70414937", "0.7039934", "0.703522", "0.6973119", "0.69702023", "0.69699067", "0.6965856", "0.69352096", "0.6934222", "0.691433", "0.68768615", "0.6864074", "0.68613...
0.0
-1
vpb_setcookie('myCookie', 'The value of the cookie', 7) var myCookie = vpb_getcookie('myCookie'); vpb_removecookie('myCookie')
function vpb_IE_detected() { var ua = window.navigator.userAgent; var old_ie = ua.indexOf('MSIE '); var new_ie = ua.indexOf('Trident/'); if ((old_ie > -1) || (new_ie > -1)) { return true; } else { return false; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function setCookie(cookieKey, cookieValue) {\n document.cookie = cookieKey + \"=\" + cookieValue;\n document.cookie = \"max-age=3153600\";\n document.cookie = \"path=/privexplorer\";\n console.log(\"updated cookie:\" + document.cookie);\n\n}", "function setCookie(k,v) {\n document.cookie = k+'='+v+'; ...
[ "0.73370284", "0.7262624", "0.72604287", "0.72558355", "0.71893334", "0.717577", "0.71629536", "0.7133231", "0.7133231", "0.70892274", "0.70795023", "0.7078103", "0.7071074", "0.70682013", "0.70649976", "0.70570135", "0.7053197", "0.7049865", "0.7046304", "0.70348036", "0.702...
0.0
-1
Password Request Link Sending
function vpb_request_password_link() { var ue_data = $("#ue_data").val(); if(ue_data == "") { $("#ue_data").focus(); $("#this_page_errors").html('<div class="vwarning">'+$("#empty_username_field").val()+'</div>'); $('html, body').animate({ scrollTop: $('#ue_data').offset().top-parseInt(200)+'px' }, 1600); return false; } else { var dataString = {'ue_data': ue_data, 'page':'reset-password-validation'}; $.ajax({ type: "POST", url: vpb_site_url+'forget-password', data: dataString, cache: false, beforeSend: function() { $("#this_page_errors").html(''); $("#disable_or_enable_this_box").removeClass('enable_this_box'); $("#disable_or_enable_this_box").addClass('disable_this_box'); $("#forgot_password_buttoned").hide(); $("#log_in_status").html('<center><div align="center"><img style="margin-top:-40px;" src="'+vpb_site_url+'img/loadings.gif" align="absmiddle" alt="Loading" /></div></center>'); }, success: function(response) { $("#disable_or_enable_this_box").removeClass('disable_this_box'); $("#disable_or_enable_this_box").addClass('enable_this_box'); $("#log_in_status").html(''); $("#forgot_password_buttoned").show(); var response_brought = response.indexOf("processCompletedStatus"); $vlog=JSON.parse(response); if(response_brought != -1) { if($vlog.processCompletedStatus==true){ $("#ue_data").val(''); $("#this_page_errors").html($vlog.response); return false; }else{ setTimeout(function() { window.alert("To change the password you first need to verify the account by entering the verification code which was sent to your gmail account earlier while sign up in the 'Enter the verification code ... ' field to proceed."); window.location.replace(vpb_site_url+'verification'); },500); } } else { $("#this_page_errors").html($vlog.response); return false; } } }); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function generate_password() {\n base.emit(\"generate-password\", {\n url: document.location.toString(),\n username: find_username(),\n });\n }", "function sendsignuplink(name, email, password, ctx) {\n var pw_aes = new sjcl.cipher.aes(prepare_key_pw(password));\n var...
[ "0.69612795", "0.6187634", "0.5917167", "0.584847", "0.58439255", "0.58269995", "0.5811878", "0.57724285", "0.57614", "0.5750133", "0.5719176", "0.5641513", "0.5633307", "0.5608548", "0.56066954", "0.5591217", "0.55796796", "0.55636513", "0.55555433", "0.55283433", "0.5512275...
0.6309521
1
Start section: command_properties End section: command_properties
constructor(input) { // Start section: command_constructor super(); this.input = input; // End section: command_constructor }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "static get properties() {\n return {\n title: {\n type: String\n },\n initialTool: {\n attribute: 'initialtool',\n type: String\n },\n }\n }", "function openproperties(){\n //post(\"openproperties\" + my...
[ "0.6223608", "0.6099833", "0.60820085", "0.5998052", "0.59291244", "0.58592075", "0.5721678", "0.56934226", "0.56416667", "0.5578898", "0.5544703", "0.5537109", "0.5513366", "0.5508303", "0.55068964", "0.54810596", "0.5480039", "0.54352444", "0.5433169", "0.5426056", "0.54211...
0.0
-1
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, sequence, blockIdentifier, type) { obj['sequence'] = sequence; obj['block_identifier'] = blockIdentifier; obj['type'] = type; }
{ "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.71314037", "0.69630265", "0.6814572", "0.67468137", "0.6715615", "0.6642555", "0.6633626", "0.66017884", "0.6580413", "0.65630656", "0.6409274", "0.64043665", "0.6334331", "0.63041437", "0.62964106", "0.6283095", "0.626907", "0.6240725", "0.6238583", "0.6234676", "0.623446...
0.0
-1
Some years ago, I made an interpreter using C. Now I'm porting it to Javascript. For the language specification, refer to Maybe I'll add comments to the code below someday. For now, rest assured that I have tested it against some examples, from hello world and cat programs to the more complex calculators.
function brainfuck(code) { var data = []; data.length = 30000; var j; for (j = 0; j < 30000; j++) { data[j] = 0; } j = 0; var printQueue = ""; for (var i = 0; i < code.length; i++) { if (code[i] == ">") { j++; if (j >= 30000) { throw new Error("Data pointer overflow."); } } else if (code[i] == "<") { j--; if (j < 0) { throw new Error("Data pointer underflow"); } } else if (code[i] == "+") { data[j]++; if (data[j] > 255) { data[j] = 0; } } else if (code[i] == "-") { data[j]--; if (data[j] < 0) { data[j] = 255; } } else if (code[i] == ".") { printQueue += String.fromCharCode(data[j]); } else if (code[i] == ",") { var input = prompt("Input a single character at position " + j + " (extra characters will be ignored)."); data[j] = input.charCodeAt(0); } else if (code[i] == "[") { if (data[j] == 0) { var bracketCount = 0; for (var k = i + 1; k < code.length; k++) { if (code[k] == "[") { bracketCount++; } else if (code[k] == "]") { bracketCount--; } if (bracketCount < 0) { break; } } if (k == code.length) { throw new Error("Unmatched bracket at index " + i + ".") } else { i = k; } } } else if (code[i] == "]") { if (data[j] != 0) { var bracketCount = 0; for (var k = i - 1; k > 0; k--) { if (code[k] == "]") { bracketCount++; } else if (code[k] == "[") { bracketCount--; } if (bracketCount < 0) { break; } } if (k == 0) { throw new Error("Unmatched bracket at index " + i + ".") } else { i = k; } } } } if (printQueue.length > 0) { return printQueue; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function basicLanguage() {\n // Put the context behind a function to guarantee that no\n // state is shared between subsequent evaluate calls.\n var ctx = function () { return ({\n scope: {\n // Our basic calculator bits from above:\n '-': function (a, b) { return a.eval() - b...
[ "0.6930531", "0.6774611", "0.6703182", "0.6582452", "0.63285947", "0.6238266", "0.61961544", "0.61961544", "0.61910766", "0.6128297", "0.6057573", "0.6020845", "0.60198593", "0.6018822", "0.599078", "0.59725964", "0.5933713", "0.58851105", "0.588368", "0.588368", "0.5880512",...
0.0
-1
Table principal com item a ser manipulados
function renderTableList(data, aplicacao, listClassToColumns) { var tableName = "tableContaContabil"; var table = $("#"+tableName).DataTable(); table.destroy(); var table = $("#"+tableName).DataTable( { data: data, deferRender: true, scrollY: 400, pageLength: 50, ordering: false, scrollCollapse: true, scroller: false, searching: false, paging: false, autoWidth: false, language: { "url": "//cdn.datatables.net/plug-ins/1.10.15/i18n/Portuguese-Brasil.json" }, drawCallback: function () { // this gets rid of duplicate headers $('.dataTables_scrollBody thead tr').css({ display: 'none' }); UrbemSonata.DataTablesSetDimensionToHeaderAndBodyCell(tableName, listClassToColumns); UrbemSonata.acceptOnlyNumeric($(".protocolo-numeric")); }, initComplete: function( settings, json ) { modal.close(); $('.dataTables_scrollBody thead tr').css({ display: 'none' }); }, columnDefs: [{ 'targets': 4, 'searchable': false, 'orderable': false, 'render': function (data, type, full, meta) { var codTipoAplicacaoSelected = full[4]; var codConta = full[7]; var $select = $("<select class='select2-custom-item display-block width-250px' name='codTipoAplicacao["+codConta+"]'></select>", { "id": full[0]+"start", "name": "codTipoAplicacao["+codConta+"]", "value": data }); var $selecione = $("<option></option>", { "text": "Selecione", "value": '' }); $select.append($selecione); $.each(aplicacao, function(key, aplicacao) { var $option = $("<option></option>", { "text": aplicacao.descricao, "value": aplicacao.codTipoAplicacao }); if(codTipoAplicacaoSelected === aplicacao.codTipoAplicacao){ $option.attr("selected", "selected") } $select.append($option); }); return $select.prop("outerHTML"); } }, { 'targets': 6, 'searchable': false, 'orderable': false, 'render': function (data, type, full, meta) { var codConta = full[7]; var CodCtbAnterior = full[6]; var $input = $("<input type='text' class='campo-sonata form-control protocolo-numeric' value='"+CodCtbAnterior+"' name='codCtbAnterior["+codConta+"]'>"); return $input.prop("outerHTML"); } }, { className: "white-space-unset vertical-align-unset", "targets": [ 0,1,2,3,4,5,6 ] } ] }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function itemTable() { }", "function addItemTable() { }", "function itemInventoryTable() { }", "function crearTablaPuertasItemsOtras(){\n db.transaction(function (tx) {\n tx.executeSql('CREATE TABLE puertas_items_otras(k_coditem_otras, o_descripcion, v_clasificacion)');\n }, function (error) {\n cons...
[ "0.72072625", "0.6809365", "0.6597677", "0.643407", "0.6378795", "0.63427526", "0.63321084", "0.62857693", "0.6281165", "0.62695956", "0.6267767", "0.62151957", "0.6204239", "0.6194886", "0.6187208", "0.6176481", "0.6174229", "0.6163813", "0.6131826", "0.60933095", "0.6080046...
0.0
-1
use state is a named import so we must must have curly braclket face
function UseStateBasic() { console.log(useState("Hola World")); return ( <div> </div> ) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function importState(state) {\n\t\t\t\t\t\t\n\t\t\t\t\t\t// Load a state object created by exportState().\n\n\t\t\t\t\t}", "onImportState (state) {\n const parsed = Object(_utils_util__WEBPACK_IMPORTED_MODULE_0__[\"parse\"])(state, true)\n this.initialState = parsed\n this.hook.emit('vuex:travel-to-stat...
[ "0.692433", "0.6224834", "0.5872754", "0.5846201", "0.5806582", "0.5744382", "0.569444", "0.56545883", "0.5643964", "0.5642384", "0.556895", "0.555892", "0.5463897", "0.543442", "0.5389449", "0.53880435", "0.53669816", "0.5357868", "0.534336", "0.52975416", "0.529072", "0.5...
0.5194903
28
add image to image db
function addImage(imagePlace, album, name, callback){ console.log("addImage " + imagePlace + " " + album + " " + name); var sql = "INSERT INTO image VALUES (DEFAULT, $1, $2, $3) RETURNING id"; var params = [name, imagePlace, album]; pool.query(sql, params, function(err, result){ if(err){ console.log("error in query: ") console.log(err); callback(err, null); } else { callback(null, result.rows); } }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function uploadImage() {\n console.log(\"name\" + image_name);\n var praveen = {\n // image: fs.readFileSync(`../../FinalProject-master/public/img/${image_name}`),\n image: fs.readFileSync(`./public/uploads/${image_name}`),\n name: ...
[ "0.7181723", "0.7103699", "0.69405556", "0.6925314", "0.686129", "0.68029934", "0.67762977", "0.6631697", "0.6568724", "0.6564619", "0.6558668", "0.6428158", "0.6401479", "0.6384578", "0.63568085", "0.63356864", "0.63236606", "0.6305606", "0.6300894", "0.6286292", "0.62850404...
0.65644515
10
adding a family member
function addFamMem(req, res){ var name = req.body.fName; var email = req.body.mEmail; var password = req.body.mPassword; var fId = req.body.famId; var hashedPass = bcrypt.hash(password, saltRounds, function(err, hash){ if(err) response.render('/'); else { addMember(name, email, hash, fId, function(error, result){ if(error || result == null || result.length < 1){ res.status(500).json({success: false, data: error}); } else { //res.status(200).json(result[0].id); res.render('pages/index'); } }); } }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function addMember(newmember){\n\t\t\tmembers.create(newmember);\n\t\t}", "function addFamilyMember(age, relationshipText, smoker) {\n // used a ternary to account for the boolean nature of checked \n smoker ? smoker = \"(smoker)\" : smoker = \"\" \n var familyList = document.querySelector('ol[class=\"...
[ "0.6894436", "0.674263", "0.657865", "0.6537126", "0.641297", "0.6400222", "0.63841397", "0.63590974", "0.6238219", "0.61716235", "0.61374813", "0.6136722", "0.6052411", "0.6044609", "0.6000857", "0.5944607", "0.58428824", "0.58326864", "0.58312756", "0.5829928", "0.5805385",...
0.50836724
88
add album to the database
function addAlbum(req, res){ var name = req.body.name; var famid = req.body.famId; addAlbumDB(name, famid, function(error, result){ if(error || result == null){ res.status(500).json({success: false, data: error}); } var albumid = result; res.render('pages/loadFile', {'album': albumid}); }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async function addAlbum(title,author,songs){\r\n if (!title) throw 'You must provide a title for your album';\r\n if(typeof(title)!='string') throw 'Title should be of valid string type';\r\n if (!author) throw 'You must provide an author';\r\n if(typeof(author)!='string') throw \"Author should be of type stri...
[ "0.7192875", "0.70866525", "0.70406455", "0.70349747", "0.69036835", "0.68425155", "0.6835648", "0.681856", "0.6776199", "0.6732347", "0.6652261", "0.66440266", "0.65938765", "0.6592308", "0.6573715", "0.6540392", "0.654021", "0.6535955", "0.6462794", "0.6413027", "0.6404437"...
0.7041899
2
add Journal entry to database
function addJournal(req, res){ var imgId = req.body.imgId; var userId = req.body.pId; var entry = req.body.entry; console.log("img id: " + imgId + " user id: " + userId + " entry: " + entry); addEntryDb(imgId, userId, entry, function(error, result){ if(error || result == null){ res.status(500).json({success: false, data: error}); } res.render('pages/journalPage', {'imgId': imgId, 'userId': userId}); }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function saveEntry(entry) {\n const transaction = db.transaction(['new_budget_entry'], 'readwrite');\n\n const budgetObjectStore = transaction.objectStore('new_budget_entry');\n\n budgetObjectStore.add(entry);\n}", "function addEntry(entry){\n jsfile.readFile(dbFile,(err,data)=>{\n if(!err){\n...
[ "0.67471147", "0.66332036", "0.6625382", "0.6598967", "0.65165037", "0.64686286", "0.6457199", "0.6324643", "0.62830335", "0.6236825", "0.62299097", "0.62222266", "0.62041247", "0.6180533", "0.6178335", "0.6156658", "0.6133263", "0.61290854", "0.612472", "0.6078", "0.60759646...
0.66309696
2
adding a family to the form
function addFamily(req, response){ var lname = req.body.lName; var mom = req.body.momName; var dad = req.body.dadName; var city = req.body.city; var state = req.body.state; var street = req.body.street; var password = req.body.password; var hashedPass = bcrypt.hash(password, saltRounds, function(err, hash){ if(err) response.render('/'); else { //console.log(hash); getFamilyInfo(lname, mom, dad, city, state, street, hash, function(error, result){ if(error || result == null || result.lenth < 1){ response.status(500).json({success: false, data: error}); } else { //response.status(200).json(result[0].id); var item = result[0].id; response.render('pages/makeMember.ejs', {'fam': item}) } }) } }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function appendFamily(family, type) {\n let htmlTemplate = \"\";\n for (let member of family) {\n htmlTemplate += `\n <article>\n <h4>${member.name}</h4>\n <a href='mailto:${member.mail}'>${member.mail}</a>\n </article>\n `;\n }\n document.querySelector(\"#family-members\").innerHTML = ht...
[ "0.60552466", "0.5962764", "0.58791566", "0.5825095", "0.57324535", "0.564834", "0.5624056", "0.553418", "0.5502961", "0.54948527", "0.5479954", "0.5450397", "0.5440735", "0.54113", "0.5404658", "0.54035467", "0.533457", "0.53097534", "0.53087735", "0.5300779", "0.52822506", ...
0.0
-1
add info into db returns new id
function getFamilyInfo(lname, mom, dad, city, state, street, password, callback){ var sql = "INSERT INTO family VALUES (DEFAULT, $3, $2, $1, $6, $4, $5, $7) RETURNING id"; var params = [lname, mom, dad, city, state, street, password]; pool.query(sql, params, function(err, result){ if(err){ console.log("error in query: ") console.log(err); callback(err, null); } else { callback(null, result.rows); } }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function add(info) {\n return db('comments')\n .insert(info, 'comment_id')\n .then(id => {\n return id[0]\n })\n}", "addIn(el){ \n\n this.state.store.push(el) // Add in store to see it instantly\n\n return db.collection(this.state.collection).add(el).then( (data) => { \n ...
[ "0.6784482", "0.6522403", "0.65175354", "0.64652723", "0.6444217", "0.63425565", "0.63331056", "0.6317998", "0.62886786", "0.62851346", "0.62777656", "0.6269259", "0.6254895", "0.61955184", "0.6178051", "0.615716", "0.613728", "0.61123335", "0.6090253", "0.6089484", "0.607832...
0.0
-1
get members of a family
function getMembers(request, response){ var id = parseInt(request.query.id); getPplDb(id, function(error, result){ if(error){ response.status(500).json({success: false, data: error}); } else if(result == null || result < 1){ response.render('pages/makeMember.ejs', {'fam': id}); } else{ var ppl = { 'mem': result }; response.setHeader('Content-Type', 'application/json'); response.send(JSON.stringify(ppl)); } }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async getFamilyMembers(familyid){\n data = {\n URI: `${FAMILIES}/members/${familyid}`,\n method: 'GET'\n }\n return await this.sendRequest(data)\n }", "function getFamilyMembers() {\n $scope.fullFamilyDetails = [];\n\n //I decided to use the word as I d...
[ "0.73547304", "0.70524216", "0.6458181", "0.64426523", "0.6359558", "0.6218635", "0.61617196", "0.6133463", "0.6118915", "0.6104567", "0.6032002", "0.60102826", "0.59920484", "0.5969594", "0.5933398", "0.59042007", "0.5899469", "0.5870521", "0.5864018", "0.58537817", "0.57764...
0.50491655
79
get journal entries and img
function getJournalStuff(request, response){ var imgId = parseInt(request.query.imgId); var id = parseInt(request.query.id); getJournalandImage(imgId, id, function(error, result){ if(error){ response.status(500).json({success: false, data: error}); } var je = { 'je': result }; response.setHeader('Content-Type', 'application/json'); response.send(JSON.stringify(je)); }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getEntries() {\n console.log(\"Getting Entries\");\n dbShellStudents.transaction(function(tx) {\n tx.executeSql(\"select id,name,image from students order by name\",[],renderEntries,dberrorhandler);\n }, dberrorhandler);\n}", "static loadJournal() {\n fetch(`${baseURL}/entri...
[ "0.6795039", "0.6263869", "0.6259499", "0.61480516", "0.59501135", "0.5835227", "0.5817778", "0.57195795", "0.57001436", "0.56883055", "0.56704706", "0.5597916", "0.5573763", "0.5503539", "0.54829913", "0.54603", "0.5455251", "0.54551864", "0.5447759", "0.54463595", "0.542246...
0.648005
1
gets person from db
function getPersonFromDb(id, callback){ console.log("getting db id with: " + id); var sql = "SELECT * FROM family WHERE id = $1::int"; var params = [id]; pool.query(sql, params, function(err, result){ if(err){ console.log("error in query: ") console.log(err); callback(err, null); } console.log("params is" + params); console.log(JSON.stringify(result.rows)); callback(null, result.rows); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getDBPerson(id, callback) {\n // similar to PDO in PHP, $1::int gets back first data piece cleanly\n let sql = 'SELECT id, fname, lname, dob FROM person WHERE id = $1::int';\n let params = [id];\n pool.query(sql, params, (err, result) => {\n if (err) {\n console.log('an error with db happened'...
[ "0.69552135", "0.69127405", "0.6816754", "0.680343", "0.667286", "0.66675", "0.66157186", "0.6571983", "0.65647143", "0.65554935", "0.65453935", "0.6542", "0.64411974", "0.6414088", "0.63748974", "0.6371993", "0.62954146", "0.6290782", "0.6259414", "0.62353796", "0.6201099", ...
0.6867474
2