YARD CHEATSHEET http://yardoc.org
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.
# This is a skeleton for testing models including examples of validations, callbacks, | |
# scopes, instance & class methods, associations, and more. | |
# Pick and choose what you want, as all models don't NEED to be tested at this depth. | |
# | |
# I'm always eager to hear new tips & suggestions as I'm still new to testing, | |
# so if you have any, please share! | |
# | |
# @kyletcarlson | |
# | |
# This skeleton also assumes you're using the following gems: |
# start model test | |
require "spec_helper" | |
module Mesin | |
describe User do | |
before do | |
@customer = create(:role, :customer) | |
@super_admin = create(:role, :super_admin) | |
end |
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.
Regex for matching ALL Japanese common & uncommon Kanji (4e00 – 9fcf) ~ The Big Kahuna! | |
([一-龯]) | |
Regex for matching Hirgana or Katakana | |
([ぁ-んァ-ン]) | |
Regex for matching Non-Hirgana or Non-Katakana | |
([^ぁ-んァ-ン]) | |
Regex for matching Hirgana or Katakana or basic punctuation (、。’) |
#!/usr/bin/env ruby | |
str = "Jul qvq gur puvpxra pebff gur ebnq?" | |
def rot13(secret_messages) | |
upcase_alphabet = ("A".."Z").to_a | |
downcase_alphabet = ("a".."z").to_a | |
upcase_rot13 = [] | |
upcase_length = upcase_alphabet.length | |
downcase_length = downcase_alphabet.length |
n = gets.to_i | |
# Get infinity list of number | |
2.upto(Float::INFINITY) | |
# Use Enum#lazy method | |
.lazy | |
# Find prime number | |
.select { |i| (2..Math.sqrt(i)).none? { |a| (i % a).zero? }} | |
# Limit infinity list of number by 200 | |
.first(200) | |
# Find palindrome prime number |
-- Create a group with read-only access | |
CREATE ROLE readonly; | |
-- Grant access on public sheme to existing tables | |
GRANT USAGE ON SCHEMA public TO readonly; | |
ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT SELECT ON TABLES TO readonly; -- grant access to future tables | |
-- Grant access to specific database, repeat code below for each database | |
GRANT CONNECT ON DATABASE db_name to readonly; | |
ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT ALL ON TABLES TO readonly; -- grant access to future tables |
# Check whether EBS volume already attached | |
lsblk | |
# Check EBS volume filesystem | |
sudo file -s /dev/xvdf | |
# If type of filesystem still 'data' it means no filesystem yet, we have to create it | |
sudo mkfs -t ext4 /dev/xvdf |
# -*- mode: ruby -*- | |
# vi: set ft=ruby : | |
$install_go = <<-SCRIPT | |
sudo apt-get update -y | |
wget https://dl.google.com/go/go1.12.7.linux-amd64.tar.gz | |
sudo tar -xvf go1.12.7.linux-amd64.tar.gz | |
sudo mv go /usr/local | |
cd ~ |