Hi all! Todidlist.com started as a vim shortcut that I wrote about way back last year here. I wanted to have the most accessible “did list” and vim served me so so well. However, once I got a new computer, I realized that my did list was missing a key feature: ubiquity. There was one…
All posts by theptrk
Setting up Redis on Heroku for ExpressJS
By default, your express application will store session data in memory. That means if your server restarts all users will need to log back in. Additionally, this does not scale to more than one instance, leaks memory and does other mean things. While this works while developing your local computer (notice how you always need…
Create an interactive terminal cli with node
Let’s create a tool that will track our some text entries. Step 1: Create a new npm project and install the necessary libraries $ mkdir my_cli && cd my_cli && npm init -y && npm i –save inquirer chalk chalk – helps color the terminal prompts inquirer – makes creating interactive prompts a breeze Step 2: create…
Sublime Text shortcut on command line (subl)
TLDR: Create a ~/bin directory and symlink the Sublime command: mkdir ~/bin ln -s /Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl ~/bin/subl Note: if ~/bin is not in your $PATH, add it to your zshrc or bash_profile: echo ‘# add ~/bin to path for scripts like subl\nPATH=$PATH:~/bin’ >> ~/.zshrc && source ~/.zshrc The Sublime Text documentation “OS X Command Line”…
How to publish an npm module
Step 0: You need some code to share. Create a new Github repo or choose one you currently want to publish Here is the command line argument to create a repo called “adder” $ curl -u <your_username> https://api.github.com/user/repos -d “{\”name\”: \”adder\”}” Once you have chosen a Github repo clone it Step 1: Create a proper…
Do not use bcrypt-nodejs
“Invalid salt revision” bcrypt-nodejs is no longer maintained and you might run into this Use bcryptjs for a more secure actively maintained experience. Also, check out Django, its great, but if you do, consider adding bcrypt
Express Sequelize Heroku Postgres Configuration Success
You are in flow developing on your local database and you decide to upload everything to heroku and share it with the world. How do you configure your production database? It’s easier than you think. Let’s assume you have already set up your site. If you used the sequelize init command, you will have a…
Node Sequelize Postgres Tutorial
Why use Sequelize? Sometimes you want your team to use an ORM. Often you need to run migrations. Sequelize provides ORM features and a much needed migrations library that allows us to create producible and version controlled database schemas. Setup your project Step 1: Create an npm project in your desired directory $ npm init…
How does sequelize pluralize?
If you use .sync with sequlize and have a model name like User, your database ends up with a table called Users. More clearly, when you use the sequelize-cli model generator the generated file will show this pluralized table. Here is the code: (link) What is Utils? * Note Sequelize has a directory called Utils AND a file…
Postgres timestamp with timezone – “timestamptz”
Postgres can store your “timestamp with timezone” or “timestamp without timezone”.If you don’t specify either, it will default to “timestamp without timezone” Which one should you use? TLDR: “timestamps with time zones” Whats the problem living life without timezones? Say you have two users in two different timezones – one in California and one in…