Skip to content

Instantly share code, notes, and snippets.

View FermiDirak's full-sized avatar
🚴
gone cycling

Bryan Manuele FermiDirak

🚴
gone cycling
View GitHub Profile
type Props = {|
value: string,
label: string,
disabled: boolean,
onChange?: (newValue: T) => void,
onBlur?: (newValue: T) => void,
|};
const defaultProps = {
disabled: false,
@FermiDirak
FermiDirak / flowCookbook1.js
Created December 8, 2018 02:33
flow_cookbook_1
type Person = {|
+name: string,
+spiritAnimal: string,
|};
const tenXer = { name: "dirak", spiritAnimal: "Godzilla" };
const talk = (person: Person): void => {
console.log(`Hi, I'm ${name}`);
}
const initialForm = {
name: "name placeholder",
title: "title placeholder",
pets: [
{
name: "Flow",
funFact: "she can typecheck!",
},
],
};
:root {
--red: #FF5A5F;
--white: #FFFFFF;
--lightgrey: #CDD1CC;
--darkgrey: #555A5C;
--darkergrey: #282C34;
--gold: #FFB500;
--turquoise: #007C80;
--green: #55ffbb;
}
router.get('/protected',
passport.authenticate('jwt', {session: false}),
(req, res) => {
const { user } = req;
res.status(200).send({ user });
});
const passport = require('passport');
const LocalStrategy = require('passport-local').Strategy;
const passportJWT = require('passport-jwt');
const JWTStrategy = passportJWT.Strategy;
const bcrypt = require('bcrypt');
const { secret } = require('./keys');
const UserModel = require('./models/user');
@FermiDirak
FermiDirak / user.js
Last active November 20, 2019 08:28
const mongoose = require('mongoose');
const { Schema } = mongoose;
const userSchema = new Schema({
username: {
type: String,
index: true,
unique: true,
dropDups: true,
required: true,
const express = require('express');
const passport = require('passport');
const bcrypt = require('bcrypt');
const jwt = require('jsonwebtoken');
const keys = require('../keys');
const UserModel = require('../models/user');
const router = express.Router();
router.post('/register', async (req, res) => {
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { precisionRound } from '../../utils';
import ChevronUpIcon from 'react-feather/dist/icons/chevron-up';
import ChevronDownIcon from 'react-feather/dist/icons/chevron-down';
class VoteButtons extends Component {
/** an enumeration of the possible vote states for vote buttons */
class BuildingBlock extends React.Component {
handleClick = () => {
console.log('click!');
}
render() {
return (
<button onClick={this.handleClick}/>
);
}