Skip to content

Instantly share code, notes, and snippets.

View wobsoriano's full-sized avatar
🎯
Focusing

Robert Soriano wobsoriano

🎯
Focusing
View GitHub Profile
@wobsoriano
wobsoriano / sendmail.md
Last active August 17, 2019 13:18
Send email using Nodemailer with Axigen credentials

Send email using Nodemailer with Axigen credentials

1. Install nodemailer package

npm install nodemailer --save

2. Copy example

@wobsoriano
wobsoriano / Dockerfile
Last active August 18, 2019 02:27 — forked from amitavroy/Dockerfile
Docker setup with Laravel & MySQL
FROM php:7.2.10-apache-stretch
RUN apt-get update -yqq && \
apt-get install -y apt-utils zip unzip && \
apt-get install -y nano && \
apt-get install -y libzip-dev && \
a2enmod rewrite && \
docker-php-ext-install pdo pdo_mysql && \
docker-php-ext-configure zip --with-libzip && \
docker-php-ext-install zip && \
@wobsoriano
wobsoriano / .git-commit-template
Created September 17, 2019 07:15 — forked from zakkak/.git-commit-template
This commit message template that helps you write great commit messages and enforce it across your team.
# [<tag>] (If applied, this commit will...) <subject> (Max 72 char)
# |<---- Preferably using up to 50 chars --->|<------------------->|
# Example:
# [feat] Implement automated commit messages
# (Optional) Explain why this change is being made
# |<---- Try To Limit Each Line to a Maximum Of 72 Characters ---->|
# (Optional) Provide links or keys to any relevant tickets, articles or other resources
# Example: Github issue #23
/^[a-zA-Z0-9_.+-]+@(?:(?:[a-zA-Z0-9-]+.)?[a-zA-Z]+.)?(domain.com|domain.net)$/g
@wobsoriano
wobsoriano / index.jsx
Created February 13, 2020 02:59 — forked from avinmathew/index.jsx
Multiple layouts with React Router v4
import React from "react"
import { Route, Switch } from "react-router-dom"
const AppRoute = ({ component: Component, layout: Layout, ...rest }) => (
<Route {...rest} render={props => (
<Layout>
<Component {...props} />
</Layout>
)} />
)
@wobsoriano
wobsoriano / steps.txt
Created February 14, 2020 01:05
Eslint Prettier Create React App [2019]
Steps:
1. Install Eslint Globally
npm i -g eslint
2. Open your create-react-app react project or create one by typing
npx create-react-app name-of-project
(needs npm 5.2+)
3. Initiate Eslint in your project:
eslint --init
@wobsoriano
wobsoriano / README-Template.md
Created February 21, 2020 01:27 — forked from PurpleBooth/README-Template.md
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

@wobsoriano
wobsoriano / index.js
Created April 6, 2020 05:17
Download external image on button click
function downloadImage(data, filename = 'untitled.jpeg') {
var a = document.createElement('a');
a.href = data;
a.download = filename;
document.body.appendChild(a);
a.click();
}
document.getElementById('btn-download').addEventListener("click", function(e) {
const canvas = document.createElement('canvas');
@wobsoriano
wobsoriano / chatscroller.jsx
Created September 4, 2020 04:11 — forked from swyxio/chatscroller.jsx
Handy Scroll window manager component for building a Slack-like Chat experience - when you want your chat window to autoscroll down when new messages appear, BUT not while you're scrolling up. Also useful for feedlike or log display components. from ryan florence workshop chat example (course at https://courses.reacttraining.com/courses/517181/…
function ChatScroller(props) {
const ref = useRef()
const shouldScrollRef = useRef(true)
useEffect(()=> {
if (shouldScrollRef.current) {
const node = ref.current
node.scrollTop = node.scrollheight
}
})
const handleScroll = () => {
@wobsoriano
wobsoriano / auth.js
Last active September 10, 2020 15:50
Firebase Auth Hook
import React, { useState, useEffect, useContext, createContext } from 'react'
import firebase from './firebase'
const AuthContext = createContext()
export const AuthProvider = ({ children }) => {
const auth = useProvideAuth()
return <AuthContext.Provider value={auth}>{children}</AuthContext.Provider>
}