start new:
tmux
start new with session name:
tmux new -s myname
| module.exports = { | |
| get: function (req, res) { | |
| res.sendfile(req.path.substr(1)); | |
| }, | |
| _config: { | |
| rest: false, | |
| shortcuts: false | |
| } | |
| }; |
| 'use strict'; | |
| var app = require('../../server/server'); | |
| module.exports = function(Restaurant, app) { | |
| // Restaurant.validatesUniquenessOf('UUID', {message: 'UUID EXISTS'}); | |
| Restaurant.observe('before save', function setDefaultUsername(ctx, next) { | |
| if (ctx.instance) { | |
| if(!ctx.instance.created){ | |
| ctx.instance.created = Date.now(); |
| ARCHFLAGS="-arch x86_64" gem install mysql2 -- –with-mysql-config=/usr/local/bin/mysql_config |
#Simple Authentication with Bcrypt
This tutorial is for adding authentication to a vanilla Ruby on Rails app using Bcrypt and has_secure_password.
The steps below are based on Ryan Bates's approach from Railscast #250 Authentication from Scratch (revised).
You can see the final source code here: repo. I began with a stock rails app using rails new gif_vault
##Steps
| sudo cp nginx /etc/init.d/ | |
| sudo update-rc.d nginx defaults | |
| sudo chmod +x /etc/init.d/nginx | |
| /etc/init.d/nginx start |
| The MIT License (MIT) | |
| Copyright (c) 2015 Oleg Ivanov http://github.com/morhekil | |
| Permission is hereby granted, free of charge, to any person obtaining a copy | |
| of this software and associated documentation files (the "Software"), to deal | |
| in the Software without restriction, including without limitation the rights | |
| to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
| copies of the Software, and to permit persons to whom the Software is | |
| furnished to do so, subject to the following conditions: |
SSH into Root
$ ssh root@123.123.123.123
Change Root Password
| require 'mina/bundler' | |
| require 'mina/rails' | |
| require 'mina/git' | |
| require 'mina/rvm' | |
| # Usually mina focuses on deploying to one host and the deploy options are therefore simple. | |
| # In our case, there is a number of possible servers to deploy to, it is therefore necessary to | |
| # specify the host that we are targeting. | |
| server = ENV['server'] | |
| # Since the same host can have multiple applications running in parallel, it is necessary to |
| # lib/tasks/deploy.rake | |
| namespace :deploy do | |
| desc 'Deploy to staging environment' | |
| task :staging do | |
| exec 'mina deploy -f config/deploy/staging.rb' | |
| end | |
| end |