Skip to content

Instantly share code, notes, and snippets.

View nicbet's full-sized avatar

Nicolas Bettenburg nicbet

View GitHub Profile
@nicbet
nicbet / load-env.sh
Created February 22, 2018 14:17
Load all variables set in .env file into current shell session environment
export $(grep -v "^#" .env | xargs)
@nicbet
nicbet / install-docker-ubuntu-x86_64.sh
Last active February 10, 2020 13:13
Deploy specific version of Docker-CE on Ubuntu 16.06.04 LTS and pin that version to prevent updates
#!/bin/bash
set -x
# Instructions from
# https://docs.docker.com/install/linux/docker-ce/ubuntu/#install-docker-ce
# Update the Apt package index
sudo apt-get update
# Install packages to allow apt to use repo over https
sudo apt-get install \
@nicbet
nicbet / _Webpack-Fontawesome-Bootstrap-Phoenix.md
Last active April 28, 2020 05:43
Sass versions of Bootstrap 4 and Fontawesome 5 with Elixir / Phoenix Framework 1.3.x and 1.4.x using Webpack

SASS Versions of

  • Fontawesome 5
  • Bootstrap 4

in Phoenix 1.3 and 1.4 via Webpack

@nicbet
nicbet / notes-rails-generators-config.md
Last active April 8, 2019 16:33
Declutter Rails Generators
# config/application.rb

# Generators
    config.generators do |g|
      g.test_framework(false)
      g.stylesheets(false)
      g.javascripts(false)
      g.helper(false)
 g.channel(assets: false)
@nicbet
nicbet / notes-rails-singular-plural-conventions.md
Last active October 23, 2022 11:57
Rails Singular / Plural Cheat Sheet
Type Case Example
Controller Plural rails g controller Users index show
Helper Plural rails g helper Users
Mailer Singular rails g mailer UserMailer
Migration Plural rails g migration AddEmailToUsers email:string
Model Singular rails g model User name:string
Observer Singular rails g observer User
Resource Plural* resources :users, :only => [:index, :show]
Scaffold Singular rails g scaffold User name:string
@nicbet
nicbet / notes-rails-polymorphic-associations.md
Created November 12, 2018 15:17
Rails polymorphic associations
class Person < ActiveRecord::Base
  has_one :address, :as => :addressable
end

class Company < ActiveRecord::Base
  has_one :address, :as => :addressable
end

class Address &lt; ActiveRecord::Base
@nicbet
nicbet / gtk.css
Created January 5, 2019 19:44
Gnome 3.28 - Better Focus Window Visibility
/* File ~/.config/gtk-3.0/gtk.css */
.titlebar {
color:white;
}
.titlebar:backdrop {
background: #333;
color:#666;
}
@nicbet
nicbet / simple_authentication_rails_5_bcrypt_and_has_secure_password.md
Created February 8, 2019 02:59 — forked from iscott/simple_authentication_rails_5_bcrypt_and_has_secure_password.md
Cheat Sheet: Simple Authentication in Rails 5 with has_secure_password

Cheat Sheet: Simple Authentication in Rails 5 with has_secure_password

The goal of this cheatsheet is to make it easy to add hand-rolled authentication to any rails app in a series of layers.

First the simplest/core layers, then optional layers depending on which features/functionality you want.

Specs
AUTHOR Ira Herman
LANGUAGE/STACK Ruby on Rails Version 4 or 5
@nicbet
nicbet / run_db.sh
Created February 11, 2019 19:29
Development Database (postgresql) with Docker
#!/bin/bash
docker run --name $@ \
-d \
-e POSTGRES_PASSWORD=postgres \
-e POSTGRES_USER=postgres \
-v $(pwd)/database:/var/lib/postgresql/data \
-p 5432:5432 \
postgres:11
@nicbet
nicbet / disable-autodiscover.applescript
Created March 6, 2019 13:59
Disable Autodiscover for Outlook 2019 on Mac OS X
tell application "Microsoft Outlook"
set background autodiscover of exchange account "ACCOUNT_NAME" to false
end tell