I want to install my homebrew packages on another computer.
brew leaves
- shows you all top-level packages.
brew leaves > installed_homebrew_packages.txt
cat installed_homebrew_packages.txt | xargs brew install
# Rails side: | |
# 1. Attachment.rb model needs a token method that encrypts the model id. | |
class Attachment < ActiveRecord::Base | |
mount_uploader :file, AttachmentUploader | |
# Add this | |
def self.find_by_token(token) | |
begin | |
find(UrlParamEncryptor.decrypt(token)) |
# lib/google_map/directions.rb | |
# Calls the google maps directions api | |
# https://developers.google.com/maps/documentation/directions/intro | |
# Useage: | |
# gm = GoogleMap::Directions.new({origin: '52.662377,-8.630171', destination: '52.635720, -8.654714'}) | |
# gm.call | |
module GoogleMap | |
class Directions | |
include HTTParty | |
base_uri 'https://maps.googleapis.com/maps/api' |
# app/config/environments/development.rb | |
# Middleware to print to the screen so I can see the responses when streaming data | |
config.middleware.use( | |
Class.new do | |
def initialize(app) | |
@app = app | |
end | |
def call(env) |
{ | |
"workbench.colorTheme": "Monokai", | |
"workbench.iconTheme": "city-lights-icons-vsc-light", | |
// Basic settings: turn linter(s) on | |
"ruby.lint": { | |
"rubocop": { | |
"lint": true, //enable all lint cops. | |
"only": [/* array: Run only the specified cop(s) and/or cops in the specified departments. */], | |
"except": [/* array: Run all cops enabled by configuration except the specified cop(s) and/or departments. */], | |
"forceExclusion": true, //Add --force-exclusion option |
Logs a timeout warning before unicorn kills the worker.
If something is running long enough for unicorn to want to kill it then its worth spending the time fixing. If the process is killed you will never know why it failed.
This will add a warning after 30 seconds and another one 1second before unicorn kills it.
It adds a middleware that sits on the Rack layer between Unicorn and Rails. It creates a timer Thread that sleeps for a set amount of time and if the current thread is still running then log a warning.
<!doctype html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<link rel="stylesheet" href="main.css"> | |
<script src="bundle.js" async></script> | |
</head> | |
<body> | |
<div data-controller="toggler"> | |
<label>Toggle Me</label> |
Add a personal .gitignore
to a project.
Within the project
git config --local -e
[core]
... (existing configurations)
excludesfile = ~/Documents/my_repo/.john_gitignore
[remote "origin"]