Skip to content

Instantly share code, notes, and snippets.

Avatar

Dan M dan987

View GitHub Profile
@dan987
dan987 / good_practices.md
Last active Nov 7, 2019
Common practice guideline: Guidelines and concepts. Reference to common patterns can be found all over the web.
View good_practices.md

100% of these suggestions are based on recent & relevant real world experience. We have, at least at one point, tried to use these patterns on our own & witnessed how the decision played out over years in production.

General Concepts

View audited.rb
module Audited
class Audit
alias_method :after_save, :save
# NOTE: Hack fix checking for changes, still not sure why its triggering 2x
def save(*_args)
unless self.auditable.changed? # better way to get this not to fire 2x?
self.created_at ||= Time.current
conrtl = Audited.store[:current_controller]
if conrtl
@dan987
dan987 / newrelic_instrumenter.rb
Created Jul 12, 2018 — forked from nettofarah/newrelic_instrumenter.rb
sample newrelic instrumenter for graphql-ruby
View newrelic_instrumenter.rb
# NewRelic instrumenter for GraphQL-ruby
#
# In your controller:
# ::NewRelic::Agent.add_custom_attributes({
# user_id: @user.try(:id),
# query_string: @query_string,
# query_arguments: @query_variables
# })
#
# @document = self.class.trace_execution_scoped(["GraphQL#parse"]) do
View essential-javascript-links.md
View pr.md

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

View githubintro.sh
# We created a folder to house our code for the class
mkdir code
# We changed into that directory
cd code
# We verified git was installed
which git
# After forking on github, we cloned OUR copy
git clone https://github.com/StevenNunez/BEWD_NYC_5.git
# We checked what folders are in our code folder. Cloning creates a folder named after the repository.
ls
You can’t perform that action at this time.