FridayHug.com http://fridayhug.com
The Smallest Rails App http://thesmallestrailsapp.com
%w(action_controller/railtie coderay).each &method(:require)
#This script is used to download file from the server to your local machine | |
#The implementation is based on pure Ruby implementation of SFTP using gem Net SFTP | |
#To install this on your local machine please run the following command in your terminal 'gem install net-sftp' | |
#Author : Ashish Wadekar <ashishawadekar@gmail.com> | |
#Date : 18 December 2016 | |
#This is the gem / library required for the SFTP connection management | |
require 'net/sftp' | |
#The host address |
class Ticket < ActiveRecord::Base | |
belongs_to :grouper | |
belongs_to :user | |
validate :user_cant_be_blacklisted, on: :confirmation | |
validate :user_cant_double_book, on: :confirmation | |
validate :grouper_cant_be_full, on: :confirmation | |
validate :grouper_cant_have_occurred, on: :confirmation |
# gem "prawn", "0.8.4" | |
# Sometime there is no enough space for the last table row when it reaches the end of page | |
Prawn::Document.generate("text_group_overflow_question.pdf") do |pdf| | |
add_page_break_if_overflow(pdf) do |pdf| | |
# generating table here | |
# ... | |
end | |
end |
upstream myapp_puma { | |
server unix:/tmp/myapp_puma.sock fail_timeout=0; | |
} | |
# for redirecting to https version of the site | |
server { | |
listen 80; | |
rewrite ^(.*) https://$host$1 permanent; | |
} | |
=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') |
FridayHug.com http://fridayhug.com
The Smallest Rails App http://thesmallestrailsapp.com
%w(action_controller/railtie coderay).each &method(:require)
;; -*- mode: emacs-lisp; lexical-binding: t -*- | |
;; This file is loaded by Spacemacs at startup. | |
;; It must be stored in your home directory. | |
(defun dotspacemacs/layers () | |
"Layer configuration: | |
This function should only modify configuration layer settings." | |
(setq-default | |
;; Base distribution to use. This is a layer contained in the directory | |
;; `+distribution'. For now available distributions are `spacemacs-base' |
syntax on | |
filetype plugin indent on | |
set background=dark | |
set guifont=Hack:h15 | |
set shell=/bin/bash | |
set linespace=2 | |
if !isdirectory($HOME."/.vim/undo-dir") | |
call mkdir($HOME."/.vim/undo-dir", "", 0700) | |
endif |
class CreateJwtBlacklists < ActiveRecord::Migration[5.2] | |
def change | |
create_table :jwt_blacklist do |t| | |
t.string :jti, null: false | |
t.datetime :exp, null: false | |
end | |
add_index :jwt_blacklist, :jti | |
end | |
end |
class User < ApplicationRecord | |
devise :database_authenticatable, :jwt_authenticatable, | |
jwt_revocation_strategy: JwtBlacklist | |
end |