Skip to content

Instantly share code, notes, and snippets.

View Oliver-ke's full-sized avatar
💭
-code -eat -sleep -repeat

Azorji Kelechi Oliver Oliver-ke

💭
-code -eat -sleep -repeat
View GitHub Profile
@Oliver-ke
Oliver-ke / sendmailGun.js
Created November 16, 2020 10:00
Util function to send mails from cloud function
const Mailgun = require('mailgun-js');
const DOMAIN = 'mail.myfortvest.com';
const API_KEY = process.env.MAIL_API_KEY || '';
const PUBLIC_KEY = process.env.MAIL_PUBLIC_KEY || '';
const mailgun = Mailgun({ apiKey: API_KEY, domain: DOMAIN, publicApiKey: PUBLIC_KEY });
const sendMail = async (payload) => {
const {variable, desc, ...rest} = payload;
const variableKey = Object.keys(payload.variable);
@Oliver-ke
Oliver-ke / ErrorBoundary.jsx
Created January 4, 2021 09:16
Snippet for react error boundary component
import React, {Component} from 'react';
class ErrorBoundary extends Component {
constructor(props) {
super(props)
this.state = {
hasError: false,
}
}
@Oliver-ke
Oliver-ke / my_contracts.sol
Last active July 18, 2022 08:07
My solidity contracts snippets
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.5.1;
// enums
// contract Mycontract2 {
// // using enums in solidity
// enum State { Waiting, Activated, Pending }
// State public state;

Chaincode Bitcoin Exercise


Student Details

Submission Comments

I added all my solution code to "custom_method", and then invoked it in "run_test".

@Oliver-ke
Oliver-ke / Subject under test
Created March 9, 2021 11:25 — forked from mauricedb/Subject under test
Testing stateful React hooks
import { useState } from 'react';
export function useCounter(initial = 0) {
const [count, setCount] = useState(initial);
return [count, () => setCount(count + 1)];
}
@Oliver-ke
Oliver-ke / .deps...remix-tests...remix_accounts.sol
Created December 5, 2021 21:50
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.6.12+commit.27d51765.js&optimize=false&runs=200&gist=
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.4.22 <0.9.0;
library TestsAccounts {
function getAccount(uint index) pure public returns (address) {
address[15] memory accounts;
accounts[0] = 0x5B38Da6a701c568545dCfcB03FcB875f56beddC4;
accounts[1] = 0xAb8483F64d9C6d1EcF9b849Ae677dD3315835cb2;
@Oliver-ke
Oliver-ke / .deps...remix-tests...remix_accounts.sol
Created December 9, 2021 05:52
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.6.12+commit.27d51765.js&optimize=false&runs=200&gist=
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.4.22 <0.9.0;
library TestsAccounts {
function getAccount(uint index) pure public returns (address) {
address[15] memory accounts;
accounts[0] = 0x5B38Da6a701c568545dCfcB03FcB875f56beddC4;
accounts[1] = 0xAb8483F64d9C6d1EcF9b849Ae677dD3315835cb2;
@Oliver-ke
Oliver-ke / fundme.sol
Created December 27, 2021 13:12
Basic solidity code to fund account
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.7;
import "@chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol";
contract FundMe {
mapping(address => uint256) public addressToAmountFunded;
address[] public funders;
address public owner;
address public ethFeedAddr = 0x9326BFA02ADD2366b30bacB125260Af641031331;
name: Frontend Cloudfront Deployment
on:
push:
branches:
- master
jobs:
build:
runs-on: ubuntu-latest
@Oliver-ke
Oliver-ke / kata.md
Last active April 8, 2022 10:35
My daily kata

Two Sums

Given an array of integers nums and an integer target, return indices of the two numbers such that they add up to target.

var twoSum = function(nums, target) {
    for (let i = 0; i < nums.length; i++) {
        const num = nums[i];
        const rest = nums.slice(i+1);
        for(let m = 0; m < rest.length; m++) {
            const subNum = rest[m];
            if(subNum + num === target) {