Skip to content

Instantly share code, notes, and snippets.

@johnreitano
johnreitano / product.html
Created August 27, 2024 16:46
Example product
This file has been truncated, but you can view the full file.
<!doctype html>
<html lang="en-us" class="a-no-js" data-19ax5a9jf="dingo"><!-- sp:feature:head-start -->
<head>
<script>var aPageStart = (new Date()).getTime();</script>
<meta charset="utf-8"/>
<!-- sp:end-feature:head-start -->
<!-- sp:feature:csm:head-open-part1 -->
<script type='text/javascript'>var ue_t0 = ue_t0 || +new Date();</script>
<!-- sp:end-feature:csm:head-open-part1 -->
@johnreitano
johnreitano / ten_letter_words.rb
Last active October 6, 2023 14:31
ten_letter_words.rb
def words_with_ten_unique_letters
words = []
IO.foreach("/usr/share/dict/words", chomp: true).each do |line|
words << line if ten_letter_word?(line) && unique_chars?(line)
end
words
end
def ten_letter_word?(str)
str =~ /\A[A-Za-z]{10}\z/
@johnreitano
johnreitano / histogram.rb
Last active September 8, 2023 00:02
histogram
#!/usr/bin/env ruby
def histogram(prompt)
words = valid_words_from_prompt(prompt)
normalized_histogram(words)
end
def words_from_prompt(prompt)
prompt.downcase.split(/[^A-Za-z]/).reject(&:empty?)
end
@johnreitano
johnreitano / setup-vscode-for-ruby-dev.md
Last active September 6, 2022 02:52
Set up VSCode for ruby development
  1. Install VSCODE plugins
  • Ruby by Peng Lv
  • Ruby on Rails by Hirdoy
  • Ruby Solargraph
  • ruby-rubocop
  • ERB Formatter/Beautify
  1. Add gems linkes to Gemfile, under group :development, :test:
gem "htmlbeautifier", require: false
@johnreitano
johnreitano / readme.md
Created June 19, 2021 22:12 — forked from benstr/readme.md
Gist Markdown Cheatsheet

#Heading 1 ##Heading 2 ###Heading 3 ####Heading 4 #####Heading 5 ######Heading 6


Paragraph

variable "resource_group_name" {
type = "string"
}
variable "location" {
type = "string"
}
variable "client_id" {
type = "string"
}
#!/usr/bin/env bash
# set -x
set -e # exit on error
if [[ "$1" == "init" ]]; then
export AZ_USERNAME=john.reitano@tenh.com
export PUBLIC_URL=laravel5.oktryme.com
export DOCKER_REPOSITORY_PREFIX=johnreitano
export ARM_SUBSCRIPTION_ID=47fc4d39-6211-4d95-8ea2-fe7b8ef486ec # TENNESEE STEEL HAULERS
export ARM_TENANT_ID=ad551ed1-0acc-4928-94b2-847d98bf009f # TENNESEE STEEL HAULERS

Keybase proof

I hereby claim:

  • I am johnreitano on github.
  • I am johnreitano (https://keybase.io/johnreitano) on keybase.
  • I have a public key ASAYjXDCScT7XJGtObWnI-KtyogKPjHOEVU9EsSEphU76go

To claim this, I am signing this object:

CUSTOMER_ATTRIBUTES = [ :auto_recharge_amount, :assigned_agent_id, :carrier_account_number, :balance ].freeze
CUSTOMER_ATTRIBUTES.each { | attr_name | attr_accessor attr_name }
attr_accessor :do_not_initialize_fields, :coupon_code, :payment_method, :selectable_face_amount
named_scope :agent_purchases_and_agent_refunds, { :conditions => { :order_type => [ "Agent Purchase", "Agent Refund" ] } }
named_scope :recently_created, lambda { | time_period | { :conditions => { :created_at_gte => ( Time.zone.now - time_period ) } } }
PAID_STATUSES = [ "Being Fulfilled", "Completed" ].freeze
UNPAID_STATUSES = [ "Being Authorized", "Being Reviewed", "Being Captured", "Being Canceled", "Canceled" ].freeze
STATUSES = PAID_STATUSES + UNPAID_STATUSES
class Order < ActiveRecord::Base
belongs_to :beneficiary, :polymorphic => true
belongs_to :initiating_user, :class_name => "User"
belongs_to :benefiting_agent, :class_name => "Agent"
belongs_to :credit_card
belongs_to :coupon
belongs_to :refunded_order, :class_name => "Order"
has_many :refunds, :class_name => "Order", :foreign_key => "refunded_order_id", :before_add => :set_refund_fields, :dependent => :destroy
has_many :balance_transfers, :before_add => :set_balance_transfer_fields, :dependent => :destroy
belongs_to :primary_order, :class_name => "Order", :foreign_key => "primary_order_id"