Skip to content

Instantly share code, notes, and snippets.

View edwardloveall's full-sized avatar
👈
there he is

Edward Loveall edwardloveall

👈
there he is
View GitHub Profile
@edwardloveall
edwardloveall / abbreviation cop README.md
Last active May 13, 2022 20:29
Custom cop for detecting abbreviations in variables/class names/etc

This is a custom Rubocop cop to detect abbreviations in the names of classes, methods, variables, and constants. It does this by taking each definition, splitting it up into individual words, and running it through a spellchecker. The english spellchecker is from [ffi-aspell] and the ruby and html dictionaries are from [spellr]. As a nice side-effect, this helps us to avoid misspellings in our names.

Note that [spellr] and [ffi-aspell] are required for this, but could be swapped out or removed if desired. Small editing will be needed to remove them from abbreviations.rb.

class Groups::Index < BrowserAction
route do
groups = GroupQuery.new.join_users
render Groups::IndexPage, groups: groups
end
end

Keybase proof

I hereby claim:

  • I am edwardloveall on github.
  • I am edwardloveall (https://keybase.io/edwardloveall) on keybase.
  • I have a public key ASBjhdBspYQMXOxIf1XZo_vcehWGHKY6GhcuTodDlQmFAgo

To claim this, I am signing this object:

@edwardloveall
edwardloveall / show.cr
Last active January 4, 2019 02:04
preload association
class Me::Show < BrowserAction
get "/me" do
follows = FollowQuery.new.preload_from.to_id(current_user.id)
render ShowPage, follows: follows
end
end
@edwardloveall
edwardloveall / example.cr
Last active January 1, 2019 22:16
follow form create! error
require "lucky_record"
class User < LuckyRecord::Model
table :users do
end
end
class UserQuery < User::BaseQuery
end
@edwardloveall
edwardloveall / create.cr
Last active December 31, 2018 16:04
Lucky Form error
class Follows::Create < BrowserAction
route do
existing_user = UserQuery.new.email(params.get(:email))
if existing_user
FollowForm.create!(from_id: current_user.id, to_id: existing_user.id)
flash.success = "Your invite has been sent to #{existing_user.email} for approval."
redirect to: Follow::New
end
end
end
class TimeThing
CONSTANT = 1.year.from_now
def method
1.year.from_now
end
end
while true
puts TimeThing::CONSTANT
Message
Model
new -> LocalOnly
LocalOnly*
save -> InFlight
Persisted
edit -> Edited
Edited
save -> InFlight
InFlight
success -> Persisted