I have moved this over to the Tech Interview Cheat Sheet Repo and has been expanded and even has code challenges you can run and practice against!
\
This file contains 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
# Copyright (c) 2023 Facenapalm | |
# | |
# Permission is hereby granted, free of charge, to any person obtaining a copy | |
# of this software and associated documentation files (the "Software"), to deal | |
# in the Software without restriction, including without limitation the rights | |
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
# copies of the Software, and to permit persons to whom the Software is | |
# furnished to do so, subject to the following conditions: | |
# | |
# The above copyright notice and this permission notice shall be included in all |
This file contains 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
#!/usr/bin/env ruby | |
require 'sqlite3' | |
path = File.expand_path("~/Library/Messages/chat.db") | |
db = SQLite3::Database.new path | |
db.results_as_hash = true | |
r = db.execute(%{SELECT chat.display_name, chat.ROWID FROM chat | |
WHERE chat.display_name IS NOT NULL AND |
This file contains 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
@next_upgrade ||= false | |
source 'https://rubygems.org' | |
if @next_upgrade | |
gem 'rails', '6.0.0.rc2' | |
else | |
gem 'rails', '~> 5.2.0' | |
end | |
# rest of gems below .... |
This file contains 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
# /app/helpers/devise_helper.rb | |
module DeviseHelper | |
def devise_error_messages! | |
return '' if resource.errors.empty? | |
messages = resource.errors.full_messages.map { |msg| content_tag(:li, msg) }.join | |
sentence = I18n.t('errors.messages.not_saved', | |
count: resource.errors.count, | |
resource: resource.class.model_name.human.downcase) |