Skip to content

Instantly share code, notes, and snippets.

View db0sch's full-sized avatar

Dimitri "dbo" Bosch db0sch

View GitHub Profile
@db0sch
db0sch / erb_snippets.md
Last active May 11, 2024 09:01
ERB Snippets (in VS Code with the Ruby extension)

Text Editor ERB Snippets and Bindings

Snippet Tab Trigger Output
ERB tags er <% %>
print ERB tags pe <%= %>
if block if <% if %>...<% end %>
if / else block ife <% if %>...<% else %>...<% end %>
else tag else <% else %>
elsif tag elsif &lt;% elsif %&gt;
@db0sch
db0sch / db.txt
Created January 25, 2021 14:13
Postgresql DB issue tips
# Check the logs
tail /usr/local/var/log/postgres.log
# Upgrade the databases (if the server version does not match with the database file version)
brew postgresql-upgrade-database
@db0sch
db0sch / geolocate_user.js
Last active December 3, 2020 14:43
How to automatically geolocate user on map load (with Mapbox)
const geolocateUser = (map) => {
const geolocate = new mapboxgl.GeolocateControl({
positionOptions: {
enableHighAccuracy: true
},
fitBoundsOptions: {
linear: false
},
trackUserLocation: false
});
@db0sch
db0sch / regenerate_credentials.md
Last active May 11, 2024 10:34
How to regenerate the master key for Rails 5.2 credentials

If your master.key has been compromised, you might want to regenerate it.

No key regeneration feature at the moment. We have to do it manually.

  1. Copy content of original credentials rails credentials:show somewhere temporarily.
  2. Remove config/master.key and config/credentials.yml.enc
  3. Run EDITOR=vim rails credentials:edit in the terminal: This command will create a new master.key and credentials.yml.enc if they do not exist.
  4. Paste the original credentials you copied (step 1) in the new credentials file (and save + quit vim)
  5. Add and Commit the file config/credentials.yml.enc
@db0sch
db0sch / jobs.md
Created April 13, 2018 12:41
Jobs listing for developers

This weekend I had to reinstall Linux on my laptop (and took the occasion to migrate from Ubuntu 16.04 Mate to Elementary OS Loki, based on Ubuntu 16.04)

Therefore I had to go through the safecast setup all over again (I did struggle with the setup the first time few weeks ago).

Here is how I manage to have it work:

rvm install 2.1.10