Skip to content

Instantly share code, notes, and snippets.

@pnhoang
Last active June 4, 2019 14:35
Show Gist options
  • Save pnhoang/4e28a1c54bf0dee469128d52c55009d1 to your computer and use it in GitHub Desktop.
Save pnhoang/4e28a1c54bf0dee469128d52c55009d1 to your computer and use it in GitHub Desktop.
Dev Notes

Troubleshooting Prisma

UnhandledPromiseRejectionWarning: Error: Project not found: 'default$default'

$ docker ps
$ docker logs -f <container-id>

Connecting to Postgres Container using Postico, same connection, user/password, databasename is also prisma.

Heroku buildpack to support deployment from subdirectory

Go to the profile of Alexey Timanovskiy Alexey Timanovskiy Jun 16, 2017

Sometimes people use single git repository for multiple related server applications (think of microservices). Such applications reside in subdirectories of the main repo. I found it is not possible to deploy such configurations to Heroku: even if there is a buildpack to use custom Procfile, other problems still exist — e.g. npm install looks for package.json in the root folder only. Long story short, I wrote a Heroku buildpack which allows to use single subdirectory as new project root.

Please find it here: https://github.com/timanovsky/subdir-heroku-buildpack

How to use:

heroku buildpacks:clear if necessary
heroku buildpacks:set https://github.com/timanovsky/subdir-heroku-buildpack
heroku buildpacks:add heroku/nodejs or whatever buildpack you need for your application
heroku config:set PROJECT_PATH=projects/nodejs/frontend pointing to what you want to be a project root.

Deploy your project to Heroku. How it works

The buildpack takes subdirectory you configured, erases everything else, and copies that subdirectory to project root. Then normal Heroku slug compilation proceeds.

OSX Mojave Cool Features

  • Stack View on Desktop

  • Capture screens or recordings: To capture a screenshot or record screen video, hit:

    Shift + Command + 5

  • Continuity Camera

Shoot it on iPhone, see it on Mac. Pages > Insert > Import from iPhone or iPad > Take Photo

  • FaceTime

Get the group together. Group FaceTime Call up to 32 people.

  • Stocks app

  • Voice Memos app

  • Safari Intelligent Tracking Prevention

Use default node version with nvm

To set the default node version use the following command.

    nvm alias default 8.15

Gem install error: You don't have write permissions

Fetching: bundler-2.0.1.gem (100%)
ERROR:  While executing gem ... (Gem::FilePermissionError)
You don't have write permissions for the /Library/Ruby/Gems/2.3.0 directory.

Answer from stackoverflow

Try setting GEM_HOME and GEM_PATH to ~/.gem,

For the current terminal session, just type:

export GEM_HOME=~/.gem
export GEM_PATH=~/.gem

If you want these to be set whenever you open a terminal, add the above commands to your ~/.bashrc, or ~/.zshrc file.

Restart shell or reopen the Terminal:

$ source ~/.bashrc
or $ source ~/.zshrc 

For a more comprehensive solution to setting up a custom ruby environment, see this tutorial from Site5KB, which describes using a .gemrc file.

Clone Github private repo with 2 Step Authentication enabled.

When attempting to clone private repository with https, it might ask for username and password. Normal password does not work. We have to create a new Personal Access Token granting repo access.

and use this Personal Access Token to paste into the password field instead of normal password.

from stackoverflow

From the GitHub Help documentation:

After 2FA is enabled you will need to enter a personal access token instead of a 2FA code and your GitHub password.

...

For example, when you access a repository using Git on the command line using commands like git clone, git fetch, git pull or git push with HTTPS URLs, you must provide your GitHub username and your personal access token when prompted for a username and password. The command line prompt won't specify that you should enter your personal access token when it asks for your password.

How to fix it

  • Generate a Personal Access Token. (Detailed guide on Creating a personal access token for the command line.)
  • Copy the Personal Access Token.
  • Re-attempt the command you were trying and use Personal Access Token in the place of your password.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment