Skip to content

Instantly share code, notes, and snippets.

@ffscalco
ffscalco / Fresh macos setup.md
Last active January 17, 2022 04:29
Useful information to setup a fresh macos
@dhh
dhh / Gemfile
Created June 24, 2020 22:23
HEY's Gemfile
ruby '2.7.1'
gem 'rails', github: 'rails/rails'
gem 'tzinfo-data', '>= 1.2016.7' # Don't rely on OSX/Linux timezone data
# Action Text
gem 'actiontext', github: 'basecamp/actiontext', ref: 'okra'
gem 'okra', github: 'basecamp/okra'
# Drivers
@camh-
camh- / eol-at-eof.md
Created March 7, 2020 04:41
Please add newlines at end of files

See https://stackoverflow.com/questions/729692/why-should-text-files-end-with-a-newline

A newline in a text file is a terminator, not a separator. This means each line should have a newline at the end of it, including the last line of the file.

Many editors automatically add the newline at the end of the file. Some do not. If you can configure your editor to ensure there is always a newline at the end of every line, please do so.

Because many editors do add this newline, if you commit a text file without it, when someone else edits the file, their editor will (correctly) add the newline. This causes a spurious diff in the file. Spurious

@theonlydaleking
theonlydaleking / submodules.md
Last active April 2, 2024 00:28 — forked from manasthakur/submodules.md
Using git submodules to version-control Vim plugins

Using git-submodules to version-control Vim plugins

If you work across many computers (and even otherwise!), it's a good idea to keep a copy of your setup on the cloud, preferably in a git repository, and clone it on another machine when you need. Thus, you should keep the .vim directory along with your .vimrc version-controlled.

But when you have plugins installed inside .vim/bundle (if you use pathogen), or inside .vim/pack (if you use Vim 8's packages), keeping a copy where you want to be able to update the plugins (individual git repositories), as well as your vim-configuration as a whole, requires you to use git submodules.

Creating the repository

Initialize a git repository inside your .vim directory, add everything (including the vimrc), commit and push to a GitHub/BitBucket/GitLab repository:

cd ~/.vim
@abelcallejo
abelcallejo / README.md
Last active April 25, 2024 11:16
Create bootable Linux USB using Mac

Creating bootable Linux USB using Mac

mac

CentOS, Ubuntu, Slackware, etc. Whatever Linux-based OS it is, you can create a bootable USB for it by using a Mac.

1. Prepare the .iso file

Download it, copy it, whatever it takes to prepare that Linux-based OS .iso file

2. Convert the .iso file into a .img.dmg

@HelioCampos
HelioCampos / database_migration_best_practices.md
Created September 28, 2017 14:00
Database migration best practices for Rails

Database migration best practices for Rails

Never ever change data on schema changes! [1]

Use rake tasks to change the data! [1]

This decouples a deployment from completed migrations. Give us control of the data manipulation proccess by encapsulatin it in on place. need to remember to:

  1. Run it in one of the ways bellow: a. Add this rake task the deployment script or;
@aloucas
aloucas / rails_binding_pry_on_docker.md
Created September 28, 2017 08:45
Rails binding.pry usage with docker
  1. Initially install your pry-rails to group development on your apps Gemfile
group :development do
  # ..
  gem 'pry-rails'
  # ..
end
@jgillman
jgillman / restore.sh
Last active March 8, 2024 17:51
pg_restore a local db dump into Docker
# Assumes the database container is named 'db'
DOCKER_DB_NAME="$(docker-compose ps -q db)"
DB_HOSTNAME=db
DB_USER=postgres
LOCAL_DUMP_PATH="path/to/local.dump"
docker-compose up -d db
docker exec -i "${DOCKER_DB_NAME}" pg_restore -C --clean --no-acl --no-owner -U "${DB_USER}" -d "${DB_HOSTNAME}" < "${LOCAL_DUMP_PATH}"
docker-compose stop db
@elliotthilaire
elliotthilaire / pre-push
Last active October 12, 2018 10:07
A pre-push git hooking using the pronto gem
#!/bin/sh
# To reinstall this script in the same or another git repo run:
# curl -sSL https://gist.githubusercontent.com/elliotthilaire/cef91754bb296d67e776/raw/pre-push > .git/hooks/pre-push; chmod +x .git/hooks/pre-push
# check that pronto is installed
hash pronto 2>/dev/null || {
echo >&2 "Pronto is not installed. Install with 'gem install pronto pronto-rubocop'";
echo >&2 "Find other Pronto runners at https://github.com/mmozuras/pronto#runners";
exit 0;
@lucascaton
lucascaton / iphone6.rb
Created September 23, 2015 23:24 — forked from alexeckermann/iphone6.rb
iPhone 6 Reservation Availability in Australia
# iPhone 6 Reservation Availability in Australia
# !! Please use responsibly. Personal use only !!
# `ruby iphone6.rb` - list all available models in all stores
# `ruby iphone6.rb R405` - list available models for a specific store, Rundle Place in this example.
require 'open-uri'
require 'json'
MODEL_NAMES = {
"MG4A2X/A" => "iPhone 6 Space Grey 128GB",