Skip to content

Instantly share code, notes, and snippets.

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

Emmanuel ODIANOSEN emmaodia

🏠
Working from home
View GitHub Profile
@emmaodia
emmaodia / repo.md
Created December 9, 2020 11:13
Push Github Repo

…or create a new repository on the command line echo "# xxxxx" >> README.md git init git add README.md git commit -m "first commit" git branch -M main git remote add origin https://github.com/emmaodia/xxxxx.git git push -u origin main

…or push an existing repository from the command line

@emmaodia
emmaodia / app-blockstack-auth.js
Created June 30, 2020 16:33
Blockstack Authentication for ReactJS Apps Using Hooks
import React, { useCallback } from 'react';
import { Switch, Route, Redirect } from 'react-router-dom';
import { Connect } from '@blockstack/connect';
import ReactBlockstack, { useBlockstack, didConnect } from 'react-blockstack';
import { appConfig } from './assets/constants';
import Layout from './Components/Layout';
import GuestBook from './Components/GuestBook';
ReactBlockstack({ appConfig });
pragma solidity ^0.6.0;
contract HelloWorld {
string defaultName;
constructor() public{
defaultName = 'World';
}
function getMessage() public view returns(string memory){
return concat("Hello " , defaultName);
}

Keybase proof

I hereby claim:

  • I am emmaodia on github.
  • I am emmaodia (https://keybase.io/emmaodia) on keybase.
  • I have a public key ASAc1qNuA3SJALE0WvFuuZ84AH1ISNnJ7FK_AjJWgy1zmgo

To claim this, I am signing this object:

//Author: @emma_odia on Twitter
// We will be using Solidity version 0.5.4
pragma solidity ^0.6.0;
import 'https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/math/SafeMath.sol';
contract CommunityHealthSupportDapp {
using SafeMath for uint256;
// List of existing projects
<!DOCTYPE html>
<html>
<head>
<title>The best page ever</title>
<style>
.heart {
position: absolute;
margin: auto;
top: 0;
right: 0;
pragma solidity 0.6.1;
contract Loan {
mapping (address => uint256) public loanRegistry;
address owner = msg.sender;
// Added so ether sent to this contract is reverted if the contract fails
fallback() external payable {
revert();
}
@emmaodia
emmaodia / postsModel.js
Last active February 14, 2020 04:11
Example Model Schema for article: How to create Unique URLs in an ExpressJS and MongoDB App
const mongoose = require('mongoose');
//import the slug package
const slug = require('mongoose-slug-generator');
//Initialize
mongoose.plugin(slug);
const postSchema = mongoose.Schema({
title: String,
body: String
//Define the slug parameters
@emmaodia
emmaodia / posts.js
Last active February 17, 2020 12:11
Example Endpoint for article: How to create Unique URLs in an ExpressJS and MongoDB App
app.get('/:posts/:slug', async(req, res) => {
const posts= await Post.findById(req.params.posts);
if(!posts) {
return res.status(404).json({
message : "Post not found!"
})
}
res.status(200).json({
//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"});