Skip to content

Instantly share code, notes, and snippets.

View freddiemixell's full-sized avatar

Freddie Mixell freddiemixell

View GitHub Profile
/**
* Sign In
*
* @returns {Promise} with user object.
**/
export default function signInWithEmailAndPassword( email, password ) {
if ( ! email || ! password ) {
alert( `Enter your ${ ! email ? 'email' : 'password' } and try again.` );
return;
}
@freddiemixell
freddiemixell / useFirebase.js
Created June 1, 2021 16:25
Copy and paste react hook examples of how to use firebase auth, firestore and firebase storage. Also works in React Native!
import firebase from 'firebase/app';
import 'firebase/auth';
import 'firebase/firestore';
import 'firebase/storage';
const firebaseConfig = {
apiKey: "YOUR_APP_KEY",
authDomain: "YOUR_AUTH_DOMAIN.firebaseapp.com",
projectId: "YOUR_PROJECT_ID",
storageBucket: "YOUR_STORAGE_BUCKET.appspot.com",
@freddiemixell
freddiemixell / MapScreen.js
Last active August 25, 2021 16:42
Expo MapView with Marker React Hooks
import * as React from 'react'
import MapView from 'react-native-maps'
import * as Location from 'expo-location'
import * as Permissions from 'expo-permissions'
import { StyleSheet } from 'react-native'
import { Text } from 'react-native-paper'
const { useState, useEffect } = React
export default function MapScreen() {
@freddiemixell
freddiemixell / check_redirects.sh
Created August 27, 2019 16:22
Check Redirects By CSV Output Pass/Fail
check_redirects() {
while IFS=, read -r req dest;
do
test="$req => $dest"
echo "Now testing $test"
if curl -Is "$1"$req | grep -s $dest; then
result=Pass
else
result=Fail
fi
@freddiemixell
freddiemixell / netlify.php
Last active February 15, 2021 11:24
WordPress Netlify Build Hook
<?php
// Somewhere off in your wp-config.php make sure you replace 123456 with your api key.
define( 'NETLIFY_API_KEY', '123456' );
// Somewhere off in your theme or even a plugin.
/**
* Netlify Webhook Build Function
*
@freddiemixell
freddiemixell / styled-theme.js
Created October 24, 2018 18:23
Styled Components Mixin Functions and Theme
import styled from 'styled-components';
export const theme = {
colors: {
primaryColor: 'green',
secondaryColor: 'black',
},
device: {
"phone": '@media(min-width: 400px)',
'phoneWide': '@media(min-width: 480px)',
@freddiemixell
freddiemixell / wpOpen.js
Created October 8, 2018 20:40
WordPress Open All Pages
let htmlCollection = document.getElementsByClassName("row-title");
let rowTitle = Array.from(htmlCollection);
rowTitle.map((t) => {t.setAttribute("onclick", "window.open(this.href);")})
function eventFire(el, etype){
if (el.fireEvent) {
el.fireEvent('on' + etype);
} else {
var evObj = document.createEvent('Events');
evObj.initEvent(etype, true, false);