Skip to content

Instantly share code, notes, and snippets.

View sauloperez's full-sized avatar

Pau Pérez Fabregat sauloperez

View GitHub Profile

Delivery

Review of the process

We will check epics to see whether the criteria in terms of performance has been met.

Tech and Po check from time to time how we do in terms of reaching the goal and adapting.

Filipe is still finding his way and will share any process improvements as soon as he has grasps it all and has ideas.

@sauloperez
sauloperez / gist:a4e945b111ff3cb198a1912d4c1ec057
Created March 21, 2020 11:36
Cool fonts to use in projects
Futura PT
Graphik
Inter UI
@sauloperez
sauloperez / development.rb
Created July 20, 2020 08:36
Complete production-like development-mode profiling environment
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# In the development environment your application's code is reloaded on
# every request. This slows down response time but is perfect for development
# since you don't have to restart the web server when you make code changes.
config.cache_classes = !!ENV["PROFILE"]
# Do not eager load code on boot.
config.eager_load = !!ENV["PROFILE"]
@sauloperez
sauloperez / cercles-coop.log
Created November 19, 2020 12:42
Cercles.coop stacktrace
2020-11-19T12:34:41.054839+00:00 app[web.1]: F, [2020-11-19T12:34:41.054744 #34] FATAL -- : [3a52ba07-f9a1-4a7e-bed6-25affba1b729] Rack::Timeout::RequestTimeoutException (Request waited 5ms, then ran for longer than 30000ms ):
2020-11-19T12:34:41.054840+00:00 app[web.1]: F, [2020-11-19T12:34:41.054787 #34] FATAL -- : [3a52ba07-f9a1-4a7e-bed6-25affba1b729]
2020-11-19T12:34:41.054961+00:00 app[web.1]: F, [2020-11-19T12:34:41.054886 #34] FATAL -- : [3a52ba07-f9a1-4a7e-bed6-25affba1b729] vendor/bundle/ruby/2.6.0/gems/excon-0.78.0/lib/excon/socket.rb:279:in `select'
2020-11-19T12:34:41.054962+00:00 app[web.1]: [3a52ba07-f9a1-4a7e-bed6-25affba1b729] vendor/bundle/ruby/2.6.0/gems/excon-0.78.0/lib/excon/socket.rb:279:in `select_with_timeout'
2020-11-19T12:34:41.054962+00:00 app[web.1]: [3a52ba07-f9a1-4a7e-bed6-25affba1b729] vendor/bundle/ruby/2.6.0/gems/excon-0.78.0/lib/excon/socket.rb:140:in `rescue in block in connect'
2020-11-19T12:34:41.054963+00:00 app[web.1]: [3a52ba07-f9a1-4a7e-bed6-25affba1b729] vendor/bundle
commit b5680a7effab8bb9f1b1542366b6dad36fe23611
Author: Pau Perez <saulopefa@gmail.com>
Date: Thu Jan 7 11:21:00 2021 +0100
Turn to 2 queries into one with another INNER JOIN
There's no need to fetch the votes' authors first if we can scope the
query to the votes' records we care about in a single statement.
Letting the DB do its job results in less code on our side and better
performance. We skip Ruby CPU cycles and a network round trip for each
commit 74fb66e93619074dda3bd98cfe935c4ced30143f
Author: Pau Perez <saulopefa@gmail.com>
Date: Thu Jan 7 12:29:40 2021 +0100
Count occurrences of foreign key instead of join
As we just care for the count of users and not about any of their
details there's no need to join with the users table. The foreign key
column is enough to count.
-- questions + count of its delegated votes
SELECT
questions_with_delegation_votes_count.*,
CASE
WHEN has_granter THEN count_by_setting_id
ELSE 0
END AS total_delegates
FROM (
SELECT
decidim_consultations_questions.*,
@sauloperez
sauloperez / public_methods.py
Created November 19, 2021 08:48
List non-dunder methods from Python object
[m for m in dir(object) if not m.startswith('_')]
@sauloperez
sauloperez / open_render.sh
Last active November 19, 2021 09:05
Render and open mail template in browser
# Then, open it in your default $BROWSER
$ python -m webbrowser -t tacto-fastapi-v2/tests/rendered.html