Skip to content

Instantly share code, notes, and snippets.

View emmaodia's full-sized avatar
🏠
Working from home

Emmanuel Oaikhenan emmaodia

🏠
Working from home
View GitHub Profile
@emmaodia
emmaodia / learning_resources.md
Created March 26, 2017 23:10 — forked from nathansmith/web-design-development-learning-resources.md
Resources for learning web design & front-end development
@emmaodia
emmaodia / bootstrap-navbar.txt
Last active July 14, 2018 13:55
This is a gist with the full code explaning how to build a Nav bar using Bootstrap
<!doctype html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.2/css/bootstrap.min.css" integrity="sha384-Smlep5jCw/wG7hdkwQ/Z5nLIefveQRIY9nfy6xoR1uRYBtpZgI6339F5dgvm/e9B" crossorigin="anonymous">
@emmaodia
emmaodia / webdev_online_resources.md
Created July 16, 2018 16:49 — forked from bradtraversy/webdev_online_resources.md
Online Resources For Web Developers (No Downloading)
@emmaodia
emmaodia / bootstrap-Navbar-fixedToTop
Created July 20, 2018 11:00
Code example for this artcle:
<!doctype html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.2/css/bootstrap.min.css" integrity="sha384-Smlep5jCw/wG7hdkwQ/Z5nLIefveQRIY9nfy6xoR1uRYBtpZgI6339F5dgvm/e9B" crossorigin="anonymous">
@emmaodia
emmaodia / app.js
Last active January 8, 2019 02:53
Facebook Messenger Bot payload for basic text message replies from the Bot.
'use strict';
// Imports dependencies and set up http server
const PAGE_ACCESS_TOKEN = process.env.PAGE_ACCESS_TOKEN;
const
express = require('express'),
bodyParser = require('body-parser'),
request = require('request'),
app = express().use(bodyParser.json()); // creates express http server
@emmaodia
emmaodia / status-react error
Created March 13, 2019 13:25
Error I get when I run "make setup" on my local machine
$ make prepare-mobile
make[1]: Entering directory '/home/emmanuel/oss-projects/status-react'
scripts/prepare-for-platform.sh android
********************************************************************************************
The current environment doesn't contain the expected versions of node and/or yarn
- node: expected v10.12.0
found v8.12.0 (/usr/bin/node)
- yarn: expected 1.13.0
found 1.13.0 (/usr/bin/yarn)
@emmaodia
emmaodia / make run android error.
Created March 21, 2019 17:47
I get this error whenever I run "make run-android". How can I fix this?
scripts/run-environment-check.sh android
Finished!
react-native run-android --appIdSuffix debug
Scanning folders for symlinks in /home/emmanuel/oss-projects/status-react/node_modules (168ms)
Starting JS server...
Building and installing the app on the device (cd android && ./gradlew installDebug)...
Starting a Gradle Daemon, 1 incompatible and 1 stopped Daemons could not be reused, use --status for details
> Configure project :app
Reading env from: .env
@emmaodia
emmaodia / passpostJS-FacebookStrategy.js
Last active February 20, 2020 12:52
Gist for the article where we take a look at PassportJS and how easy it is to use the it's Facebook Strategy to authenticate Users for your app.
const passport = require('passport');
const Strategy = require('passport-facebook').Strategy;
require('dotenv').config();
// Configure Passport authenticated session persistence.
passport.serializeUser(function(user, cb) {
cb(null, user);
});
passport.deserializeUser(function(obj, cb) {
// Configure the Facebook strategy for use by Passport.
passport.use(new Strategy({ //This is class constructor argument telling Passport to create a new Facebook Auth Strategy
clientID: process.env['FACEBOOK_CLIENT_ID'],//The App ID generated when app was created on https://developers.facebook.com/
clientSecret: process.env['FACEBOOK_CLIENT_SECRET'],//The App Secret generated when app was created on https://developers.facebook.com/
callbackURL: 'http://localhost:3000/api/v1/user/return',
profile: ['id', 'displayName'] // You have the option to specify the profile objects you want returned
},
function(accessToken, refreshToken, profile, done) {
//Check the DB to find a User with the profile.id
User.findOne({ facebook_id: profile.id }, function(err, user) {//See if a User already exists with the Facebook ID
//Routes
//User gets here upon successful login
router.get('/home', (req, res) => {
res.json({ user: user });
});
//This is so you know if a Login attempt failed
router.get('/login', (req, res) => {
res.json({msg: "login failed"});