Skip to content

Instantly share code, notes, and snippets.

Avatar

John Athayde jathayde

View GitHub Profile
View attributable.rb
module Attributable
extend ActiveSupport::Concern
included do
has_many :attributions, as: :attributable
has_many :sources, through: :attributions
end
end
@jathayde
jathayde / issue_add.rb
Created Jan 24, 2020
Adding Issues seed style
View issue_add.rb
@l = Lodge.find_by_combined("12A")
@l.issue.create([
{
event: true,
category_id: '',
issue_type_id: ''.
issue_number: '',
variety: '',
View Keybase.md

Keybase proof

I hereby claim:

  • I am jathayde on github.
  • I am johnathayde (https://keybase.io/johnathayde) on keybase.
  • I have a public key whose fingerprint is 8F4A B2BA 3CE3 8A71 CEC2 C73E 8D82 E965 CF5F EEEC

To claim this, I am signing this object:

View gist:9cf6c1727e15b77607a05b72872dfeb2
(0.2ms) BEGIN
(0.1ms) COMMIT
(0.1ms) BEGIN
(0.2ms) SAVEPOINT active_record_1
User Exists (1.9ms) SELECT 1 AS one FROM "users" WHERE ("users"."id" IS NOT NULL) AND "users"."slug" = $1 LIMIT $2 [["slug", "jessika-mcglynn"], ["LIMIT", 1]]
User Exists (1.8ms) SELECT 1 AS one FROM "users" WHERE "users"."email" = $1 LIMIT $2 [["email", "reie@ziemann.info"], ["LIMIT", 1]]
User Exists (1.0ms) SELECT 1 AS one FROM "users" WHERE "users"."username" = $1 LIMIT $2 [["username", "Jessika McGlynn"], ["LIMIT", 1]]
User Exists (0.6ms) SELECT 1 AS one FROM "users" WHERE "users"."email" = $1 LIMIT $2 [["email", "reie@ziemann.info"], ["LIMIT", 1]]
SQL (0.9ms) INSERT INTO "users" ("email", "encrypted_password", "created_at", "updated_at", "username", "firstname", "lastname", "slug", "roles_mask") VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9) RETURNING "id" [["email", "reie@ziemann.info"], ["encrypted_password", "$2a$04$CZcmrXODtPxTI47klkAVweVdm1FDjI8fMqzXqObWeEg45O9.BM1E6"], ["created_at", "2018
View View call.erb
<% if user_signed_in? %>
<div id="follow_lodge">
<!-- does not work when uncommented, renders code as text inline -->
<%#= render 'follows_lodges/create.js' %>
<!-- does work, but then fails on url gen, which is seperate issue -->
<%= render partial: 'shared/follow_lodge', locals: {@issueable => @followable} %>
</div>
<% end %>
View factories-issues.rb
FactoryGirl.define do
factory :issue do
before(:each) do
@lodge_issue = FactoryGirl.create(:lodge_issue)
@issue = @lodge_issue.issue
end
transient do
combined_value nil
View factories-issues.rb
FactoryGirl.define do
factory :issue do
association :issueable, factory: :lodge
issue_number { Faker::Number.number(2) }
quantity_issued { Faker::Number.number(2) }
description 'Test description for test issue'
oa_bb_category_id '1'
category_id '1'
issue_type_id '1'
border_color_id '1'
@jathayde
jathayde / Rspec output
Created Oct 12, 2017
Rspec error on issue
View Rspec output
Failures:
1) Issue#ordered_issues issue_type abbreviation sorts in A, B, C order, then numerics ascending
Failure/Error: self.combined = "#{issue_type.abbreviation}#{issue_number}#{variety}"
NoMethodError:
undefined method `abbreviation' for nil:NilClass
# ./app/models/issue.rb:126:in `set_combined'
# ./spec/models/issue_spec.rb:109:in `block (4 levels) in <top (required)>'
# -e:1:in `<main>'
View keybase.md

Keybase proof

I hereby claim:

  • I am boboroshi on github.
  • I am johnathayde (https://keybase.io/johnathayde) on keybase.
  • I have a public key ASCJYNTZ9-UO2E4bjd2qMlEegaVqSTtq9fyyDnQbXAXPBAo

To claim this, I am signing this object:

@jathayde
jathayde / _mixin_verticalLoop.scss
Created Jul 13, 2016
A SCSS loop to combine verticals (product offerings) with icons and color backgrounds.
View _mixin_verticalLoop.scss
@mixin verticalLoop($vertical) {
$vertical-image-path: "#{$image-path-content}/icons/verticals/";
@each $color in color-black, color-white, color-honeycomb, color-clementine,
color-slushie, color-frosting, color-aloe, color-berry, color-wasabi,
color-grape, color-spice, color-wine, color-whale, color-honeycombLight,
color-clementineLight, color-slushieLight, color-frostingLight,
color-teaLight, color-berryLight, color-grapeLight, color-grayLightest,
color-grayLighter, color-grayLight, color-gray, color-grayDark,
color-grayDarker, color-grayDarkest {
&.vertical-icon {