Skip to content

Instantly share code, notes, and snippets.

View Sammuel09's full-sized avatar

Samuel Adeniran Sammuel09

View GitHub Profile
@Sammuel09
Sammuel09 / App.js
Created February 7, 2018 12:40
Developers Circle, Facebook - Lagos. React Workshop Day 2. Building an interactive search
import React, { Component } from 'react';
import logo from './logo.svg';
import './App.css';
import { InputField } from './components/InputField';
class App extends Component {
constructor(props, context) {
super(props, context);
this.state = {
value: '',
@Sammuel09
Sammuel09 / postmenu.js
Created October 15, 2018 17:17
This gist describe my code for post menu using cloudinary.
const form = document.querySelector('form');
const name = document.querySelector('#name');
const imageurl = document.querySelector('#image');
const price = document.querySelector('#price');
const postMenuBtn = document.querySelector('#postMenuBtn');
const successMsg = document.querySelector('#successMsg');
const CLOUDINARY_URL = 'https://api.cloudinary.com/v1_1/dx8yi1fsi/image/upload';
const CLOUDINARY_UPLOAD_PRESET = 'ruamt9zr';
@Sammuel09
Sammuel09 / tokenManager.js
Last active January 16, 2019 12:47
tokenManager.js
import jwt from 'jsonwebtoken';
import dotenv from 'dotenv';
dotenv.config();
/**
* @class tokenManager
* @description tokenManager class methods
*/
class tokenManager {
/**
import bcrypt from 'bcrypt';
/**
* @class passwordManager
* @description class defines the methods used to hash and compare hashed passswords.
*/
class PasswordManager {
/**
* @static
* @param {string} password to be hashed
import model from '../models';
import passwordManager from '../helpers/PasswordManager';
import tokenManager from '../helpers/TokenManager';
const { User } = model;
/**
* @class userController
* @description contains the methods used to carry out operations on a user
*/
import { describe, it } from 'mocha';
import chai, { expect } from 'chai';
import chaiHttp from 'chai-http';
import app from '../../../index';
import model from '../../models';
chai.use(chaiHttp);
const { User } = model;
import { Router } from 'express';
import UserController from '../../controllers/UserController';
const userRoutes = Router();
userRoutes.post('/auth/signup', UserController.signupUser);
export default userRoutes;
@Sammuel09
Sammuel09 / index.js
Created January 16, 2019 12:54
Index file of Routes folder
import { Router } from 'express';
import userRoutes from './api/user';
const routes = Router();
routes.use(userRoutes);
export default routes;
// source: all.proto
/**
* @fileoverview
* @enhanceable
* @suppress {messageConventions} JS Compiler reports an error if a variable or
* field starts with 'MSG_' and isn't a translatable message.
* @public
*/
// GENERATED CODE -- DO NOT EDIT!
@Sammuel09
Sammuel09 / staging.md
Last active March 11, 2020 21:50
This gist explains how to take staging, make some experimental changes and then revert changes
  • git checkout master
  • git pull origin master
  • git checkout staging-test
  • git reset --hard origin/master // this resets the branch to have the latest changes of master
  • git add [my changes]
  • git commit -m "Describe my changes"
  • git push -f origin staging-test

When you are done with staging: I should be within the staging-test branch here