This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### Keybase proof | |
I hereby claim: | |
* I am 5minpause on github. | |
* I am 5minpause (https://keybase.io/5minpause) on keybase. | |
* I have a public key ASCT5J-ZSNPhZo8noxPXeOXBjg8sR_bbm47SY6uq5TcpQAo | |
To claim this, I am signing this object: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# RSpec 2.0 syntax Cheet Sheet by http://ApproachE.com | |
# defining spec within a module will automatically pick Player::MovieList as a 'subject' (see below) | |
module Player | |
describe MovieList, "with optional description" do | |
it "is pending example, so that you can write ones quickly" | |
it "is already working example that we want to suspend from failing temporarily" do | |
pending("working on another feature that temporarily breaks this one") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var ddoc = { | |
_id: '_design/index', | |
views: { | |
index: { | |
map: function mapFun(doc) { | |
if (doc.table_name) { | |
emit(doc.table_name); | |
} | |
}.toString() | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
validVinExp: function () { | |
// WDD 169 007-1J-236589 | |
// WDB1681331J93895 | |
return new RegExp('^(wdb|wdd)\\s*[\\d\\s]{6,}-?[\\w\\d]{2}-?[\\d]{5,6}$', 'i'); | |
}, | |
evaluateVin: function (value) { | |
return this.validVinExp().test(value); | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[commit] | |
template = ~/.gitmessage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ git rev-list HEAD -count | |
2442 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 50-character subject line | |
# 72-character wrapped longer description. | |
# Der Grund für die Änderung (Warum) | |
# Why is this change necessary? | |
# Wie löst es die Aufgabe (Wie) | |
# How does it address the issue? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This is inside Goldencobra::Permission model | |
after_commit :set_cache_key | |
def self.restricted?(item) | |
@@last_permission ||= Goldencobra::Permission.reorder(:updated_at).last | |
Rails.cache.fetch("#{@@last_permission.cache_key}#{item.cache_key}") do | |
where(subject_class: item.class, subject_id: item.id).count > 0 | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def self.restricted?(item) | |
where(:subject_class => item.class, :subject_id => item.id).count > 0 | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
collection_action :load_overviewtree_as_json do | |
if params[:root_id].present? | |
objects = Goldencobra::Article.where(id: params[:root_id]).first.children.reorder(:url_name) | |
cache_key ||= ["articles", params[:root_id], objects.map(&:id), objects.maximum(:updated_at)] | |
articles = Rails.cache.fetch(cache_key) do | |
Goldencobra::Article.find(params[:root_id]) | |
.children.reorder(:url_name).as_json(only: [:id, :url_path, :title, :url_name], | |
methods: [:has_children, :restricted]) | |
end |