Top "Dry" questions

Don't Repeat Yourself, a software development philosophy which aims at reducing redundancy and code repetition.

Java error: Implicit super constructor is undefined for default constructor

I have a some simple Java code that looks similar to this in its structure: abstract public class BaseClass { String …

java inheritance dry boilerplate
How to make a char string from a C macro's value?

For example, how to avoid writing the 'func_name' twice? #ifndef TEST_FUN # define TEST_FUN func_name # define TEST_…

c c-preprocessor dry
What's the recommended way to extend AngularJS controllers?

I have three controllers that are quite similar. I want to have a controller which these three extend and share …

javascript angularjs dry
Can I inherit constructors?

I know it's not possible to inherit constructors in C#, but there's probably a way to do what I want …

c# dry
How to repeat a "block" in a django template

I want to use the same {% block %} twice in the same django template. I want this block to appear more …

django django-templates dry
DRY Ruby Initialization with Hash Argument

I find myself using hash arguments to constructors quite a bit, especially when writing DSLs for configuration or other bits …

ruby initialization dry idioms
How to reuse beforeEach/afterEach in Jasmine JS?

When writing tests with JasmineJS I have many tests that have similar beforeEach/afterEach code. Is there a way to …

javascript testing jasmine dry
Declare and initialize pointer concisely (i. e. pointer to int)

Given pointers to char, one can do the following: char *s = "data"; As far as I understand, a pointer variable …

c pointers dry
How to elegantly symbolize_keys for a 'nested' hash

Consider the following code: hash1 = {"one" => 1, "two" => 2, "three" => 3} hash2 = hash1.reduce({}){ |h, (k,v)| h.merge(k =&…

ruby-on-rails ruby hash dry
Rails 3 - Restricting formats for action in resource routes

I have a resource defined in my routes. resources :categories And I have the following in my Category controller: def …

ruby ruby-on-rails-3 resources routes dry