Skip to content

Instantly share code, notes, and snippets.

View ecoologic's full-sized avatar

Erik ecoologic

View GitHub Profile
@ecoologic
ecoologic / meditation.md
Last active October 2, 2022 00:20
Meditation Checklist

Meditation

It's practically an all-purpose training of the mind.

Meditation has the objects of stable attention and mindfulness (sati in pali), the latter being the optimal interaction between attention and peripheral awareness.

The practice consists in listening to the meditation object (the breath). Whenever you realise the mind wondered off, you happily move back to the meditation object. That's it, everything else are techniques to remove the time you're not following the meditation object.

Advantages Explained

Design Patterns

  • Value: (read-only) does some math or manipulation with one input value, like a model, but for one value only
  • Presenter: (read-only) takes complex data, like different models, and provides extra presentation values, even HTML
  • Service: (mainly-write) Has a main method that writes data through delegation, and can expose the results as read-methods (eg: errors)
  • Query: (read-only) Joins different models and performs SQL queries on them, ideally through SQL views
  • Gateway: (read-write) LIB Wrap of an API (lib: favour primitives, don't depend on app)
  • Serializer: (read-only) Converts input to a string like JSON, CSV, PDF blob etc (prefer others)
  • Parser: (read-only) convert data from one format to another (prefer others)
  • Decorator: (read-only) extends an object with extra value otherwise written in a presenter (prefer others)

Shortcuts

Terminator

Next Window: ctrl+pgDown Reset terminal: ctrl+shift+g

RubyMine (default keymap - rsome emapping)

  • Copy file location ctrl+shift+c
@ecoologic
ecoologic / Ecoologic.md
Last active March 3, 2023 04:25
Ecoologic

Erik T. Ecoologic

Currently interested in ReactJS, Node, TypeScript, AI, UX.

profile for ecoologic on Stack Exchange, a network of free, community-driven Q&A sites

My LinkedIn profile

Profiles

@ecoologic
ecoologic / debugging.rb
Last active February 27, 2018 05:54
Ecoologic's debugging and console tricks (for Brisbane Ruby Meetup talk)
# CGI.parse(params) # "checklist_list_ids%5B%5D=10806"
# Gem::Specification.map(&:name).sort
# app.users_path # => "/users"
::U = User # Etc
def self.helpme
puts <<-TEXT
v # view helpers (eg: content_tag)
exceptions # List of all exceptions
@ebramanti
ebramanti / uncle_bob_scribe_oath.md
Last active December 20, 2022 14:54
Uncle Bob Scribe's Oath

Uncle Bob - Scribe's Oath

  1. I will not produce harmful code.
    • I will not intentionally write code with bugs.
    • This means: Do your best.
  2. I will not produce code that's not my best.
  3. I will provide with each release a quick, testable & repeatable proof that the code works.
  4. I will not avoid release that will impede progress.
    • Short term rapid releases
  5. I will fearlessly and relentlessly improve the quality of code.
  • I will never make the code worse.
@ecoologic
ecoologic / choose_dependency_direction_wisely.md
Last active February 19, 2020 12:13
Blog post on OO dependency direction
title date author tags
The Direction Of The Dependency
2016-02-26
Architecture, Dependency Management, Ruby

The Direction Of The Dependency

When projects grow they become hard to change. One aspect that is not often highlighted is dependency direction. I haven't found much material on the topic, maybe the best ideas came from this talk by Sandi Metz "Less, the path to a better design".

@ungoldman
ungoldman / curl_post_json.md
Last active October 27, 2024 00:49
post a JSON file with curl

How do you POST a JSON file with curl??

You can post a json file with curl like so:

curl -X POST -H "Content-Type: application/json" -d @FILENAME DESTINATION

so for example:

@ecoologic
ecoologic / conventions.rb
Last active August 11, 2020 09:47
My Conventions
{}.as_json # {}
{}.to_json # "{}"
# query / command
user_params # query, no get_params etc, prefer queries over commands, leads to more declarative code, which is simpler
remote_document # Query, not get_document, more declarative
buy_document! # Exception to the above, it's probably a POST and I want to express that it's not a free call
prepare_document! # Bang to express imperative behaviour (?)
compact_params(params) # command - takes args and can be reused
compacted_user_params # YES, a noun is better