Skip to content

Instantly share code, notes, and snippets.

View sizovs's full-sized avatar
🌴
Mentoring software developers @ principal.dev

Eduards Sizovs sizovs

🌴
Mentoring software developers @ principal.dev
View GitHub Profile
package fm.ask.domain.impl.question.templating;
import com.rubylight.dao.IDAOInstantiate;
import com.rubylight.dao.composite.CompositeDAOFactory;
import com.rubylight.dao.composite.SingleDAOFactoryInstanstiate;
import com.rubylight.dao.connection.IConnectionLookup;
import com.rubylight.dao.connection.IConnectionLookupFactory;
import com.rubylight.dao.observer.IDAOCallObserver;
import fm.ask.dao.AskfmDBConfigurationProvider;
import fm.ask.dao.EntityType;
@RandomDAO(EntityType.SIMPLE_ENTITY)
@Slave
class DailyQuestionTemplateDAOImpl extends AEntityDAOMySQL<Long, DailyQuestionDTO> implements
DailyQuestionTemplateDAO {
private final DailyQuestionDTORowReader dailyQuestionDTORowReader;
private final DailyQuestionTemplateRowReader dailyQuestionTemplateRowReader;
public DailyQuestionTemplateDAOImpl(IConnectionLookup<Connection> lookup) {
super(lookup);
public class DailyQuestionTemplateRowReader extends OrmRowReader<DailyQuestionTemplate> {
public DailyQuestionTemplateRowReader() {
super(new ColumnMappingBuilder<>(DailyQuestionTemplate.class)
.map("id").reader(new DailyQuestionTemplateIdColumnReader())
.map("text", "question_text")
.map("sponsorText")
.map("displayOn")
.map("createdAt"));
}
for f in $(find ABSOLUTE_PATH_TO_TRAVERSAL_ROOT -name '*.class'); do javap -c $f | sed -En 's/ [a-z]+[a-zA-Z0-9]*\(([a-zA-Z0-9,]+.?)*);/&/p' ; done | wc -l
String[] printingTokenizer(String tokenizable) {
String[] tokens = tokenizer(tokenizable);
if (tokens != null) {tokens.each(System::out::println) }
return tokens;
}
def "returns null if there is nothing to tokenize"() {
expect:
tokenizer.tokenize(tokenizable) == result
where:
tokenizable || result
null || null
"" || null
}
String[] tokenize(String tokenizable) {
if (tokenizable == null || tokenizable.isEmpty()) {
return null;
}
tokenize ...
}
@Retention(RetentionPolicy.RUNTIME)
@Target([ElementType.FIELD, ElementType.CONSTRUCTOR, ElementType.METHOD, ElementType.ANNOTATION_TYPE, ElementType.PARAMETER])
@BindingAnnotation
@AutoBind
@interface MySQL {
String databaseName()
}
package fm.ask.components.counter;
import static org.joda.time.Duration.standardDays;
import org.joda.time.Duration;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import com.rubylight.conf.ConfFacade;
package fm.ask.components.counter;
import static org.joda.time.Duration.standardDays;
import org.joda.time.Duration;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import com.rubylight.conf.IConfProperty;