Skip to content

Instantly share code, notes, and snippets.

View joshuapinter's full-sized avatar
🎯
Focusing

Joshua Pinter joshuapinter

🎯
Focusing
View GitHub Profile
@joshuapinter
joshuapinter / model.template.txt
Last active November 20, 2023 12:34
Rails Model Template
class [Your Class Here] < ActiveRecord::Base
##################################################################################################
### Attributes ###################################################################################
##################################################################################################
### Constants ####################################################################################
module ExternalResource
# Adds ability to use view helpers, like number_to_currency.
# e.g. @@view_context.number_to_currency( 2.48 )
@@view_context = ActionController::Base.new.view_context
# # Handles timeout and other issues for blocks requesting external resources.
# For example, when using nokogiri to scrape a site.
# Requires a block with the HTTPClient.get call or what-have-you
#
# @param [Hash] options Options for the timeout.
<%= “#{`git branch`.to_s.gsub(‘* ‘,”)} | #{Rails.env.upcase} |” unless Rails.env == ‘production’" %>