Skip to content

Instantly share code, notes, and snippets.

View refactor8's full-sized avatar

Ryan Flores refactor8

  • World
View GitHub Profile
digraph architecture {
rankdir=LR;
subgraph client_side_apps {
front_end -> {auth_api, my_app_api};
extension -> {auth_api, my_app_api};
{rank=same; front_end, extension, auth_api};
}
@refactor8
refactor8 / LC_CTYPE.txt
Created November 25, 2017 10:35 — forked from thanksdanny/LC_CTYPE.txt
Centos warning: setlocale: LC_CTYPE: cannot change locale (UTF-8): No such file or directory
vi /etc/environment
add these lines...
LANG=en_US.utf-8
LC_ALL=en_US.utf-8
@refactor8
refactor8 / remove-docker-containers.md
Last active September 13, 2017 08:05 — forked from ngpestelos/remove-docker-containers.md
How to remove unused Docker containers and images
  1. Delete all containers

     $ docker ps -q -a | xargs docker rm
    

-q prints only the container IDs -a prints all containers

Notice that it uses xargs to issue a remove container command for each container ID

  1. Delete all untagged images
@refactor8
refactor8 / README.md
Created September 10, 2017 22:01 — forked from dmitryrck/README.md
Zero to Up and Running a Rails Project only using Docker - README

My Blog

Running

Setup:

% docker-compose run --rm -u root web bash -c "mkdir -p /bundle/vendor && chown railsuser /bundle/vendor"
% docker-compose run --rm web bundle install
% docker-compose run --rm web bundle exec rake db:setup
@refactor8
refactor8 / .dockerignore
Created September 5, 2017 20:29 — forked from davidderus/.dockerignore
Docker + Rails + Puma + Postgres + Nginx
.git
.gitignore
doc
.yardoc
coverage
jsdoc
tmp
log
README.md
public/uploads/
@refactor8
refactor8 / filterable.rb
Created September 2, 2017 20:01 — forked from justinweiss/filterable.rb
Filterable
# Call scopes directly from your URL params:
#
# @products = Product.filter(params.slice(:status, :location, :starts_with))
module Filterable
extend ActiveSupport::Concern
module ClassMethods
# Call the class methods with the same name as the keys in <tt>filtering_params</tt>
# with their associated values. Most useful for calling named scopes from
@refactor8
refactor8 / custom_logger.rb
Created August 21, 2017 13:55 — forked from kinopyo/custom_logger.rb
Custom logger file in Rails
# lib/custom_logger.rb
class CustomLogger < Logger
def format_message(severity, timestamp, progname, msg)
"#{timestamp.to_formatted_s(:db)} #{severity} #{msg}\n"
end
end
logfile = File.open("#{Rails.root}/log/custom.log", 'a') # create log file
logfile.sync = true # automatically flushes data to file
CUSTOM_LOGGER = CustomLogger.new(logfile) # constant accessible anywhere
@refactor8
refactor8 / .bash_profile
Created July 18, 2017 00:50
Set iTerm2 tab titles to current directory
# Set iTerm2 tab titles
tabTitle() { echo -ne "\033]0;"$*"\007"; }
# Always list directory contents and set title upon 'cd'
cd() { builtin cd "$@"; ls -lFah; tabTitle ${PWD##*/}; }
@refactor8
refactor8 / 1_initial_migration.rb
Created June 11, 2017 22:33 — forked from wrburgess/1_initial_migration.rb
Setting up UUID columns for Rails 5+ models utilizing Postgres 9.4+
class InitialMigration < ActiveRecord::Migration[5.0]
def change
enable_extension "pgcrypto" unless extension_enabled?("pgcrypto")
end
end
@refactor8
refactor8 / os-x-syslog-server.md
Created May 27, 2017 22:46 — forked from darconeous/os-x-syslog-server.md
Using OS X as a Syslog Server

Using OS X as a Syslog Server

This document describes how to set up an OS X to be a syslog server that logs messages from the local network. It was largely meant for my own purposes so that I don't forget what I did, but feel free to use it for your own purposes.

A problem with just "turning this on" is that you will not see the correct hostname in the syslog entries. What we will do is use