Skip to content

Instantly share code, notes, and snippets.

View markodayan's full-sized avatar
🍑

Mark Odayan markodayan

🍑
View GitHub Profile
@markodayan
markodayan / useFetch.js
Created March 6, 2020 11:40
Custom HTTP request using custom React hook
import { useEffect, useState } from 'react';
export const useFetch = url => {
const [info, setInfo] = useState({ data: null, loading: true });
useEffect(() => {
setInfo({ data: null, loading: true });
fetch(url)
.then(x => x.text())
.then(y => {
@markodayan
markodayan / cdn.html
Created March 28, 2020 11:45
CDNs I am lazy to keep googling
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.6.3/css/all.css"
integrity="sha384-UHRtZLI+pbxtHCWp1t77Bi1L4ZtiqrqD80Kn4Z8NTSRyMA2Fd33n5dQ8lWUE00s/" crossorigin="anonymous">
Caps+fn+p (6 secs) = Capital Key RGB Independance
fn + K + C -> Disable brightness buttons to allow F5 and F6 Func
@markodayan
markodayan / ts-react.sh
Created April 12, 2020 21:30
create-react-app with TypeScript
npx create-react-app <app_name> --typescript
@markodayan
markodayan / endpoints.txt
Last active April 18, 2020 19:46
COVID-19 Data
https://corona.lmao.ninja/v2/countries [all]
axios.get(`https://corona.lmao.ninja/v2/countries/${countryName}`) [Query By Country]
eg -> https://corona.lmao.ninja/v2/countries/south%20africa
@markodayan
markodayan / .babelrc
Last active April 22, 2020 21:29
Babel and Modern JS Builds
{
"presets": ["@babel/preset-env"]
}
@markodayan
markodayan / package.json
Last active April 22, 2020 21:30
Webpack configs
{
"name": "chapter-19",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"build": "node_modules/.bin/webpack --mode production",
"serve": "webpack-dev-server --mode development"
},
"author": "",
@markodayan
markodayan / data.js
Created April 22, 2020 20:53
JS imports and exports in webpack env
const users = [
{ name: 'mario', premium: true },
{ name: 'luigi', premium: false },
{ name: 'yoshi', premium: true },
{ name: 'toad', premium: true },
{ name: 'peach', premium: false },
];
export const getPremUsers = (users) => {
return users.filter((user) => {
@markodayan
markodayan / commands.sh
Last active September 1, 2020 13:07
Git Version Control
# list all commits made across different branches on the repo
git log
# list all branches (will also show which branch you are currently on)
git branch
# switch to a branch
git checkout <existing_branch_name>
# create new branch
@markodayan
markodayan / _app.js
Created June 21, 2020 11:17
Next gloal styles
import '../styles/global.css';
export default function App({ Component, pageProps }) {
return <Component {...pageProps} />;
}