Skip to content

Instantly share code, notes, and snippets.

View AquisTech's full-sized avatar
💻
Speaking via <code/>

AquisTech AquisTech

💻
Speaking via <code/>
View GitHub Profile
require 'rails_helper'
RSpec.describe TodosController, :type => :controller do
describe "GET #index" do
#describe "POST #create" do
#describe "GET #show" do
#describe "PATCH #update" do (or PUT #update)
#describe "DELETE #destroy" do
#describe "GET #new" do
@AquisTech
AquisTech / rspec_model_testing_template.rb
Created November 17, 2020 04:11 — forked from SabretWoW/rspec_model_testing_template.rb
Rails Rspec model testing skeleton & cheat sheet using rspec-rails, shoulda-matchers, shoulda-callbacks, and factory_girl_rails. Pretty much a brain dump of examples of what you can (should?) test in a model. Pick & choose what you like, and please let me know if there are any errors or new/changed features out there. Reddit comment thread: http…
# 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:
@AquisTech
AquisTech / RAILS_CHEATSHEET.md
Created November 15, 2020 18:45 — forked from mdang/RAILS_CHEATSHEET.md
Ruby on Rails Cheatsheet

Ruby on Rails Cheatsheet

Architecture

Create a new application

Install the Rails gem if you haven't done so before

@AquisTech
AquisTech / script.sh
Last active March 1, 2023 01:53 — forked from cheungnj/script.sh
Convert asciidoc to Github Flavored Markdown
# Adapted from https://tinyapps.org/blog/nix/201701240700_convert_asciidoc_to_markdown.html
# Using asciidoctor 1.5.6.1 and pandoc 2.0.0.1
# Install pandoc and asciidoctor
sudo apt install asciidoctor
sudo wget https://github.com/jgm/pandoc/releases/download/2.0.0.1/pandoc-2.0.0.1-1-amd64.deb
sudo dpkg -i pandoc-2.0.0.1-1-amd64.deb
# Convert asciidoc to docbook using asciidoctor

solution_link

If the following error occurs even though libc6-dev is installed,

Do you install glibc-devel(redhat) or libc6-dev(debian)?
You need /usr/include/sys/types.h to compile ruby-oci8.

You need to use ruby-oci8 2.1.0 or upper. Otherwise, run the following command and re-install ruby-oci8.

@AquisTech
AquisTech / test_queries.sql
Created July 17, 2018 14:26
WEEK OF MONTH function for MySQL to find week number in a month from date. #WEEKOFMONTH #WEEK_OF_MONTH
SELECT '2018-07-1', WEEKOFMONTH('2018-07-1') AS week_of_month;
SELECT '2018-07-5', WEEKOFMONTH('2018-07-5') AS week_of_month;
SELECT '2018-07-7', WEEKOFMONTH('2018-07-7') AS week_of_month;
SELECT '2018-07-8', WEEKOFMONTH('2018-07-8') AS week_of_month;
SELECT '2018-07-10', WEEKOFMONTH('2018-07-10') AS week_of_month;
SELECT '2018-07-14', WEEKOFMONTH('2018-07-14') AS week_of_month;
SELECT '2018-07-15', WEEKOFMONTH('2018-07-15') AS week_of_month;
SELECT '2018-07-20', WEEKOFMONTH('2018-07-20') AS week_of_month;
@AquisTech
AquisTech / Scroll to top button
Last active July 11, 2018 14:01
Scroll to top button example
Scroll to top button example
@AquisTech
AquisTech / serialized_store_example.md
Last active October 31, 2018 14:29
Store for serialized text column
class User < ActiveRecord::Base
  store :settings, accessors: [ :color, :homepage ], coder: JSON
end

u = User.new(color: 'black', homepage: '37signals.com')
u.color                          # Accessor stored attribute
u.settings[:country] = 'Denmark' # Any attribute, even if not specified with an accessor

# There is no difference between strings and symbols for accessing custom attributes
@AquisTech
AquisTech / model_sequence.rb
Last active November 15, 2020 03:48
Order of elements arrangement in Model
# encoding
class ModelName < ApplicationRecord
# require statements
# extend Modules
# include Modules
# Gem/Plugins options
# CONSTANTS
# Attribute accessors
# serialize attributes
## API
* http://apionrails.icalialabs.com/book/chapter_one
* https://medium.com/statuscode/introducing-webpacker-7136d66cddfb#.9aou0hodw
* https://blog.codeship.com/building-a-json-api-with-rails-5/
* http://blog.arkency.com/2016/02/how-and-why-should-you-use-json-api-in-your-rails-api/
* https://github.com/tiagopog/jsonapi-utils
* https://robots.thoughtbot.com/validating-json-schemas-with-an-rspec-matcher
* https://github.com/interagent/heroics
* http://weblog.rubyonrails.org/2017/2/23/Rails-5-1-beta1/
* http://blog.michelada.io/whats-new-in-rails-51