Skip to content

Instantly share code, notes, and snippets.

View jofi's full-sized avatar

Jozef Fulop jofi

View GitHub Profile
@jofi
jofi / ruby_files_in_load_paths.rb
Last active May 22, 2021 21:10
Quick tricks to expand load paths in ruby
# expand_path is genuine and DOES KNOW ABOUT absolute and relative paths
File.expand_path('relative/path/to/dir_or_file', '/start/path') # "/start/path/relative/path/to/dir_or_file"
File.expand_path('../application', __FILE__) # "/absolute/path/to/FILE/../application"
File.expand_path('/path/to/dir_or_file', '/start/path') # "/path/to/dir_or_file"
File.expand_path('../path/to/dir_or_file', '/start/path') # "/start/path/to/dir_or_file"
# join seems to be STUPID. It just joins strings (and adds file separator if needed)
File.join('some/path/', '/other/path.rb') # "some/path/other/path.rb"
# modify the global load path:
#!/usr/bin/env ruby
if __FILE__ == $PROGRAM_NAME
$:.unshift(File.expand_path('../lib', __FILE__))
#require 'something'
#some code...
#require 'pry'
#Pry.start

Product management process with Trello

A Trello board is a software equivalent of a physical wall with columns of sticky notes. In Trello terminology, the wall is called a "board." The columns are called "lists." The sticky notes in columns are called "cards."

No two products are the same, so flexibility in the product management process is important. Trello responds well to changing the structure of the process "on the fly."

@jofi
jofi / tmux - prefix
Created April 16, 2014 07:27
Setup secondary prefix for tmux
# in a shell:
tmux set -g prefix2 C-a
tmux bind-key C-a send-prefix -2
# or in a ~/.tmux.conf
set -g prefix2 C-a
bind-key C-a send-prefix -2
ruby -e 'puts `echo $PATH`.split ":"'
@jofi
jofi / gist:7153603
Last active December 26, 2015 12:49
#git cherry-pick aabce18
# ORACLE:
cd ~/workspace/webafis_rails
cp ../_webafis_related/database_yml/ES/database.yml.oracle ES/config/database.yml
cp ../_webafis_related/database_yml/DS/database.yml.oracle DS/config/database.yml
# POSTGRES:
cd ~/workspace/webafis_rails
cp ../_webafis_related/database_yml/ES/database.yml.postgres ES/config/database.yml
cp ../_webafis_related/database_yml/DS/database.yml.postgres DS/config/database.yml
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
@jofi
jofi / csv_example.rb
Created June 7, 2012 08:21
CSV manipulation in ruby
require 'csv'
# http://ruby-doc.org/stdlib-1.9.2/libdoc/csv/rdoc/CSV.html
# READING !!!FROM FILE!!!!
# Line by Line:
CSV.foreach('csvfile.csv') do
|row|
puts row #array
end
@jofi
jofi / _flash.html.erb
Created June 1, 2012 07:16 — forked from potomak/_flash.html.erb
Rails flash messages using Twitter bootstrap
<% [:notice, :error, :alert].each do |level| %>
<% unless flash[level].blank? %>
<div class="alert-message <%= flash_class(level) %>">
<a class="close" href="#">×</a>
<%= content_tag :p, flash[level] %>
</div>
<% end %>
<% end %>
@jofi
jofi / gist:921867
Created April 15, 2011 15:18
mysql-slave-recovery
# IST DO SCREENU, aby si pri tom nemusel nocovat!!!
# ideme odobrat najnovsi dump z MASTERA (je jedno na ktorom stroji sme - mozno je vyhodnejsie byt na slave-ovi):
# priprava na dump a vynulovanie binary logov
mysql -h db-master -u root -p
FLUSH TABLES WITH READ LOCK;
RESET MASTER;
PURGE BINARY LOGS;
UNLOCK TABLES;