Skip to content

Instantly share code, notes, and snippets.

View fdocr's full-sized avatar
🤓

Fernando Valverde fdocr

🤓
View GitHub Profile
heroku restart -a APP_NAME
heroku pg:reset -a APP_NAME DATABASE --confirm=APP_NAME
heroku run rake db:migrate -a APP_NAME
heroku run rake db:seed -a APP_NAME

One liner:

heroku restart -a APP_NAME; heroku pg:reset -a APP_NAME DATABASE --confirm=APP_NAME; heroku run rake db:migrate -a APP_NAME; heroku run rake db:seed -a APP_NAME

```
heroku restart -a APP_NAME
heroku pg:reset -a APP_NAME DATABASE --confirm=APP_NAME
heroku run rake db:migrate -a APP_NAME
heroku run rake db:seed -a APP_NAME
```
One liner:
`heroku restart -a APP_NAME; heroku pg:reset -a APP_NAME DATABASE --confirm=APP_NAME; heroku run rake db:migrate -a APP_NAME; heroku run rake db:seed -a APP_NAME`
@fdocr
fdocr / Setting up WiFi dongle on Raspberry Pi.md
Created November 8, 2018 15:46
Setting up WiFi dongle on Raspberry Pi
  1. Check for the WiFi dongle (making sure it's available) with dmesg | more

  2. Edit /etc/network/interfaces

auto lo
iface lo inet loopback
iface eth0 inet dhcp

allow-hotplug wlan0
@fdocr
fdocr / Common Docker images.md
Last active December 17, 2018 17:47
Common Docker commands & images. Includes Swagger, PostgreSQL & Redis

Common Docker parameters explained

  • -it
    • Execute using "interactive tty", i.e. execute the command and hold the session until the command ends (with possible keyboard input).
  • -p 8080:3000
    • Bind the port 3000 from the container to the local network interface on port 8080. The port that is closer to the container image name (see below) is the one that refers to the container port, the other one refers to the local network port.
  • -d
    • Run the container as daemon (instead of interactively with -it).
  • -v /opt/postgres/data:/var/lib/postgresql/data
    • Attach a local volume to a container for data persistance. Follow the same logic as with the ports to know which one refers to the container and which one to the local filesystem.
@fdocr
fdocr / new_rails_app.rb
Last active April 8, 2024 03:35
New Rails app with RSpec
# Terminal
# OLD -> rails new app_name -T --webpack=stimulus --skip-sprockets
rails new app_name -a propshaft --skip-jbuilder -T
cd app/
# OLD -> yarn add bootstrap jquery popper.js
# Basic Gemfile (DOWN BELOW)
# Terminal
@fdocr
fdocr / postgres_container.sh
Last active October 29, 2018 15:06
Create postgres Docker container & simple management commands
###################
# Docker COMMANDS #
###################
# Create volume for persistance
docker volume create pgdata
# Create the container
docker run --name pg -e POSTGRES_USER=test -e POSTGRES_PASSWORD=test -d -v pgdata:/var/lib/postgresql/data -p 5432:5432 postgres
@fdocr
fdocr / git.sh
Created September 8, 2016 21:43
Useful git commands to remember
#Remove staged file
git reset HEAD -- path/to/file
#Remove all staged files
git reset HEAD -- .
#Delete local branch
git branch -d branch_name
#Delete remote branch
@fdocr
fdocr / print-fonts.swift
Created September 8, 2016 15:17
Useful for looking up font names added to a project
for family: String in UIFont.familyNames() {
print("\(family)")
for names: String in UIFont.fontNamesForFamilyName(family) {
print("== \(names)")
}
}
@fdocr
fdocr / delay.swift
Created September 3, 2016 01:10
Delay function in ms
// Delay function expressed in ms
func delay(delay:Double, closure:()->()) {
dispatch_after(
dispatch_time(
DISPATCH_TIME_NOW,
Int64(delay * 1000000.0)
),
dispatch_get_main_queue(), closure)
}