SSH into Root
$ ssh [email protected]
Change Root Password
| import GHC.Stack | |
| import Control.Monad.Catch | |
| main :: IO () | |
| main = execute 5 >>= print | |
| execute :: (?loc :: CallStack) => Int -> IO Int | |
| execute n = addCallStack $ print n >> fail "hello" |
SSH into Root
$ ssh [email protected]
Change Root Password
| // | |
| // API.swift | |
| // | |
| // Created by Taro Minowa on 6/10/14. | |
| // Copyright (c) 2014 Higepon Taro Minowa. All rights reserved. | |
| // | |
| import Foundation | |
| typealias JSONDictionary = Dictionary<String, AnyObject> |
A list of Sketch plugins hosted at GitHub, in no particular order.
Create droplet of your liking (ubuntu 12.10 x32)
ssh to root in terminal with your server ip
ssh [email protected]
Add ssh fingerprint and enter password provided in email
| #Model | |
| @user.should have(1).error_on(:username) # Checks whether there is an error in username | |
| @user.errors[:username].should include("can't be blank") # check for the error message | |
| #Rendering | |
| response.should render_template(:index) | |
| #Redirecting | |
| response.should redirect_to(movies_path) |
| class Api::RegistrationsController < Api::BaseController | |
| respond_to :json | |
| def create | |
| user = User.new(params[:user]) | |
| if user.save | |
| render :json=> user.as_json(:auth_token=>user.authentication_token, :email=>user.email), :status=>201 | |
| return | |
| else |
By default, Rails applications build URLs based on the primary key -- the id column from the database. Imagine we have a Person model and associated controller. We have a person record for Bob Martin that has id number 6. The URL for his show page would be:
/people/6
But, for aesthetic or SEO purposes, we want Bob's name in the URL. The last segment, the 6 here, is called the "slug". Let's look at a few ways to implement better slugs.
| ... | |
| # ==> Configuration for any authentication mechanism | |
| # Configure which keys are used when authenticating a user. The default is | |
| # just :email. You can configure it to use [:username, :subdomain], so for | |
| # authenticating a user, both parameters are required. Remember that those | |
| # parameters are used only when authenticating and not when retrieving from | |
| # session. If you need permissions, you should implement that in a before filter. | |
| # You can also supply a hash where the value is a boolean determining whether | |
| # or not authentication should be aborted when the value is not present. | |
| config.authentication_keys = [ :login ] |
| =Navigating= | |
| visit('/projects') | |
| visit(post_comments_path(post)) | |
| =Clicking links and buttons= | |
| click_link('id-of-link') | |
| click_link('Link Text') | |
| click_button('Save') | |
| click('Link Text') # Click either a link or a button | |
| click('Button Value') |