Skip to content

Instantly share code, notes, and snippets.

View isaacssemugenyi's full-sized avatar

Isaac Ssemugenyi isaacssemugenyi

View GitHub Profile

MySQL Cheat Sheet

Help with SQL commands to interact with a MySQL database

MySQL Locations

  • Mac /usr/local/mysql/bin
  • Windows /Program Files/MySQL/MySQL version/bin
  • Xampp /xampp/mysql/bin

Add mysql to your PATH

@isaacssemugenyi
isaacssemugenyi / quizSchema.js
Created April 9, 2021 20:56
A basic schema to creat quiz model
const { Schema, model } = require('mongoose');
// Answer Schema
const answerSchema = Schema({
answer: {
type: String,
required: true
},
correct: {
type: Boolean,
@isaacssemugenyi
isaacssemugenyi / fileUpload.vue
Created June 1, 2021 05:54 — forked from raisiqueira/fileUpload.vue
Simple file upload with Vue and Axios
<style>
input[type="file"]{
position: absolute;
top: -500px;
}
div.file-listing{
width: 200px;
}
@isaacssemugenyi
isaacssemugenyi / ArticleForm.vue
Created June 5, 2021 10:07
Basic vue component structure
<template>
</template>
<script>
export default {
}
</script>
@isaacssemugenyi
isaacssemugenyi / ArticleForm.vue
Created June 5, 2021 10:08
template section of the vue component with a basic form and data-binding with v-model
<template>
<div class="row">
<div class="offset-md-3 col-md-6 mt-5">
<h3>Article Form</h3>
<form action="#" @submit.prevent="submitData">
<div class="form-group">
<input
type="text"
class="form-control"
placeholder="Title"
@isaacssemugenyi
isaacssemugenyi / ArticleForm.vue
Created June 5, 2021 10:11
script section with a data property defining the data we expect to get from the form and a submitData method that alerts the form data when a form is submitted
<script>
export default {
name: "ArticleForm",
data() {
return {
article: {
title: "",
description: ""
}
};
@isaacssemugenyi
isaacssemugenyi / ArticleForm.vue
Created June 5, 2021 10:12
Style section of the component with simple style of color red, to display errors in red
</script>
<style scoped>
.errors {
color: red;
}
</style>
@isaacssemugenyi
isaacssemugenyi / package.json
Created June 5, 2021 10:34
Add yup to you package.json file
"dependencies": {
"vue": "~2.6.12",
"yup": "^0.32.9"
},
@isaacssemugenyi
isaacssemugenyi / npm install
Created June 5, 2021 10:35
Install and add yup to your dependencies
npm install yup
@isaacssemugenyi
isaacssemugenyi / ArticleForm.vue
Created June 5, 2021 10:40
import yup in your ArticleForm component and define a validation schema, (ArticleSchema)
<script>
import * as Yup from "yup";
const ArticleSchema = Yup.object().shape({
title: Yup.string()
.min(10, "Title should be less than 10 characters")
.max(100, "Title should not exceed 100 characters")
.required("Title is required"),
description: Yup.string()
.min(50, "Description should be less than 50 characters")