Skip to content

Instantly share code, notes, and snippets.

Speaking via <code/>

AquisTech AquisTech

Speaking via <code/>
View GitHub Profile
View rspec_cheatsheet_controller_spec.rb
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 / rspec_model_testing_template.rb
Created Nov 17, 2020 — forked from kyletcarlson/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…
View rspec_model_testing_template.rb
# 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 /
Created Nov 15, 2020 — forked from mdang/
Ruby on Rails Cheatsheet

Ruby on Rails Cheatsheet


Create a new application

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

AquisTech /
Last active Sep 4, 2020 — forked from cheungnj/
Convert asciidoc to Github Flavored Markdown
# Adapted from
# Using asciidoctor and pandoc
# Install pandoc and asciidoctor
sudo apt install asciidoctor
sudo wget
sudo dpkg -i pandoc-
# Convert asciidoc to docbook using asciidoctor


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 / test_queries.sql
Created Jul 17, 2018
WEEK OF MONTH function for MySQL to find week number in a month from date. #WEEKOFMONTH #WEEK_OF_MONTH
View test_queries.sql
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 / Scroll to top button
Last active Jul 11, 2018
Scroll to top button example
View Scroll to top button
Scroll to top button example
AquisTech /
Last active Oct 31, 2018
Store for serialized text column
class User < ActiveRecord::Base
  store :settings, accessors: [ :color, :homepage ], coder: JSON

u = 'black', homepage: '')
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 / model_sequence.rb
Last active Nov 15, 2020
Order of elements arrangement in Model
View model_sequence.rb
# encoding
class ModelName < ApplicationRecord
# require statements
# extend Modules
# include Modules
# Gem/Plugins options
# Attribute accessors
# serialize attributes
View gist:ff86995ccc0702ae9339a432bc3f1dbe
## API
You can’t perform that action at this time.