Skip to content

Instantly share code, notes, and snippets.

@peterdee
peterdee / default.conf
Created December 11, 2019 07:09
NGiNX Configuration for Vue-Router in HTML5 Mode
server {
listen 80 default_server;
listen [::]:80 default_server;
root /your/root/path;
index index.html;
server_name you.server.com;
@peterdee
peterdee / terminal-git-branch-name.md
Last active November 14, 2019 07:27 — forked from joseluisq/terminal-git-branch-name.md
Add Git Branch Name to Terminal Prompt (Mac)

Add Git Branch Name to Terminal Prompt (Mac)

image

Open ~/.bash_profile in your favorite editor and add the following content to the bottom.

# Git branch in prompt.

parse_git_branch() {
@peterdee
peterdee / state-abbreviations.json
Created October 11, 2019 07:42 — forked from 75th/state-abbreviations.json
US state abbreviations in JSON
{
"al": { "full": "alabama", "other": ["ala"] },
"ak": { "full": "alaska", "other": ["alas"] },
"az": { "full": "arizona", "other": ["ariz"] },
"ar": { "full": "arkansas", "other": ["ark"] },
"ca": { "full": "california", "other": ["calif", "cal"] },
"co": { "full": "colorado", "other": ["colo", "col"] },
"ct": { "full": "connecticut", "other": ["conn"] },
"de": { "full": "delaware", "other": ["del"] },
"dc": { "full": "district of columbia", "other": ["washington dc", "wash dc"] },
module.exports = {
up: function (queryInterface, Sequelize) {
return [
queryInterface.addColumn('User', 'name', {
type: Sequelize.STRING
}),
queryInterface.addColumn('User', 'nickname', {
type: Sequelize.STRING,
})
];
@peterdee
peterdee / how-to-copy-aws-rds-to-local.md
Created July 12, 2019 13:51 — forked from syafiqfaiz/how-to-copy-aws-rds-to-local.md
How to copy production database on AWS RDS(postgresql) to local development database.
  1. Change your database RDS instance security group to allow your machine to access it.
    • Add your ip to the security group to acces the instance via Postgres.
  2. Make a copy of the database using pg_dump
    • $ pg_dump -h <public dns> -U <my username> -f <name of dump file .sql> <name of my database>
    • you will be asked for postgressql password.
    • a dump file(.sql) will be created
  3. Restore that dump file to your local database.
    • but you might need to drop the database and create it first
    • $ psql -U <postgresql username> -d <database name> -f <dump file that you want to restore>
  • the database is restored
@peterdee
peterdee / timezones
Created June 11, 2019 09:41 — forked from ykessler/timezones
JSON list of time zones (Based on Olson tz database)
[
{"group":"US (Common)",
"zones":[
{"value":"America/Puerto_Rico","name":"Puerto Rico (Atlantic)"},
{"value":"America/New_York","name":"New York (Eastern)"},
{"value":"America/Chicago","name":"Chicago (Central)"},
{"value":"America/Denver","name":"Denver (Mountain)"},
{"value":"America/Phoenix","name":"Phoenix (MST)"},
{"value":"America/Los_Angeles","name":"Los Angeles (Pacific)"},
{"value":"America/Anchorage","name":"Anchorage (Alaska)"},
@peterdee
peterdee / postgres-brew.md
Created May 30, 2019 07:36 — forked from ibraheem4/postgres-brew.md
Installing Postgres via Brew (OSX)

Installing Postgres via Brew

Pre-Reqs

Brew Package Manager

In your command-line run the following commands:

  1. brew doctor
  2. brew update
@peterdee
peterdee / download-file.js
Created April 15, 2019 11:56 — forked from javilobo8/download-file.js
Download files with AJAX (axios)
axios({
url: 'http://localhost:5000/static/example.pdf',
method: 'GET',
responseType: 'blob', // important
}).then((response) => {
const url = window.URL.createObjectURL(new Blob([response.data]));
const link = document.createElement('a');
link.href = url;
link.setAttribute('download', 'file.pdf');
document.body.appendChild(link);
@peterdee
peterdee / rm_mysql.md
Created April 4, 2019 11:48 — forked from vitorbritto/rm_mysql.md
Remove MySQL completely from Mac OSX

Remove MySQL completely

  1. Open the Terminal

  2. Use mysqldump to backup your databases

  3. Check for MySQL processes with: ps -ax | grep mysql

  4. Stop and kill any MySQL processes

  5. Analyze MySQL on HomeBrew:

brew remove mysql