Skip to content

Instantly share code, notes, and snippets.

View robertcoopercode's full-sized avatar

Robert Cooper robertcoopercode

View GitHub Profile
let punchline: string = 'Because it was free-range.';
let joke: string = `
Q: Why did the chiken cross the road?
A: ${punchline}
`;
let name: string = 'Chris';
let breed: string = 'Border Collie';
let isAwesome: boolean = true;
var greeting = function (person) {
console.log('Good day ' + person);
};
greeting('Daniel');
const greeting = (person: string) => {
console.log('Good day ' + person);
};
greeting('Daniel');
# NPM Installation Method
npm install --global typescript # Global installation
npm install --save-dev typescript # Local installation
# Yarn Installation Method
yarn global add typescript # Global installation
yarn add --dev typescript # Local installation
...
const AboutPage = ({ data }) => {
const { markdownRemark: page, footerData, navbarData } = data;
const {
frontmatter: {
seo: { title: seoTitle, description: seoDescription, browserTitle },
},
} = page;
...
export const aboutPageQuery = graphql`
query AboutPage($id: String!) {
markdownRemark(id: { eq: $id }) {
html
frontmatter {
title
mainImage {
image
...
collections:
- name: "meetups"
label: "Meetups"
description: "Meetup dates, location, and presenter information."
folder: "src/pages/meetups"
create: true
fields:
- { label: "Template Key", name: "templateKey", widget: "hidden", default: "meetup" }
// Constructor function that creates an object with the sentences property
function GenerateNewText() {
// Add property to the object
this.sentences =
[
"Awesome quote number 1.",
"Second awesome quote.",
"Yet another great quote.",
"Ok, last quote."
];