This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type User { | |
id: ID! @unique | |
name: String! | |
email: String! @unique | |
image: String | |
password: String # tradition email/password login | |
oauthId: String # if oauth login is used | |
posts: [Post] | |
reviews: [Review] | |
createdAt: DateTime! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const categories = ['react', 'jquery', 'angular', 'vue'] | |
const subCategories = ['documentation', 'tutorial', 'book'] | |
const user = { | |
id: String, // generated by db | |
username: String, // unique | |
password: String, // if we use text password | |
email: String, // unique | |
oauthId: String, // if we use oauth |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Component extends React.Component { | |
constructor(props) { | |
super(props) | |
this.state = { | |
time: null | |
} | |
} | |
componentDidMount() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Example State | |
this.state = { | |
name: "Johnny Smitherson", | |
age: "47", | |
employed: true | |
} | |
// Method to download as JSON file | |
downloadFile = () => { | |
const {name, age, employed} = this.state |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
variant: 1, // variant 1 for multiple-answer | |
question: [ // variant 1 for small text | |
{variant: 1, text: "Which two characters are convicted for the murder of Teresa Halbach?"} | |
], | |
choices: [ // sequential labels | |
{label: "A", text: "Earl Avery"}, | |
{label: "B", text: "Chuck Avery"}, | |
{label: "C", text: "Steve Avery"}, | |
{label: "D", text: "Bobby Dassey"}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Exam Object | |
{ | |
title: String, // Title of the exam - ex: "Network Administration" | |
code: String, // Optional 6 digit code - popular for technical certification exams - ex: "123-456" | |
pass: Number, // Passing score as a percentage - ex: 75 | |
time: Number, // Time limit of exam in minutes - ex: 90 | |
cover: [Node], // Array of Nodes - A way to visualize exam | |
test: [Questions] // Array of Questions - All questions that make up the exam | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// build field from package.json | |
// productName - Output executable will be based on this, the official name of the app | |
// win - means we are targeting Windows | |
// icon - the icon for the executable file, taskbar, shortcuts, etc | |
// publish - automatically pushes the executable to a distribution platform | |
// provider - i am using github releases - people can go there and download my app | |
// owner - my github name | |
// target - type of build, there are more options for Windows - appx, squirrel as well as MacOS and Linux options | |
// directories - by default input dir is dist, here output is assigned to release - all built files will end up there | |
"build": { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Earlier in your code | |
var canvas = document.createElement('canvas') | |
var ctx = canvas.getContext('2d') | |
// Capture a stream and this function will create a snapshot | |
function captureSnapshot(stream) { | |
// Create a video element and style it so it is way off the screen | |
var video = document.createElement('video') | |
video.style.cssText = 'position: absolute; left: -10000px; top: -10000px;' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div id="root"></div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const userSchema = mongoose.Schema( | |
{ | |
login: loginSchema | |
profile: profileSchema | |
skillTree: skillSchema | |
}) | |
const loginSchema = mongoose.Schema( | |
{ | |
username: { |