Skip to content

Instantly share code, notes, and snippets.

View mbj's full-sized avatar

Markus Schirp mbj

View GitHub Profile
@louismrose
louismrose / Palindrome.java
Last active August 29, 2015 14:02
Using mutation testing to detect bugs involving exceptions?
public class Palindrome {
// This method checks whether its input reads the same forwards
// as backwards. For example, isPalindrome("noon") should return
// true, but isPalindrome("night") should return false.
// Note that this implementation contains a deliberate bug.
public static boolean isPalindrome(String s) {
if (s.length() == 0) {
@sferik
sferik / and_or.rb
Last active December 31, 2015 14:49
class BasicObject
def &&(other)
other
end
def ||(other)
self
end
end
@dkubb
dkubb / eager_repository.rb
Last active May 13, 2019 21:10
Eager Loading DataMapper Associations
require 'memoist'
# Usage:
#
# customers = Customer.preload(Customer.orders.line_items.item)
#
# customers.each do |customer|
# customer.orders.each do |order|
# order.line_items.each do |line_item|
# line_item.item # yay, no more N+1, only 4 queries executed !