Skip to content

Instantly share code, notes, and snippets.

View chuckdries's full-sized avatar
🌵

Chuck Dries chuckdries

🌵
View GitHub Profile
@chuckdries
chuckdries / LoginForm.jsx
Last active October 14, 2020 21:12
Formik login form component
import * as React from 'react';
import { Form, Formik } from 'formik';
import * as yup from 'yup'
// FormField, FormStatus, SubmitButton, and Flex are all custom components in our project
const LoginValidationSchema = yup.object().shape({
email: yup.string().label('Email')
.email()
.required(),
password: yup.string().label('Password')
@chuckdries
chuckdries / random-node-bits.js
Last active July 23, 2020 19:06
STDIN access, currying, and just a hint of promises. call the various dialog functions to try the different approaches
const readline = require('readline');
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout
})
/* using callbacks (naive) */
function dialog() {
rl.question('what is your name?', function(name) {
console.log('hi ' + name)
@chuckdries
chuckdries / index.js
Created May 31, 2020 22:36
Express authentication tutorial - hello world (0)
// index.js with handlebars installed
const express = require("express");
const exphbs = require("express-handlebars");
const app = express();
app.engine("handlebars", exphbs());
app.set("view engine", "handlebars");
app.get("/", (req, res) => {
res.render("home");
@chuckdries
chuckdries / main.handlebars
Last active May 31, 2020 22:37
Express authentication tutorial - hello world (0)
<!-- views/layouts/main.handlebars -->
<html>
<head>
<title>express authentication tutorial!</title>
</head>
<body>
{{{body}}}
</body>
</html>
@chuckdries
chuckdries / home.handlebars
Created May 31, 2020 21:21
Express authentication tutorial - hello world (0)
<!-- views/home.handlebars -->
<h1>express auth tutorial home!</h1>
@chuckdries
chuckdries / index.js
Last active May 31, 2020 20:59
Express authentication tutorial - hello world (0)
const express = require("express");
const app = express();
app.get("/", (req, res) => {
res.send("hello world");
});
app.listen(3000, () => {
console.log("Express auth tutorial running on http://localhost:3000");
});
@chuckdries
chuckdries / promiseTimer.js
Last active July 17, 2019 16:03
A simple function that takes a time, and optionally content, and returns a promise that resolves after that amount of time, with that content
const getTimer = (time, content) => new Promise((resolve, reject) => {
window.setTimeout(() => {
resolve(content || 'hello!');
}, time);
})
@chuckdries
chuckdries / index.html
Created July 28, 2018 12:44
My webtop bar index file - this is only temporary so I could test before I set up the vue/react/(whatever I eventually decide on) project
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Linux WebBar</title>
<link href="https://fonts.googleapis.com/css?family=Playfair+Display:400,400i" rel="stylesheet">
@chuckdries
chuckdries / glo-userstyle.css
Created March 13, 2018 15:25
Give glo a background image with Firefox Stylish plugin (Mozilla format)
@-moz-document domain("gitkraken.com") {
.board-bg {
background:url('https://farm1.staticflickr.com/659/21310226281_a60b966511_o_d.jpg');
background-size: cover;
background-position: center center;
}
.column-bg {
background: rgba(51, 54, 63, 0.5);
}
.card-bg {
@chuckdries
chuckdries / main.js
Created November 2, 2017 14:08
main.js
import Promise from 'promise-polyfill';
import debounce from 'lodash/debounce';
import Vue from 'vue'
import AsyncComputed from 'vue-async-computed'
import App from './App'
import router from './router'
import AdController from './controllers/adcontroller.js';
// import ChatController from './controllers/chatcontroller.js';