Skip to content

Instantly share code, notes, and snippets.

Avatar
💻
Furiously Coding

Aashish Chaubey aashish-chaubey

💻
Furiously Coding
View GitHub Profile
@aashish-chaubey
aashish-chaubey / Todo.js
Created Jul 11, 2019
Making use of `useReducer` React hook for managing the state of the functional component
View Todo.js
import React, { useReducer } from 'react';
const reducer = (state, action) => {
switch(action.type) {
case 'add': {
return [
...state,
{
id: Date.now(),
text: '',
@aashish-chaubey
aashish-chaubey / sample_threading.py
Last active Dec 9, 2018
Creating threads in python using threading module
View sample_threading.py
from threading import Thread
import time
def job(name):
# Create a process heavy job
time.sleep(2)
print("The name is: %s" % name)
def main():
print("Program starts!")