This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Here are my notes on getting the codebase to work on the new M1 processors: | |
Upgrade the Ruby version to 2.7.2. You may need to set some compiler flags such as: | |
RUBY_CFLAGS=-DUSE_FFI_CLOSURE_ALLOC rbenv install 2.7.2 | |
Update all gems with 'bundle update' | |
Modify the Gemfile to detect the new hardware: | |
if RUBY_PLATFORM =~ /arm64.*darwin/ && `sysctl -n machdep.cpu.brand_string` =~ /M1/ | |
# Get things to compile for Apple Silicon - minimum Ruby version of 2.7.2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
::Counties = { | |
AK: [ | |
"Aleutians East Borough", | |
"Aleutians West Census Area", | |
"Anchorage, Municipality of", | |
"Bethel Census Area", | |
"Bristol Bay Borough", | |
"Denali Borough", | |
"Dillingham Census Area", | |
"Fairbanks North Star Borough", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
a[href*="//unsplash.com"] { | |
background-color: transparent !important; | |
color: black !important; | |
font-size: 10px !important; | |
svg { | |
height: 10px !important; | |
fill: black !important; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
::Countries = { AF: "Afghanistan", | |
AL: "Albania", | |
DZ: "Algeria", | |
AS: "American Samoa", | |
AD: "Andorra", | |
AO: "Angola", | |
AI: "Anguilla", | |
AQ: "Antarctica", | |
AG: "Antigua and Barbuda", | |
AR: "Argentina", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Usage: | |
# short_time_in_words(Time.now, 5.seconds.ago) # => "5s" | |
# short_time_in_words(Time.now, 5.minutes.ago) # => "5m" | |
# short_time_in_words(Time.now, 5.hours.ago) # => "5h" | |
# short_time_in_words(Time.now, 55.hours.ago) # => "2d" | |
# | |
def short_time_in_words(from_time, to_time) | |
from_time = from_time.to_i |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ActionMailer::Base | |
def dmarc(email) | |
domain = email.split('@')[1] | |
dmarc_domain = "_dmarc.#{domain}" | |
Resolv::DNS.open do |dns| | |
records = dns.getresources(dmarc_domain, Resolv::DNS::Resource::IN::TXT) | |
records.empty? ? nil : records.map(&:data).join(" ") | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
::States = { AK: "Alaska", | |
AL: "Alabama", | |
AR: "Arkansas", | |
AS: "American Samoa", | |
AZ: "Arizona", | |
CA: "California", | |
CO: "Colorado", | |
CT: "Connecticut", | |
DC: "District of Columbia", | |
DE: "Delaware", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "net/https" | |
require "uri" | |
require "date" | |
ACCOUNT_ID = "000000" | |
APP_ID = "000000000" | |
API_KEY = "0000000000000000000000000000000000000000" | |
yesterday = (Date.today.to_time - 1).strftime("%Y-%m-%d") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SHOPIFY_API_KEY = 'my-key' | |
SHOPIFY_PASSWORD = 'my-pass' | |
STORE_NAME = 'my-store' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class SportStatistic | |
include Mongoid::Document | |
end | |
class AthleteStatistic < SportStatistic | |
end | |
class SoccerAthleteStatistic < AthleteStatistic | |
field: goals |
NewerOlder