# In your Gemfile
gem "localhost"
# Then, depending on your desired server
gem "falcon"
gem "puma"
# frozen_string_literal: true | |
# config/initializers/colorized_logger.rb | |
# This initializer adds color to the Rails logger output. It's a nice way to | |
# visually distinguish log levels. | |
module ColorizedLogger | |
COLOR_CODES = { | |
debug: "\e[36m", # Cyan | |
info: "\e[32m", # Green | |
warn: "\e[33m", # Yellow |
options = { :body => | |
{ :username => 'my', | |
:password => 'password' | |
} | |
} | |
results = HTTParty.post("http://api.topcoder.com/v2/auth", options) | |
## | |
## example for post with papertrail and basic auth | |
## |
class MedicalRecord < ApplicationRecord | |
enum kind: %i[ imaging results notes ] | |
belongs_to :patient, class_name: "User", inverse_of: :medical_records | |
has_one_attached :document, dependent: :detach | |
scope :with_kind, -> (kind) { where kind: kind } | |
after_create_commit :deliver_updation |
# Example of using SQLite VSS with OpenAI's text embedding API | |
# from Ruby. | |
# Note: Install/bundle the sqlite3, sqlite_vss, and ruby-openai gems first | |
# OPENAI_API_KEY must also be set in the environment | |
# Other embeddings can be used, but this is the easiest for a quick demo | |
# More on the topic at | |
# https://observablehq.com/@asg017/introducing-sqlite-vss | |
# https://observablehq.com/@asg017/making-sqlite-extension-gem-installable |
# Creating a complex hash, with nested keys | |
my_complex_hash = { | |
users: [ | |
{name: "Yukihiro Matsumoto", age: 57}, | |
{name: "Kabosu the Shiba Inu", age: 16}, | |
{name: "Thiago Massa", age: 33} | |
] | |
} |
This challenge tests if you can locate the cause of a Rails issue in 5 iterations (script execution). Although it's a Rails issue, prior knowledge on Rails is not required.
The 5 iterations limit may feel constraining, but it is intentional. If you can't locate the cause within the limitation, that's totally fine.
After the challenge, there's a simple questionnaire. If you can answer the questions, it'll help me prepare my talk for RubyKaigi. Any feedback will be appreciated 🙏
I recommend allocating 1.5 hr for the challenge and the questions
accounts: | |
"192912639870": {} # ccsandbox | |
account-blocklist: | |
- "192912699999" | |
resource-types: | |
excludes: | |
- IAMGroup | |
- IAMGroupPolicy |
This gist aims to provide a simple solution for managing Heroku Review Apps with GitHub Actions due to the security incident that continues to disrupt Heroku's GitHub integration. Watch the demo to learn more.
.github
├── workflows
│ ├── heroku_review_app_create.yml
const curry = (fn, arity = null) => { | |
const realArity = fn.length; | |
const providedArity = arity === null ? realArity : | |
(arity > realArity ? realArity : arity); | |
return (...args) => { | |
const argsUsed = args.length > providedArity ? providedArity : args.length; | |
const finalFn = fn.bind(this, ...args.slice(0, argsUsed)); | |
return realArity === argsUsed ? finalFn() : curry(finalFn); |