Authlogicは、簡潔で柔軟なRubyで記述された認証ソリューションです。
コードで例示して説明した方がいいでしょう…
Authlogicでは新しい型のモデルを提供しています。他のモデルのようにいくつでもどんな名前で必要なだけ作成することができます。この例では、クラス名から分かるようにUserモデルを使って認証を行おうとしています。
class UserSession < Authlogic::Session::Base # ここでは以下のように設定項目を記述します:
Authlogicは、簡潔で柔軟なRubyで記述された認証ソリューションです。
コードで例示して説明した方がいいでしょう…
Authlogicでは新しい型のモデルを提供しています。他のモデルのようにいくつでもどんな名前で必要なだけ作成することができます。この例では、クラス名から分かるようにUserモデルを使って認証を行おうとしています。
class UserSession < Authlogic::Session::Base # ここでは以下のように設定項目を記述します:
| require 'erb' | |
| class ConfigLoader | |
| def self.from(yaml) | |
| yaml = File.read(yaml) if File.exist?(yaml) | |
| YAML.load(ERB.new(yaml).result)[Rails.env] | |
| end | |
| end |
| 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 |
cribbed from http://pastebin.com/xgzeAmBn
Templates to remind you of the options and formatting for the different types of objects you might want to document using YARD.
| package test.fragment; | |
| import android.app.Activity; | |
| import android.app.Fragment; | |
| import android.app.FragmentTransaction; | |
| import android.os.Bundle; | |
| import android.view.View; | |
| import android.view.View.OnClickListener; | |
| public class MainActivity extends Activity { |
| 'use strict'; | |
| //var lrSnippet = require('grunt-contrib-livereload/lib/utils').livereloadSnippet; | |
| //var mountFolder = function (connect, dir) { | |
| // return connect.static(require('path').resolve(dir)); | |
| //}; | |
| module.exports = function (grunt) { | |
| // load all grunt tasks | |
| require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks); |
PG::ConnectionBad at /
could not connect to server: Connection refused
Is the server running on host "localhost" (::1) and accepting
TCP/IP connections on port 5432?
could not connect to server: Connection refused
Is the server running on host "localhost" (127.0.0.1) and accepting
TCP/IP connections on port 5432?
| # 1) Create your private key (any password will do, we remove it below) | |
| $ cd ~/.ssh | |
| $ openssl genrsa -des3 -out server.orig.key 2048 | |
| # 2) Remove the password | |
| $ openssl rsa -in server.orig.key -out server.key |
| var gulp = require('gulp') | |
| var browserify = require('browserify') | |
| var watchify = require('watchify') | |
| var babelify = require('babelify') | |
| var source = require('vinyl-source-stream') | |
| var buffer = require('vinyl-buffer') | |
| var merge = require('utils-merge') |
| #!/usr/bin/env ruby | |
| require 'selenium-webdriver' | |
| wd = Selenium::WebDriver.for :remote, url: 'http://10.3.1.7:4444/wd/hub', desired_capabilities: :chrome | |
| wd.navigate.to 'https://snipt.net/restrada/python-selenium-workaround-for-full-page-screenshot-using-chromedriver-2x/' | |
| # Get the actual page dimensions using javascript | |
| # | |
| width = wd.execute_script("return Math.max(document.body.scrollWidth, document.body.offsetWidth, document.documentElement.clientWidth, document.documentElement.scrollWidth, document.documentElement.offsetWidth);") |