Skip to content

Instantly share code, notes, and snippets.

View pawelztef's full-sized avatar

Paweł Stefaniak pawelztef

View GitHub Profile
@pawelztef
pawelztef / database.yml.mysql
Last active October 11, 2017 05:06
ruby on rails database configuration exemples
default: &default
adapter: mysql2
encoding: utf8
pool: 5
username:
password:
socket: /var/run/mysqld/mysqld.sock
development:
<<: *default
@pawelztef
pawelztef / _flash.html.erb
Last active August 9, 2021 02:16
rails flash messages with bootstrap 4
<div class="container">
<% flash.each do |type, msg| %>
<div class="alert <%= bootstrap_class_for_flash(type) %> alert-dismissable fade show">
<%= msg %>
<button class="close" data-dismiss="alert">x</button>
</div>
<% end %>
</div>
@pawelztef
pawelztef / .bashrc
Last active October 11, 2017 04:39
.bashrc
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
# set show-mode-in-prompt on
# set vi-ins-mode-string \1\2  \1\2
# set vi-cmd-mode-string \1\2  \1\2
ranger() {
if [ -z "$RANGER_LEVEL" ]; then
@pawelztef
pawelztef / vimrc
Created January 3, 2017 23:52
vimrc
"Pathogen - manage plugins
"-------------------------------------------------------------------------
execute pathogen#infect()
"---------------------------------------------------------------------------
" Basic settings
"-------------------------------------------------------------------------
let g:ruby_path = system('echo $HOME/.rbenv/shims')
let mapleader = "\<Space>"
@pawelztef
pawelztef / compton.conf
Last active January 29, 2021 21:31
my i3wm config file
#opacity-rule = ["99:class_g = 'Terminator'"];
#opacity-rule = ["85:class_g = 'Termite'"];
opacity-rule = ["99:class_g = 'Termite'"];
# Shadow
shadow = true;
no-dnd-shadow = true;
no-dock-shadow = true;
clear-shadow = true;
shadow-radius = 4;
shadow-offset-x = 0;
@pawelztef
pawelztef / missing_indexes
Created December 10, 2016 01:00
Check missing indexes in Rails app
c = ActiveRecord::Base.connection
c.tables.collect do |t|
columns = c.columns(t).collect(&:name).select {|x| x.ends_with?("_id" || x.ends_with("_type"))}
indexed_columns = c.indexes(t).collect(&:columns).flatten.uniq
unindexed = columns - indexed_columns
unless unindexed.empty?
puts "#{t}: #{unindexed.join(", ")}"
end
end