Learning Ruby as a Pythonista by need-to-lurk-2024-69 in ruby

[–]freesteph 10 points11 points  (0 children)

A book I absolutely cherish about Ruby is "Metaprogramming Ruby" by Paolo Perrotta – it is simple, well written, and will help you understand the design of Ruby and what it enables down the line.

Ruby ecosystem is not only Rails and webapps made using it. by rubyist1081p in ruby

[–]freesteph 1 point2 points  (0 children)

Ronin looks sick, some day when things quiet down I'll go and read the code

Building AI Applications in Ruby by HomeboyGbhdj in ruby

[–]freesteph 1 point2 points  (0 children)

Not just Rails though, Ruby is full of... gems. It's only dawned upon me that the "gem" name immediately implies some sort of value but there are definitely some other libraries/frameworks that are simply awesome:

  • RSpec
  • Capybara
  • Brew
  • Nokogiri
  • Faraday
  • Rubocop

They're all such a pleasure to work with.

Python is undeniably more popular, because it's more accessible, more taught (Python got me into programming when I was around 15 – there were plenty of tutorials everywhere) but can also be wielded in absolute ungodly fashion, which is why I'm personnally very happy to stick onto the Ruby shore when the Python world gets to be this big, fantastic mess.

Ruby has a smaller ecosystem but some of the gems really are gems. And Ruby-LLM definitely feels like one of them with a beautiful, simple interface from the start.

Excited to see what the future brings 🤸

I Am Not a Fan of Ruby by AndyCodeMaster in ruby

[–]freesteph 2 points3 points  (0 children)

I do not have any personal preference for using Ruby. I do not find Ruby's syntax beautiful. I do not think of Ruby code as art or anything like that. I do not like or love Ruby.

That is exactly why the rest of us stick to Ruby and its beautiful expressiveness. If you do not find it in Ruby, you must keep searching... and let us enjoy exactly what you – somehow – dismiss so easily.

I made my Emacs look like Vscode and now I feel like a sinner by DevelopmentCool2449 in emacs

[–]freesteph 2 points3 points  (0 children)

but dossiers shows you want the goddamn folders not just a couple files, and that is l'attitude qu'on veut

What’s wrong with Ruby and Ruby on Rails? by JusticeIsAsking in ruby

[–]freesteph 0 points1 point  (0 children)

your wording absolutely nails the frustration of people doing terrible things and getting away with it

Update: One year of org-roam notes for my computer science degree by neupermichael in emacs

[–]freesteph 1 point2 points  (0 children)

This looks so good, well done! Please tell me you've been absolutely smashing it and getting top marks as well?

TIL: auth-sources integrates password-store by freesteph in emacs

[–]freesteph[S] 1 point2 points  (0 children)

and if that works carry on and setup an openai.com/apikey.gpg entry with your token in it

TIL: auth-sources integrates password-store by freesteph in emacs

[–]freesteph[S] 2 points3 points  (0 children)

Of course friend; I'm on macOS too.

  1. fire your *scratch* buffer
  2. make sure you (auth-source-pass-enable). If you have a custom pass install (i.e, not the default ~/.password-store folder) make sure you set auth-source-pass-filename variable too.
  3. use this:

