Skip to content

Instantly share code, notes, and snippets.

View 0ex-d's full-sized avatar
💭
Engr. management

Precious 0ex-d

💭
Engr. management
  • Irgendwo, Irgendwohin (100% remote)
View GitHub Profile
@0ex-d
0ex-d / price-alert-util.ts
Last active January 6, 2021 23:41
Price alert snippet for monitoring market cap on assets exchanges.
/**
* Price alert snippet
* For monitoring market cap on assets exchanges
* Precious Akin
*/
// Available exchange assets
enum ASSET {
'NGN' = '\u20A6', // ₦
'USD' = '$'
/*
* This example shows how using lazy initialization
* in React.useState helps prevent unnecessary computation
* Note: There are rare chances you'll need it.
*/
const Clock = () => {
const [time, setTime] = useState(() => new Date()); // ✅ correct
// const [time, setTime] = useState(() => 1000); // ❌ wrong and over-optimization
useEffect(() => {
@0ex-d
0ex-d / react_hooks_effect.js
Created December 11, 2020 08:26
useEffect vs useLayoutEffect in one simple component.
import * as React from 'react';
export default (()=> {
const ref = React.useRef();
/*
* useEffect hook
* Used when DOM changes are unobservable
*/
React.useEffect(() => {
ref.value = '2019';
@0ex-d
0ex-d / TimeDogg.py
Last active August 24, 2020 06:40
Event and Date manager used by @classboard for reminding folks to attend online classes ;(
__doc__ = '''
~TimeDogg~
Used by @Classboard for reminding folks to attend online classes ;(
- Use of `private` modifiers to prevent aliens from invading
- typechecking following Python 3.x standards
- This is not @facts or @uberfacts...
don't ever ever try to call private class members from the outside world
or I would .ssh ya!
Author: Precious Akin
'''
Use 'passlib' for password encryption and make the perfect round algo. ;)
Required: pip install passlib
'''
from passlib.context import CryptContext
pwd_context = CryptContext(
schemes=["pbkdf2_sha256"],
default="pbkdf2_sha256",
pbkdf2_sha256__default_rounds=30000
)
@0ex-d
0ex-d / duoligot.py
Created August 12, 2020 22:06
Duoligot is a NLP class that uses various language processing toolset to convert your spoken words to text. Can be used in audio transcription, voice commands e.t.c
__doc__ = """
NLP module to convert speech-to-text, can be used
for extracting audio files, voice commands.
requires speech_recognition toolset for NLP.
Only works with English Language
By Precious Akin
"""
import speech_recognition as recognize
class Duoligot:
@0ex-d
0ex-d / interests-and-tools.txt
Last active November 25, 2020 22:18
Languages I code in and tools I use for full-stack development across products.
ReactJS ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓░░░░░░
Python ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓░░░
HTML/CSS ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓░░░
MongoDB ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓░░░░░░░░░░
NodeJs ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓░░░░░
GraphQL ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓░░░░░░░
.sh ▓▓▓▓▓▓▓▓▓▓▓▓▓░░░░░░░░░░░░░
PostgreSQL ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓░░░░░░
C/Rust ▓▓▓▓▓▓▓▓▓▓▓▓▓▓░░░░░░░░░░░░
VueJS ▓▓▓▓▓▓▓▓▓░░░░░░░░░░░░░░░░
@0ex-d
0ex-d / react_env_selector.js
Created August 4, 2020 23:32
React Javascript environment config for various URL rules. Used in my React Native project.
/*
* Configure various url rules per environment
* Use `envSelector` and createSelector hooks to load env.json file
* By Precious Akin
*/
import { createSelector } from 'reselect';
import ENV_FILE from '../../env.json';
const envSelector = () => ENV_FILE;
@0ex-d
0ex-d / override_button_hook.jsx
Created August 1, 2020 19:43
Overriding numb components in React and Vanilla JavaScript (Using hooks)
/* In this example, we would be preppending
* a button to a component
* Learn to overrride components we can't control
* By Precious Akin
*/
import React, { useState, useEffect } from 'react';
import FakeButton from 'react-fake-button';
export default ()=>{
@0ex-d
0ex-d / pushnotif_service.py
Last active August 1, 2020 19:32
Serverside push notifications done using Firebase SDK in Python
"""
A server-side implementation module for push notifications
utilizing firebase SDK
Reference https://firebase.google.com/docs/reference/admin/python/
By Precious Akin"""
from app import app