Skip to content

Instantly share code, notes, and snippets.

View mirrec's full-sized avatar

Miroslav Hettes mirrec

  • Bratislava, Slovakia
View GitHub Profile
@mirrec
mirrec / gist:6551698
Created September 13, 2013 14:47
find hash of commit cat contains given FILE_NAME in bash
git rev-list --all | while read HASH; do echo $HASH; git show --pretty="format:" --name-only $HASH | grep FILE_NAME; done
@mirrec
mirrec / gist:3968310
Created October 28, 2012 10:56
rubyslava | gem + rails engine | init version

Ako sme upravili standardnu rails aplikacie na modularnu aplikaciu

Tvorba vlastnych Gemov + Rails Engine

Outline

  • preco uprava projektu na zlozku modulov
  • tvorba gemov
  • kratke how to + hinty
  • testovanie rspec
  • Railtie
  • hook methody
  • rails engine
@mirrec
mirrec / ruby
Created February 17, 2012 08:58
nested form in simple_form
# app/models/building.rb
class Building < ActiveRecord::Base
has_many :people, :dependent => :destroy
accepts_nested_attributes_for :people, :allow_destroy => true
end
# app/views/buildings/_form.html.erb
<%= simple_form_for(@building) do |f| %>
data_pre = @object.send(token_type)
data_pre = [data_pre].map(&:attributes).to_json(:only => ["id", "name"]) if data_pre
text_field("#{token_type}_id", "data-pre" => data_pre)+