Skip to content

Instantly share code, notes, and snippets.

@colbyfayock
Created August 11, 2021 02:04
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save colbyfayock/eb523d3359de66c7899c0b14330fc5b3 to your computer and use it in GitHub Desktop.
Save colbyfayock/eb523d3359de66c7899c0b14330fc5b3 to your computer and use it in GitHub Desktop.
GitHub Copilot Suggestion Examples
/* Input */
const recipes = [
{
name: 'Fried Chicken',
categories: ['chicken', 'meat']
},
{
name: 'Spinach Pasta',
categories: ['pasta', 'vegan']
},
{
name: 'Thai Curry with Chicken',
categories: ['chicken', 'thai', 'meat']
}
];
// returns an array of recipes with chicken
/* Input with Suggestion */
const recipes = [
{
name: 'Fried Chicken',
categories: ['chicken', 'meat']
},
{
name: 'Spinach Pasta',
categories: ['pasta', 'vegan']
},
{
name: 'Thai Curry with Chicken',
categories: ['chicken', 'thai', 'meat']
}
];
// returns an array of recipes with chicken
const chickenRecipes = recipes.filter(recipe => recipe.categories.includes('chicken'));
/* Input */
// returns a sorted array of objects based on date
/* Input with Suggestion */
// returns a sorted array of objects based on date
function sortByDate(array) {
/* Input */
function sortArrayByKey
/* Input with Suggestion */
function sortArrayByKey(array, key) {
return array.sort(function(a, b) {
var x = a[key]; var y = b[key];
return ((x < y) ? -1 : ((x > y) ? 1 : 0));
});
}
/* Input */
import { getApolloClient } from 'lib/apollo-client';
import { QUERY_ALL_PAGES } from 'data/pages';
function getAllPAges() {
/* Input with Suggestion */
import { getApolloClient } from 'lib/apollo-client';
import { QUERY_ALL_PAGES } from 'data/pages';
function getAllPAges() {
return getApolloClient().query({
query: QUERY_ALL_PAGES
});
}
/* Input */
function sortArrayByKey
/* Synthesized Results */
Sythesizing 10/10 solutions (Duplicates hidden)
=======
function sortArrayByKey(array, key) {
return array.sort(function(a, b) {
var x = a[key]; var y = b[key];
return ((x < y) ? -1 : ((x > y) ? 1 : 0));
});
}
=======
...9 more sortArrayByKey results
/* Input */
import { removeExtraSpaces } from './src/lib/until';
// test that extra spaces are removed
/* Synthesized Results */
Sythesizing 10/10 solutions (Duplicates hidden)
=======
expect(removeExtraSpaces(' ')).toBe(' ');
expect(removeExtraSpaces(' a')).toBe(' a');
expect(removeExtraSpaces('a ')).toBe('a ');
expect(removeExtraSpaces('a b')).toBe('a b');
=======
...9 more results
@sunteams
Copy link

ceipnlhmjohemhfpbjdgeigkababhmjc

@sunteams
Copy link

How to pòcibol

@AJUAREZ5000
Copy link

Ayuda

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment