Skip to content

Instantly share code, notes, and snippets.

View clairechabas's full-sized avatar

Claire Chabas clairechabas

View GitHub Profile
@clairechabas
clairechabas / index.html
Last active May 21, 2023 14:56
🥡 Vertically center content in the remaining screen space on a page
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Center Content Vertically in the Remaining Screen Space</title>
<style>
html,
@clairechabas
clairechabas / css-init.css
Last active March 17, 2023 13:45
CSS Init - A global styles initializer
/*
* --- CSS Init ---
* This CSS Init is inspired by
* Josh Comeau's global styles:
* https://courses.joshwcomeau.com/css-for-js/treasure-trove/010-global-styles
* and pieces of Andy Bell's Modern CSS Reset:
* https://piccalil.li/blog/a-modern-css-reset/
*/
/* Use a more-intuitive box-sizing model. */
# This is Git's per-user configuration file.
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
editor = vim
[user]
name = [YOUR_NAME]
email = [YOUR_EMAIL]
@clairechabas
clairechabas / .zshrc
Last active September 18, 2023 21:55
Custom .zshrc file for the post "5 Steps to a Beautiful Terminal That You'll Love Using" - https://medium.com/better-programming/5-steps-to-a-beautiful-terminal-that-youll-love-using-9e94ecb4191b
# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH
# Path to your oh-my-zsh installation.
export ZSH="/Users/claire/.oh-my-zsh"
# Set name of the theme to load --- if set to "random", it will
# load a random theme each time oh-my-zsh is loaded, in which case,
# to know which specific one was loaded, run: echo $RANDOM_THEME
# See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes
ZSH_THEME="spaceship"
# Set list of themes to pick from when loading at random
@clairechabas
clairechabas / index.js
Created May 9, 2020 20:17
File upload API endpoint handling uploads to Firebase Cloud Storage | #NodeJS #ExpressJS #Multer #Firebase #GCloudStorage #GCP
require('dotenv').config();
const express = require('express');
const app = express();
const cors = require('cors');
const bodyParser = require('body-parser');
const { Storage } = require('@google-cloud/storage');
const multer = require('multer');
const port = process.env.API_PORT || 8080;
app.use(bodyParser.json());
@clairechabas
clairechabas / requireAuth.js
Last active August 6, 2019 11:04
requireAuth : HOC to restrict access to components based on auth status
import React, { useEffect } from "react";
import { connect } from "react-redux";
export default ChildComponent => {
const ComposedComponent = props => {
useEffect(() => {
if (props.auth.isLoaded && props.auth.isEmpty) return props.history.push("/");
}, [props.auth, props.history]);
return <ChildComponent {...props} />;
@clairechabas
clairechabas / Main.js
Created August 2, 2019 16:34
Main.js component connected to Redux store to listen on the auth object from Firebase reducer to redirect the user according to auth status.
import React from "react";
import { connect } from "react-redux";
import Home from "./Home";
import Login from "./Login";
import Loader from "./Loader";
const Main = ({ auth }) => {
return (
<div>
{!auth.isLoaded ? <Loader /> : !auth.isEmpty ? <Home /> : <Login />}
@clairechabas
clairechabas / auth.js
Created July 31, 2019 15:40
Sign-in action creator using Firebase Auth
import { SIGNIN_SUCCESS, SIGNIN_ERROR } from "./actionTypes";
import firebase from "../../services/firebase";
// Signing in with Firebase
export const signin = (email, password, callback) => async dispatch => {
try {
firebase
.auth()
.signInWithEmailAndPassword(email, password)
.then(() => {
@clairechabas
clairechabas / auth.js
Last active July 31, 2019 15:41
Sign-up action creator using Firebase Auth
import { SIGNUP_SUCCESS, SIGNUP_ERROR } from "./actionTypes";
import firebase from "../../services/firebase";
// Signing up with Firebase
export const signup = (email, password) => async dispatch => {
try {
firebase
.auth()
.createUserWithEmailAndPassword(email, password)
.then(dataBeforeEmail => {
@clairechabas
clairechabas / index.js
Created July 31, 2019 14:36
Redux store enhanced with Firebase
import React from "react";
import ReactDOM from "react-dom";
import { BrowserRouter as Router } from "react-router-dom";
import "./css/index.css";
import App from "./components/App";
// SETTING UP REDUX STORE
import { Provider } from "react-redux";
import { createStore, applyMiddleware, compose } from "redux";
import reduxThunk from "redux-thunk";