Skip to content

Instantly share code, notes, and snippets.

View nogtini's full-sized avatar

Joey Di Nardo nogtini

  • Virginia Beach, VA
View GitHub Profile
@nogtini
nogtini / css.ipynb
Created November 27, 2018 03:15 — forked from nealcaren/css.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@nogtini
nogtini / inset_input.css
Created May 13, 2019 13:42 — forked from nrrrdcore/inset_input.css
The Perfect Inset Input CSS
input {
height: 34px;
width: 100%;
border-radius: 3px;
border: 1px solid transparent;
border-top: none;
border-bottom: 1px solid #DDD;
box-shadow: inset 0 1px 2px rgba(0,0,0,.39), 0 -1px 1px #FFF, 0 1px 0 #FFF;
}
@nogtini
nogtini / carl_hewitt_actor_model.md
Last active June 15, 2019 01:48 — forked from rbishop/carl_hewitt_actor_model.md
Notes from Carl Hewitt on the Actor Model
@nogtini
nogtini / dci_alt.rb
Created June 24, 2019 15:21 — forked from elight/dci_alt.rb
DCI with delegation instead of extension
class User < ActiveRecord::Base
# ... lots of persistence stuff
end
class GitHubUserProvisioner < SimpleDelegator
def provision_with!(user_info, extra_user_hash)
self.github_login = extra_user_hash['login']
self.name = user_info['name']
self.email = user_info['email']
self.github_url = user_info['urls']['GitHub']
@nogtini
nogtini / capybara cheat sheet
Created July 2, 2019 22:16 — 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')
@nogtini
nogtini / rspec_model_testing_template.rb
Created July 6, 2019 22:03 — 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:
@nogtini
nogtini / after.rb
Created July 7, 2019 21:07 — forked from tomdalling/after.rb
Refactoring a controller action
class CommentsController
def create
result = CreateComment.call(params, @user)
if result.ok?
render :partial => "comments/postedreply", :layout => false,
:content_type => "text/html", :locals => { :comment => result.value }
else
case result.error.name
when :story_not_found
render :plain => "can't find story", :status => 400
@nogtini
nogtini / book.rb
Created July 20, 2019 19:40 — forked from sirupsen/book.rb
Script to import books from Instapaper to Airtable. Will not work out of the box.
class Book < Airrecord::Table
class Endorser < Airrecord::Table
self.base_key = ""
self.table_name = "Endorser"
end
self.base_key = ""
self.table_name = "Books"
has_many :endorsements, class: 'Book::Endorser', column: 'Endorsements'
@nogtini
nogtini / rspec-cheat-sheet.md
Created August 2, 2019 19:56 — forked from pdmholden/rspec-cheat-sheet.md
RSpec Cheat Sheet

This is a cheat sheet for RSpec, including its methods, and test doubles. It also includes FactoryGirl methods, even though that is separate from RSpec. This cheat sheet is based on Rails 4 Test Prescriptions by Noel Rappin (the best of a bad lot when it comes to RSpec books) and the RSpec documentation published on Relish. RSpec documentation is generally not very good, which is why I created this cheat sheet for myself.

General

Stubs

@nogtini
nogtini / README.md
Created August 14, 2019 01:33 — forked from randito/README.md
(Simplified) Example README for a DCI Ruby project in the works

Note: This version is a simplified version of this gist; it removes all the unnecessary features (like validations, required parameters, etc).

Data, Context, and Interaction

DCI is a modeling pattern by Trygve Reenskaug, creator of MVC, that is a replacement of sorts for typical OOP.