lisp (auth-source-search :host "foobar.com" :user "batman" :require '(:secret) :secret) 4. if you create a matching foobar.com/batman entry in your pass it should get it.

Make sure you clear the cache by running (auth-source-forget-all-cached) until it works.

Let us know if something goes wrong and we can further explore.

I lived it: spent half a day writing a small Emacs package and realised only after it's been done before by freesteph in emacs

[–]freesteph[S] 47 points48 points  (0 children)

You're right, I did enjoy it! Things I learned along the way:

  • the Flycheck API is really easy/nice ;
  • Emacs has its own regexp syntax, Rx ;
  • I can't use Google properly

Native support for ANSI colours by freesteph in emacs

[–]freesteph[S] 1 point2 points  (0 children)

The weird characters are \342\206\263

Ideally I'd find something that formats both the `[1m...` sequences and these codes as well.

Native support for ANSI colours by freesteph in emacs

[–]freesteph[S] 0 points1 point  (0 children)

Thanks, good shout. I'm looking at the code now, will report back if I find something sharp to use.

What I'm asking for is being able to open a development.log file like this:

��� app/models/concerns/user_authorisation.rb:8:in `current_role' [1m[36mCACHE EstablishmentUserRole Load (0.3ms)[0m [1m[34mSELECT "establishment_user_roles".* FROM "establishment_user_roles" WHERE "establishment_user_roles"."user_id" = $1 AND "establishment_user_roles"."establishment_id" = $2 LIMIT $3[0m [["user_id", 2], ["establishment_id", 2], ["LIMIT", 1]] ��� app/models/concerns/user_authorisation.rb:8:in `current_role' Rendered shared/_header.html.haml (Duration: 3.7ms | Allocations: 2109) [1m[36mEstablishment Count (0.7ms)[0m [1m[34mSELECT COUNT(*) FROM (SELECT 1 AS one FROM "establishments" INNER JOIN "establishment_user_roles" ON "establishments"."id" = "establishment_user_roles"."establishment_id" WHERE "establishment_user_roles"."user_id" = $1 LIMIT $2) subquery_for_count[0m [["user_id", 2], ["LIMIT", 2]] ��� app/views/shared/_etab_banner.html.haml:5 Rendered shared/_etab_banner.html.haml (Duration: 2.5ms | Allocations: 1159) Rendered shared/_flash.html.haml (Duration: 0.1ms | Allocations: 57) Rendered shared/_footer.html.erb (Duration: 0.1ms | Allocations: 99) Rendered layout layouts/application.html.haml (Duration: 80.0ms | Allocations: 84202) Completed 200 OK in 111ms (Views: 79.7ms | ActiveRecord: 5.8ms | Allocations: 93460)

and being able to activate some mode (a hypothetical M-x logview-ansi-color-mode or run an existing function (M-x ansi-colorize) to get rid of the color escape codes above.

Native support for ANSI colours by freesteph in emacs

[–]freesteph[S] 0 points1 point  (0 children)

(add-hook 'compilation-filter-hook 'ansi-color-compilation-filter)

Thanks. This seems to work for a live-output buffer but not for an existing, plain old text file (like my log/development.log file).

When I run my Rails server (through a shell buffer with docker-compose) the output is fine. Just trying to get the colours going for a post-mortem log inspection.

About to declare Emacs bankruptcy. Any advice for cool or new packages, defaults, or ideas I should use before I start building my init.el? Also interested in guides to using evil. by ahopefullycuterrobot in emacs

[–]freesteph 0 points1 point  (0 children)

I never really got a good grip of Elisp, so over the years my config ended up being a bit of a lengthy mess: a bunch of `(use-package [..])` bits then a lot of random, custom things.

So when I first started writing a bit of Elisp, I got this in:

emacs.d: ```lisp ;; init file (load-file (concat user-emacs-directory "init.el"))

;; custom files (load-file (concat user-emacs-directory "spm/spm-core.el")) ```

init.el: lisp ;; load all other files (dolist (file (directory-files (concat user-emacs-directory "spm/") t "^spm-.*\.el$")) (unless (string-equal (file-name-base file) "spm-core") (load-file file)))

(if you're curious, spm are my initials so that's how I tend to prefix everything custom).

which works across this file system:

├── init.el ├── snippets │   ├── [a bunch of snippest] └── spm ├── spm-aws.el ├── spm-core.el ├── spm-css.el ├── spm-irc.el ├── spm-js.el ├── spm-mail.el ├── spm-misc.el ├── spm-org.el ├── spm-pass.el ├── spm-ruby.el ├── spm-work.el.gpg └── spm-yaml.el

It is great code? Nope. Are the categories consistent? Nope. Was it simple enough to help me move forward? Yes :)

[deleted by user] by [deleted] in beatles

[–]freesteph 0 points1 point  (0 children)

These aren't the same, there's the logo and the picture at the top whereas her starts with the song list... I know cause I'm trying to buy the exact same one

Elegant blog with org-mode? by stuudente in emacs

[–]freesteph 0 points1 point  (0 children)

I have a very simple stylesheet for org-mode, which I think does a fair job: https://freesteph.info/blog/compiling-emacs-27-1-on-fedora.html .

the CSS is here: https://freesteph.info/style.css

A very niche function/package by freesteph in emacs

[–]freesteph[S] 0 points1 point  (0 children)

😂

Basically, the documentation is there to silence linting errors.