Skip to content

Instantly share code, notes, and snippets.

View romanlehnert's full-sized avatar

Roman Lehnert romanlehnert

  • Munich, Germany
View GitHub Profile

Goals of a bug report

The single goal of a bug report is to fix the bug. Chances for that are higher, when the report is clear, reproduceable and follows a fixed structure. Keep in mind, that not only developers need to understand a bug, but also the product owner and testers who may not have such a deep technical knowhow. Customers and other stakeholders have to talk about the bug. A software tester has to be able to reproduce it, and a developer is in charge to fix it. The following description is a "best practice" for reporting a bug.

Contents of a bug report

  1. Title
  2. Steps to reproduce
  3. Current result
  4. Expected result
  5. Environment
def self.with_latest_document
joins(" INNER JOIN
contract_documents AS joined_contract_documents
ON contracts.id = joined_contract_documents.contract_id
INNER JOIN
(
SELECT max(created_at) AS created_at, contract_id, id, status
FROM contract_documents
WHERE status IN ('uploaded', 'approved')
GROUP BY contract_id
@romanlehnert
romanlehnert / phrase.rb
Created June 10, 2014 08:31
Phrase exclusion and skipping of verification
# This is part of a "locale" model, we use.
#
# @name contains the handle of the locale, e.g. "de-AT", or "da-DK".
# this way, we exclude a key in phrase. It works perfect.
def exclude_key_in_phrase(key)
HTTParty.post('https://phraseapp.com/api/v1/translations/store.json',
query: {
auth_token: Phrase.auth_token,
1.upto(100) do |i|
if i % 5 == 0 and i % 3 == 0
puts "FizzBuzz"
elsif i % 5 == 0
puts "Buzz"
elsif i % 3 == 0
puts "Fizz"
else
puts i
end
@romanlehnert
romanlehnert / gist:eab4eb8658b7334d4003
Created February 17, 2015 11:50
make capybara wait for text to disappear
# have_content calls has_content? that is aliased by has_text?
#
# It checks, if the page has the text. when the text is not present,
# it waits until the capybara timout to let the text appear.
#
# When our frontendcode should remove the content muffins, we could
# test it like this way:
it 'does not have content xyz after clicking the magic button' do
find('a.magic_button').click
@romanlehnert
romanlehnert / gist:b9b8584abf766b28c844
Last active August 29, 2015 14:16
Matcher pattern
invoice = Invoice.last
invoice.load_order_matches.with_score_gt(70) # <= LoadOrderMatchesCollection
best_match = invoice.load_order_matches.best # <= LoadOrderMatch
best_match.score # <= 97
best_match.invoice # <= Invoice
best_match.load_order # <= LoadOrder
best_match.similarities # <= [ amount: 500 ]
class Invoice
extend Matchability
module Attributify
def attributify(key, unprocessed=params[key])
if unprocessed.is_a? Hash
specific_params = {}
unprocessed.each do |k,v|
if (v.is_a?(Hash) && !k.to_s.match(/_attributes$/)) or (v.is_a?(Array) && !k.to_s.match(/_ids$/))
# Nested, so suffix with '_attributes'
specific_params["#{k}_attributes".to_sym] = attributify(key, v)
@romanlehnert
romanlehnert / json.snippets
Last active August 29, 2015 14:23
json schema snippets for vim (utilizing snipmate)
snippet khv
"${1}": {
${2}
}
snippet kv
"${1}": "${2}"
snippet s
"${1}": {
"((void 0),(function (counter, val) {var topic = val.topic;topic.unread = topic_unread_counter(topic.uuid);scope.unread = topic.unread + scope.unread;save_topic_in_dom(topic);}))@http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js:29 (1,[object Object])@http://gobas.sharenotes.de/javascripts/run_v3.js:238 ([object Array],(function (i, scope) {scope.unread = 0;$.each(scope.subscriptions, function (counter, val) {var topic = val.topic;topic.unread = topic_unread_counter(topic.uuid);scope.unread = topic.unread + scope.unread;save_topic_in_dom(topic);});}))@http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js:30 scopes_for_template([object Array])@http://gobas.sharenotes.de/javascripts/run_v3.js:236 ([object Array],"success",[object XMLHttpRequest])@http://gobas.sharenotes.de/javascripts/app_v6.js:78 b()@http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js:124 ()@http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js:129 ([object Object])@http://ajax.googleapis.com/ajax/
@romanlehnert
romanlehnert / gist:1416783
Created December 1, 2011 13:37
Patch for qt
diff --git a/src/3rdparty/webkit/WebCore/platform/network/qt/SocketStreamHandleQt.cpp b/src/3rdparty/webkit/WebCore/platform/network/qt/SocketStreamHandleQt.cpp
index e666ff7..8abcc48 100644
--- a/src/3rdparty/webkit/WebCore/platform/network/qt/SocketStreamHandleQt.cpp
+++ b/src/3rdparty/webkit/WebCore/platform/network/qt/SocketStreamHandleQt.cpp
@@ -100,7 +100,7 @@ int SocketStreamHandlePrivate::send(const char* data, int len)
if (!m_socket || m_socket->state() != QAbstractSocket::ConnectedState)
return 0;
quint64 sentSize = m_socket->write(data, len);
- QMetaObject::invokeMethod(this, "socketSentData", Qt::QueuedConnection);
+ QMetaObject::invokeMethod(this, "socketSentdata", Qt::QueuedConnection);