Skip to content

Instantly share code, notes, and snippets.

View getaclue00's full-sized avatar

Alex getaclue00

View GitHub Profile
See question on stack overflow: http://stackoverflow.com/questions/28595636/rails-4-how-to-give-alias-names-to-includes-and-joins-in-active-record-que
- Model Student and model Teacher are both STI models with super class model User
- Model Story is a STI model with super class model Task
- includes() and joins(), both fails
Rails alias naming convention (includes() and joins())
- One model as parameter
- is base model (includes(:users))
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
@getaclue00
getaclue00 / Heroku.md
Created March 30, 2018 20:15 — forked from stevenyap/Heroku.md
Heroku setup and list of commands

Note that Heroku Config is found in /.git/config
** Make sure you have setup your git properly before pushing to Heroku **

Pre-conditions for app on Heroku

@getaclue00
getaclue00 / config.ru
Created April 2, 2018 21:38 — forked from ratnakarrao-nyros/config.ru
Sinatra + Warden & Rails + Devise Example
# /config.ru
# This file is used by Rack-based servers to start the application.
# File generated by "rails create MyApp"
# For Rails
require ::File.expand_path('../config/environment', __FILE__)
# For Sinatra
require './slim/slim.rb'
# - Make sinatra play nice
@getaclue00
getaclue00 / capybara cheat sheet
Created April 19, 2018 18:33 — forked from zhengjia/capybara cheat sheet
capybara cheat sheet
=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')
@getaclue00
getaclue00 / project_test.rb
Created April 19, 2018 18:34 — forked from bnadlerjr/project_test.rb
Sample Rails Functional Test (Test::Unit / Shoulda)
require 'test_helper'
# Controller Testing Reminders
# * was the web request successful?
# * was the user redirected to the right page?
# * was the user successfully authenticated?
# * was the correct object stored in the response template?
# * was the appropriate message displayed to the user in the view?
class ProjectsControllerTest < ActionController::TestCase
@getaclue00
getaclue00 / sublime_rubocop.md
Created May 16, 2018 01:48
Rubocop linter within Sublime Text 3

Rubocop Linter with Sublime Text 3

Rubocop is a static code analyzer based on the community driven Ruby style guide. The following steps set up Rubocop as a linter within Sublime Text 3.

Install Rubocop

From the terminal:

$ gem install rubocop
@getaclue00
getaclue00 / sublime_rubocop.md
Created May 16, 2018 01:48
Rubocop linter within Sublime Text 3

Rubocop Linter with Sublime Text 3

Rubocop is a static code analyzer based on the community driven Ruby style guide. The following steps set up Rubocop as a linter within Sublime Text 3.

Install Rubocop

From the terminal:

$ gem install rubocop
@getaclue00
getaclue00 / HOWTODMG.md
Created May 17, 2018 18:05 — forked from jadeatucker/HOWTODMG.md
How to create a "DMG Installer" for Mac OS X

Creating a "DMG installer" for OS X

A DMG Installer is convenient way to provide end-users a simple way to install an application bundle. They are basically a folder with a shortcut to the Applications directory but they can be customized with icons, backgrounds, and layout properties. A DMG file (.dmg) is a Mac OS X Disk Image file and it is used to package files or folders providing compression, encryption, and read-only to the package.

##Creating the DMG file #Disk Utility

@getaclue00
getaclue00 / ScreenshotManager.swift
Created May 23, 2018 22:28 — forked from mminer/ScreenshotManager.swift
Saves screenshots in a Cocoa application (wrapper around screencapture).
import AppKit
struct ScreenshotManager {
/// Matches macOS' screenshot filename format.
private static let filenameFormatter: DateFormatter = {
let formatter = DateFormatter()
formatter.dateFormat = "'Screen Shot' yyyy-MM-dd 'at' HH.mm.ss"
return formatter
}()