Skip to content

Instantly share code, notes, and snippets.

View manistra's full-sized avatar

Lorenco Burić manistra

  • DEPT
  • Split, Croatia
View GitHub Profile
@manistra
manistra / sendgridResponsiveDynamicTemplate.html
Last active September 16, 2021 10:59
Responsive Dynamic Template for SendGrid
<html>
<head>
<title></title>
<style>
body {
margin: 1.5rem;
font-family: 'Maison Neue Light', 'Lucida Sans', 'Lucida Sans Regular', 'Lucida Grande', 'Lucida Sans Unicode', Geneva, Verdana, sans-serif;
}
div.wrapper {
@manistra
manistra / useOnElementOrOutsideClick.ts
Created September 16, 2021 11:02
Do something when an element with some ID is either clicked on, or clicked on anything outside of it.
import React, { useEffect } from 'react';
export const useOnElementOrOutsideClick = (
ref: React.RefObject<HTMLElement>,
functionToExecute: () => void,
condition = true,
elementId?: string,
): void => {
useEffect(() => {
const handleClick = (event: any) => {
@manistra
manistra / multi-git-win.md
Created October 26, 2021 10:55 — forked from rosswd/multi-git-win.md
Setting up a Github and Bitbucket account on the same computer on Mac OS. Now with a guide for Windows 10.

Setting up github and bitbucket on the same computer (Windows)

Guide for Windows

mix3d asked for some help using this guide with windows so here we go. This was tested with Windows 10. Run all commands in Git Bash once it's installed.

Github will be the main account and bitbucket the secondary.

Git for Windows

  • Download and install Git for Windows
    • In the installer, select everything but decide if you want a desktop icon (2nd step)
@manistra
manistra / how-to-upgrade-heroku-postgresql.md
Created November 22, 2021 19:12 — forked from simonw/how-to-upgrade-heroku-postgresql.md
How to upgrade a Heroku PostgreSQL database to a new plan

How to upgrade a Heroku PostgreSQL database to a new plan

I started a project on a Hobby Dev plan (free, limit 10,000 rows), and then later needed to upgrade it to Hobby Basic ($9/month, limit 10,000,000 rows).

After assigning the new database, I had two databases attached to the application. They looked something like this:

  • HEROKU_POSTGRESQL_OLIVE (postgresql-dimensional-3321) Old, free-tier (Hobby Dev) database
@manistra
manistra / mac-setup-redis.md
Created February 8, 2022 13:33 — forked from tomysmile/mac-setup-redis.md
Brew install Redis on Mac

type below:

brew update
brew install redis

To have launchd start redis now and restart at login:

brew services start redis
@manistra
manistra / kill-process-with-PORT.md
Created June 2, 2022 10:42
Kill process thats using PORT

First, you would want to know which process is using port 3000

sudo lsof -i :3000

this will list all PID listening on this port, once you have the PID you can terminate it with the following:

kill -9 {PID}
@manistra
manistra / DuplicateRemoteHerokuDb.md
Last active June 27, 2022 16:33
Create and restore heroku db dumps

Clone Heroku Database

1. Capture a backup:

heroku pg:backups:capture --app <APP_NAME> 

Or capture a backup using database name:

heroku pg:backups:capture