Skip to content

Instantly share code, notes, and snippets.

View NickFoden's full-sized avatar
🐯
I'm here live, i'm not a cat.

Nick Foden NickFoden

🐯
I'm here live, i'm not a cat.
View GitHub Profile
@NickFoden
NickFoden / App.js
Created August 19, 2021 23:21
Inputs Example
import React, { Component } from "react";
import Form from "./components/Form";
class App extends Component {
constructor(props) {
super(props);
this.state = {
finalInputState: {}
};
}
@NickFoden
NickFoden / flags.js
Created July 8, 2021 01:11
Flag Filter
import React, { useEffect, useState } from "react";
import axios from "axios";
import Flags from "../components/Flags";
import styled from "styled-components";
import Pagination from "../components/Pagination";
const Homepage = () => {
const [flags, setFlags] = useState([]);
const [loading, setLoading] = useState(false);
const [currentPage, setCurrentPage] = useState(1);
@NickFoden
NickFoden / Flag.js
Created July 7, 2021 04:41
Flags of the world
import React, { useCallback, useEffect, useState } from "react";
import { useParams, useHistory } from "react-router-dom";
import axios from "axios";
import { BsArrowLeftShort } from "react-icons/bs";
import styled from "styled-components";
const Flag = ({}) => {
let { slug } = useParams();
let history = useHistory();
const [country, setCountry] = useState({});
@NickFoden
NickFoden / regex.md
Last active March 22, 2021 23:54
Random Stuff

Introduction to the Regular Expression Challenges

This is note of regular expression from freecodecamp

  • Regular expressions are special strings that represent a search pattern. Also known as "regex" or "regexp", they help programmers match, search, and replace text.
  • Regular expressions can appear cryptic because a few characters have special meaning.
  • The goal is to combine the symbols and text into a pattern that matches what you want, but only what you want.

Regular Expressions: Using the Test Method

  • JavaScript has multiple ways to use regexes. One way to test a regex is using the .test() method. The .test() method takes the regex, applies it to a string (which is placed inside the parentheses), and returns true or false if your pattern finds something or not.
@NickFoden
NickFoden / app.tsx
Last active February 21, 2021 16:08
firebase example
import logo from "./logo.svg";
import "./App.css";
import { useState, useEffect } from "react";
import { db } from "./fire";
function App() {
const [state, setState] = useState({ stuff: [] });
const getData = () => {
const dataRef = db.collection("stuff");
// https://developers.cloudflare.com/stream/uploading-videos/upload-video-file
const uploadFile = async (e) => {
const body = new FormData();
body.append("file", e.currentTarget.files[0]);
//Tried without this next line body.append and with it
body.append("", "\\");
const result = await fetch(
"https://api.cloudflare.com/client/v4/accounts/$ACCOUNT/stream",
@NickFoden
NickFoden / index.js
Created September 13, 2020 20:21
Firebase Functions
const functions = require("firebase-functions");
const express = require("express");
const admin = require("firebase-admin")
admin.initializeApp(functions.config().firebase)
// once you have the admin initialized then can access other parts of project
// say the real time database
const realTimeDB = admin.database();
const userRef = realTimeDB.ref("users").child("user_uid_or_such_here");
@NickFoden
NickFoden / dates.js
Created July 19, 2020 14:39
Date scratch pad
const aDate = "07/15/20"
const aDateAsDateObj = new Date(aDate)
console.log(aDateAsDateObj.getTime())
@NickFoden
NickFoden / gitty up
Last active June 17, 2020 14:36
Git Remote
git remote set-url origin
git remote add upstream
@NickFoden
NickFoden / database.rules.json
Created June 11, 2020 20:56 — forked from codediodeio/database.rules.json
Common Database Rules for Firebase
// No Security
{
"rules": {
".read": true,
".write": true
}
}