Skip to content

Instantly share code, notes, and snippets.

@lorenadl
lorenadl / rails_download_active_storage_attachment.md
Last active January 10, 2023 01:04
[Rails] Download an Active Storage attachment
@fbn4sc
fbn4sc / command.txt
Created January 29, 2018 01:35
Delete all branches except master and develop.
git branch | grep -v "master\|develop" | xargs git branch -D
@suzukimilanpaak
suzukimilanpaak / problem.md
Last active March 12, 2018 16:41
PARKING LOT PROBLEM

####################################################################################

PARKING LOT PROBLEM

Rules of the Game

  1. You have two full days to implement a solution
  2. You can use any (fairly) mainstream object oriented language of your choice, so long as your solution builds and runs on linux. You should be fine if you favour, say, Java, Ruby, Python or Javascript.
  3. Please ensure that you follow the syntax and formatting of both the
@guisehn
guisehn / gist:6648c8fdcd1102a22a22
Last active June 2, 2021 11:08 — forked from wrburgess/gist:5528649
Backup Heroku Postgres database and restore to local database

Grab new backup

Command: heroku pg:backups capture -a [app_name]

Download

Command: curl -o latest.dump `heroku pg:backups public-url -a [app_name]`

Restore backup dump into local db

@tristanm
tristanm / README.md
Last active May 9, 2024 17:44
Migrating a Rails project from MySQL to PostgreSQL

Migrating a Rails project from MySQL to PostgreSQL

This brief guide is written from my own experience with migrating a large (~5GB) MySQL database to PostgreSQL for a Rails project.

No warranties, guarantees, support etc. Use at your own risk and, as always, ENSURE YOU MAKE BACKUPS FIRST!

I chose [pgloader][1] because it's extremely fast. YMMV.

  1. Replace mysql2 gem with pg in Gemfile.
  2. Update config/database.yml for PostgreSQL. I used [Rails' template][2] as a starting point.
@obfusk
obfusk / break.py
Last active May 1, 2024 20:32
python "breakpoint" (more or less equivalent to ruby's binding.pry); for a proper debugger, use https://docs.python.org/3/library/pdb.html
import code; code.interact(local=dict(globals(), **locals()))
@johnpolacek
johnpolacek / .gitconfig
Last active May 8, 2024 04:05
My current .gitconfig aliases
[alias]
co = checkout
cob = checkout -b
coo = !git fetch && git checkout
br = branch
brd = branch -d
brD = branch -D
merged = branch --merged
st = status
aa = add -A .
@mlanett
mlanett / rails http status codes
Last active May 3, 2024 04:15
HTTP status code symbols for Rails
HTTP status code symbols for Rails
Thanks to Cody Fauser for this list of HTTP responce codes and their Ruby on Rails symbol mappings.
Status Code Symbol
1xx Informational
100 :continue
101 :switching_protocols
102 :processing