Skip to content

Instantly share code, notes, and snippets.

View seancdavis's full-sized avatar

Sean C Davis seancdavis

View GitHub Profile
@seancdavis
seancdavis / Gemfile
Last active March 24, 2017 07:23
Related Content (without metadata) in Rails using tf-idf
gem 'htmlentities'
gem 'nokogiri'
@seancdavis
seancdavis / _post.html.erb
Last active September 27, 2018 11:31
rails scaffold that belongs to a Devise user model
<% # app/views/posts/_post.html.erb %>
<article>
<h2><%= post.title %></h2>
<!-- ... -->
</article>
@seancdavis
seancdavis / load_tasks.rake
Last active August 16, 2022 07:27
Automatically load rake tasks within namespaces based on directory structure within `lib/tasks` directory.
# lib/tasks/load_tasks.rake
# ------------
# Looks at every .rb file in the lib/tasks and adds them to rake within the
# namespace of their subdirectories
# ------------
# Important to note we are looking specifically for .rb files, so they
# aren't added to the global rake namespace
Dir.glob("#{Rails.root}/lib/tasks/**/*.rb").each do |file|
@seancdavis
seancdavis / zshrc
Last active January 24, 2024 17:10
zshrc file to work with `rbenv` and oh-my-zsh
# Path to your oh-my-zsh configuration.
ZSH=$HOME/.oh-my-zsh
# Set name of the theme to load.
# Look in ~/.oh-my-zsh/themes/
# Optionally, if you set this to "random", it'll load a random theme each
# time that oh-my-zsh is loaded.
# ZSH_THEME="alanpeabody"
# Example aliases