Skip to content

Instantly share code, notes, and snippets.

@raghubetina
raghubetina / implicit_order_column.md
Last active August 4, 2019 17:44
implicit_order

Rails 6's implicit_order_column is great but wouldn't it be even more great if it worked for more than just finders (e.g. first, last)? It's reasonable to expect, after declaring an implicit order column, for it to also be in effect when using other methods (e.g. all, take, pluck, each, associations) — but it is not.

IMO default_scope is not really a substitute, either, unless you want everyone else to always have to remember to call .reorder if a different order is needed. In my view, scope is more of a filtering thing than an ordering thing anyway, and I always wish there had been an analogous order macro.

I think implicit_order is needed (taking a block, not just a column name, so that direction or joins, etc, can be specified). As soon as a different .order is called, this one should be dropped entirely.

Keybase proof

I hereby claim:

  • I am raghubetina on github.
  • I am raghubetina (https://keybase.io/raghubetina) on keybase.
  • I have a public key ASB_JSLwX9Zaw9HorSyDjoJAvvsLqDG7qjb6cQMeHtZN3Qo

To claim this, I am signing this object:

@raghubetina
raghubetina / markdown_essentials.md
Last active March 11, 2024 06:21
Markdown Essentials

Markdown Essentials

Here are the parts of markdown that I use most often.

For each example, the markdown code is shown first, and the rendered result is shown below.

Strong/bold

Surround with **two asterisks for strong/bold**.
@raghubetina
raghubetina / circleci-setup.md
Last active November 29, 2018 16:51
CircleCI 2.0 Setup

CircleCI Setup

  • Add gem "rspec_junit_formatter" to test group.
  • Sample configuration in .circleci/config.yml:
# Ruby CircleCI 2.0 configuration file
#
# Check https://circleci.com/docs/2.0/language-ruby/ for more details
#
@raghubetina
raghubetina / feedback_services.md
Last active August 31, 2018 15:47
Feedback services to install in your app

In general, we don't want to have to rely on users to actively provide error reports or other feedback. Most users won't bother to report errors or slowness, they'll just quit. Instead, we want to automatically log as much as we can.

  • Most importantly, automatic exception tracking. If there's ever an actual 500 exception (as opposed to a 404 or some other "tolerable" error), we want it to be automatically logged with as much detail as possible.

    We don't want a user to have to report it, then try to figure out how to duplicate it, then watch the heroku logs to find out what happened (since usual error messages don't appear in the browser in production mode).

    There are many exception monitoring services available. I usually start with Rollbar, as it has a decent free tier. Try reading the docs and installing it:

    https://rollbar.com/

@raghubetina
raghubetina / gitconfig.local
Last active April 27, 2024 14:56
Git aliases
# ~/dotfiles-local/gitconfig.local
[alias]
aa = !git add -A
cm = !git commit
cmm = !git commit -m
p = !git push
l = !git add -A && git commit -m "WIP"
lp = !git add -A && git commit -m "WIP" && git push
@raghubetina
raghubetina / firstdraft_design_guidelines.md
Last active March 23, 2018 03:09
firstdraft Design Guidelines

firstdraft Design Guidelines

the most ridiculous design document ever written

by the least qualified person ever

Use Font Awesome 5.

  • Our brand is in it.
  • We have a multi-app Pro license.
@raghubetina
raghubetina / code_review_workflow.md
Created February 5, 2018 18:05
Code Review Workflow

Code Review workflow

  • Open a PR
  • Request review in #review-requests. If you need a specific person's feedback, @mention them.
  • Even if you aren't specifically mentioned, try to look at every PR at least briefly — remember that Code Review is about knowledge-sharing/asking-questions more than catching bugs.
  • If you haven't watched it recently, watch Derek's talk again: https://www.youtube.com/watch?v=PJjmw9TRB7s
  • If you haven't watched it recently, watch Ben and Joe's video again: https://thoughtbot.com/upcase/videos/tips-for-code-review
  • If you haven't gone through it recently, remind yourself about the Git Workflow again: https://thoughtbot.com/upcase/videos/git-thoughtbot-git-flow
  • I've currently set frequently used repos to post PR comments to #review-requests. (Is this too much noise?)
  • If you've been waiting for feedback and the lack of feedback is blocking you, re-request (with @mentions).
1, Create a new public blank workspace
2, Enable AutoSave in Preferences -> Auto-Save
3, Install formathtmlerb
- Install gem install htmlbeautifier
4, Install Rubysnippets
5, Install formatruby
- Install gem install formatruby
5, Manually install manual
https://github.com/wting/autojump
6, Add railsrc
@raghubetina
raghubetina / dsgn425_waiver.md
Last active February 7, 2020 22:37
Should I waive DDII?

Should I waive DDDII?

So you've done some programming in the past, and are wondering whether you should waive DDDII.

Here are some reasons that students in the past have still found it worthwhile:

  • A primary focus of the course is familiarizing future managers with modern software development workflows, mostly centering around GitHub: version control, pull requests, code reviews, continuous integration, automated deployment, project management, etc. If you don't already have a solid process in place, then it might be worth seeing this one.
  • If you haven't built full-stack applications in the past, particularly with Ruby on Rails — it's just a joy. In the past, students who already knew how to program but had never done full-stack applications from soup to nuts got even more out of the class than beginners, because agile web development with Rails is like a superpower.
  • You're welcome to outpace the rest of the class and work on your own advanced projects, with guidance from me and the TAs.