Skip to content

Instantly share code, notes, and snippets.

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

Suraj Shrestha syuraj

🏠
Working from home
View GitHub Profile
import { useState, useEffect } from 'react';
import { Storage } from '@ionic/storage';
const storage = new Storage();
storage.create();
export const useIonicStorage = (key, defaultValue) => {
const [value, setValue] = useState(defaultValue);
useEffect(() => {
@syuraj
syuraj / python_postgres_getting_started.py
Created June 20, 2020 03:34
Python Postgres Getting Started
import psycopg2
try:
connection = psycopg2.connect("postgres://postgres:@localhost:5432/postgres")
cursor = connection.cursor()
# create_table_query = '''CREATE TABLE mobile
# (ID INT PRIMARY KEY NOT NULL,
# MODEL TEXT NOT NULL,