Skip to content

Instantly share code, notes, and snippets.

View dedemenezes's full-sized avatar

André Menezes dedemenezes

View GitHub Profile
@trouni
trouni / stimulusjs_cheatsheet.md
Last active November 20, 2023 13:14
Stimulus.js Cheatsheet

Cheat Sheet: Using Stimulus.js in Rails

Create and Connect a Stimulus Controller

  1. Create a new Stimulus controller file, either:
  • with rails g stimulus my_feature, or
  • by manually adding a file in the controllers directory of your Rails application, e.g., app/javascript/controllers/my_feature_controller.js.
  1. The controller file should define your Stimulus controller class:
@dedemenezes
dedemenezes / index.html
Created April 5, 2022 22:57
Dom & Events Lecture
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="style.css">
<title>Playground - JavaScript 101</title>
</head>
<body>
@trouni
trouni / rails_partials_tips.md
Last active November 20, 2023 13:17
Rails Partials Tips

Rails Partials Pro Tips

Best practices to keep you Rails views tidy and your components smart.

Pro Tip #1 💡 When should you use a partial?

Think in terms of component. Can those few lines be reused somewhere else in your application? If the answer is yes, it should be in a partial.

Reading and Writing to CSV files in Ruby

These are the very basics of reading and writing to CSV files in Ruby. For more details and other available options consider checking out the full documentation: here


Consider a given csv file scientists.csv with the following content:

@ryansobol
ryansobol / gist:5252653
Last active February 23, 2025 06:28
15 Questions to Ask During a Ruby Interview

Originally published in June 2008

When hiring Ruby on Rails programmers, knowing the right questions to ask during an interview was a real challenge for me at first. In 30 minutes or less, it's difficult to get a solid read on a candidate's skill set without looking at code they've previously written. And in the corporate/enterprise world, I often don't have access to their previous work.

To ensure we hired competent ruby developers at my last job, I created a list of 15 ruby questions -- a ruby measuring stick if you will -- to select the cream of the crop that walked through our doors.

What to expect

Candidates will typically give you a range of responses based on their experience and personality. So it's up to you to decide the correctness of their answer.

@amejiarosario
amejiarosario / rails_migration_cheatsheet.md
Created June 18, 2012 21:40
Rails Migration - Cheatsheet