Skip to content

Instantly share code, notes, and snippets.

View SViccari's full-sized avatar

Stephanie Viccari SViccari

View GitHub Profile
@SViccari
SViccari / intersections_and_unions_and_discriminated_unions.md
Created March 25, 2019 22:34
Intersections and Unions and Discriminated Unions, Oh My!

Intersection Type

An Intersection Type takes two objects and creates a new object that combines the features of both objects.

Below is an example where we create an Intersection Type (ShapeProps) which combines all the properties defined for Square, Rectangle and Circle.

interface Square {
 kind: "square";
@SViccari
SViccari / git-tips.md
Last active April 7, 2019 19:47
Git Tips

In the example below, we will:

  • update our local master branch to include the latest changes in GitHub's master branch
  • create a new branch to make code changes. We'll call this branch my-new-branch.
  • save code changes as commits on my-new-branch
  • share my-new-branch with GitHub (with the intent of opening a PR)
  • use git's rebase feature to reduce the number of commits to one commit (this is often referred to as squashing commits)

Example Workflow

Update Master to pull in any recent changes

@SViccari
SViccari / button-vs-link.md
Last active May 20, 2019 15:37
Button Vs Link - A11Y
@SViccari
SViccari / csv_generator.rb
Created September 25, 2019 18:28
Generate CSV data
class CsvGenerator
def initialize(file_name, collection)
@file_name = file_name
@collection = collection
@columns = []
end
def register_column(column_header, &block)
columns << Column.new(column_header, block)
end
@SViccari
SViccari / double_vs_instance_double.rb
Last active October 24, 2019 16:24
RSpec Double vs Instance Double
# RSpec Double vs Instance Double
# stub FeatureToggle using a double
def stub_feature_toggle_using_double
double(FeatureToggle, on?: true).tap do |feature_toggle|
allow(FeatureToggle).to receive(:new).and_return(feature_toggle)
end
end
# In the above example, we're stubbing out the response for "on?".
@SViccari
SViccari / rails-info-routes.md
Last active December 8, 2019 22:16
TIL - view rails routes in browser

To view (locally) all routes for a rail's app, visit:

localhost:3000/rails/info/routes
@SViccari
SViccari / ruby-unary-binary-operators.md
Created May 21, 2020 13:12
Ruby's Unary and Binary Operators

Ruby Unary and Binary operators

Ruby Unary Operators include: + - ~ ! * & !!

An Unary operator requires a single value to perform an operation. Examples:

The Integer unary minus operator - states the integer is a negative integer.

-5
# revise the MedicationReconciliationCreator class
# to use the newly introduced NdcIdFormatter
class MedicationReconciliationCreator
# existing code to build a reconciled medication
def formatted_ndc_id(ndc_id)
NdcIdFormatter.format(ndc_id)
end
@SViccari
SViccari / inclusivity-slackbot-responses.md
Created July 15, 2020 21:53
Slackbot Responses for Inclusivity

When someone says...

hey guys, hi guys, hey guyz, hi guyz, hey dudes, hi dudez, hey dudez, hi dudez, hey bros, hi bros, hey brahs, hi brahs, hey broz, hi broz, dudebros, bros, dudes, guys, brahs, you guys, you dudes, sup dudes, sup bros, sup brahs, sup guys, sup dudez

Slackbot responds...

May I suggest “everyone”? It's more gender-inclusive. May I suggest “all”? It's more gender-inclusive. May I suggest “people”? It's more gender-inclusive. May I suggest “y’all”? It's more gender-inclusive.

@SViccari
SViccari / basic_setup.md
Last active July 26, 2021 19:58
Machine Customizations