Community
Cheatsheets
- GenServer Cheatsheet by Benjamin Tan Wei Hao
Books
Community
Cheatsheets
Books
Picking the right architecture = Picking the right battles + Managing trade-offs
First of all, please note that token expiration and revoking are two different things.
A JWT token that never expires is dangerous if the token is stolen then someone can always access the user's data.
Quoted from JWT RFC:
This guide assumes that you recently run brew upgrade postgresql
and discovered to your dismay that you accidentally bumped from one major version to another: say 9.3.x to 9.4.x. Yes, that is a major version bump in PG land.
First let's check something.
brew info postgresql
The top of what gets printed as a result is the most important:
# http://www.rubyinside.com/does-the-gil-make-your-ruby-code-thread-safe-6051.html | |
class Sheep | |
def initialize | |
@shorn = false | |
# Here the sheep owns the mutex. But now the | |
# shearing logic is muddied up by synchronization | |
# logic. This doesn't seem like the right place for | |
# this. |
So i was using Rails 4.1 with Unicorn v4.8.2 and when i tried to deploy my app it doesn't start properly and into the unicorn.log file i found this error message: | |
"app error: Missing `secret_key_base` for 'production' environment, set this value in `config/secrets.yml` (RuntimeError)" | |
After a little research i found that Rails 4.1 change the way to manage the secret_key, so if we read the secrets.yml file located at exampleRailsProject/config/secrets.yml (you need to replace "exampleRailsProject" for your project name) you will find something like this: | |
# Do not keep production secrets in the repository, | |
# instead read values from the environment. | |
production: | |
secret_key_base: <%= ENV["SECRET_KEY_BASE"] %> |
See Also:
Level | Score | Regex | Credit |
---|
# Author: Pieter Noordhuis | |
# Description: Simple demo to showcase Redis PubSub with EventMachine | |
# | |
# Update 7 Oct 2010: | |
# - This example does *not* appear to work with Chrome >=6.0. Apparently, | |
# the WebSocket protocol implementation in the cramp gem does not work | |
# well with Chrome's (newer) WebSocket implementation. | |
# | |
# Requirements: | |
# - rubygems: eventmachine, thin, cramp, sinatra, yajl-ruby |