Skip to content

Instantly share code, notes, and snippets.

View tarynsauer's full-sized avatar

Taryn Sauer tarynsauer

  • Madison, WI
View GitHub Profile

BEM Cheatsheet

Checklist:

  • Blocks are descriptive and independent of other class names.
  • Elements are semantically tied to a block.
  • Neither elements nor modifiers are “nested.”
  • In the CSS, block and element classes are defined independently.
  • Modifiers are only used for variation/flag purposes.
  • In the HTML, modifiers are only used alongside the original classes that they modify.
content = {
promo_message: "Blake's Favorite Brands:",
promo_code: "BLAKE10",
disclaimer: "Terms and conditions apply"
}
Cms::SellGiftCardsPage.new.save_page(content)
content = {
active: true,
display_promo: "false",
hero_bg: "https://s3.amazonaws.com/raise-cdn/marketing/shop-lp/background.jpg",
img_element: "",
title: "Shop top brands at great discounts",
subtitle: "Save on every purchase, big or small."
}
brands = [
content = {
active: true,
display_promo: "false",
hero_bg: "https://s3.amazonaws.com/raise-cdn/marketing/shop-lp/shop_merchants_vday_desktop.jpg",
img_element: "",
title: "Valentine's Deals",
subtitle: "Save on everything you love with Raise."
}
c = Cms::LandingPage.new('shop')
# This is how you define your own custom exception classes
class NoOrangesError < StandardError
end
class DeadTreeError < StandardError
end
class OrangeTree
attr_reader :age, :height, :oranges
# Git branch in prompt.
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
export PS1="\u@\h \W\[\033[32m\]\$(parse_git_branch)\[\033[00m\] $ "
describe MessageArchiver do
let(:message) { create_message }
it "archives messages outstanding for three months" do
MessageArchiver.archive_messages # message has not been invoked yet
expect(message.archived).to be_true
end
end
describe ApplicantInteractor do
let(:applicant) { Footprints::Repository.applicant.create( :name => "Bob", :applied_on => Date.current, :email => "test@test.com") }
describe ".update" do
it "updates the applicant" do
params = { :name => "John" }
ApplicantInteractor.new(applicant, params).update
expect(applicant.name).to eq("John")
end
end
(def apprentices [{:name "Taryn", :prev-duty "food", :av-count 3}
{:name "Tom", :prev-duty "av", :av-count 3}
{:name "LaToya", :prev-duty "chairs", :av-count 1}
{:name "Zach O", :prev-duty "greeter", :av-count 1}
{:name "Elizabeth", :prev-duty "food", :av-count 3}
{:name "Meagan", :prev-duty "av", :av-count 3}
{:name "Zach D", :prev-duty "chairs", :av-count 1}
{:name "Mike K", :prev-duty "greeter", :av-count 1}
{:name "Kyle", :prev-duty "av", :av-count 3}
{:name "Mike D", :prev-duty "chairs", :av-count 1}
(defn all-duties-assigned? [apprentices duties-list]
(loop [apprentices apprentices assigned-duties '()]
(if (empty? apprentices)
(= (sort (remove nil? assigned-duties)) (sort (conj duties-list foreman-assignment)))
(let [apprentice (first apprentices) apprentices (rest apprentices)]
(recur apprentices
(if-not (= (:assigned-to apprentice) nil)
(conj assigned-duties (:assigned-to apprentice))
assigned-duties))))))