This file contains hidden or 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
Condition condition; | |
List<ConsumedDvdWithTotal> answer; | |
Map<String, Object> bindParams = new HashMap<>(); | |
List<Condition> conditions = new ArrayList<>(); | |
if (params.hasYear()) { | |
condition = condition("EXTRACT(YEAR FROM date_released) = :year"); | |
bindParams.put("year", params.getYear()); | |
if (params.hasMonth()) { |
This file contains hidden or 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
//ng-bind-html="page.html | to_trusted" | |
angular.module("common") | |
.filter("to_trusted", function ($sce) { | |
return function (text) { | |
return $sce.trustAsHtml(text); | |
}; | |
}); |
This file contains hidden or 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
List<Object[]> params = links | |
.stream() | |
.map(o -> new Object[] {o.getTagId(), o.getTagOriginalId()}) | |
.collect(Collectors.toList()); | |
jdbcTemplate.batchUpdate("UPDATE tag_original SET tag_id = ? WHERE id = ?", params); |
This file contains hidden or 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
import org.skife.jdbi.v2.StatementContext | |
import org.skife.jdbi.v2.tweak.ResultSetMapper | |
import java.sql.ResultSet | |
import java.sql.SQLException | |
/** | |
* Created by fbelov on 17.03.15. | |
*/ | |
class MapJdbiMapper implements ResultSetMapper<Map> { |
This file contains hidden or 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
angular.module("app") | |
.factory("_authInterceptor", function($q, _authStorage) { | |
return { | |
request: function (req) { | |
req.headers["X-Access-Control-Token"] = _authStorage.get().token; | |
return req; | |
}, | |
responseError: function(rejection) { | |
var status = rejection.status; |
This file contains hidden or 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
package com.devadmin.util.metrics | |
import org.springframework.context.annotation.Configuration | |
import org.springframework.context.annotation.ImportResource | |
import org.springframework.test.context.ContextConfiguration | |
import org.springframework.test.context.transaction.TransactionConfiguration | |
import org.springframework.transaction.annotation.Transactional | |
import spock.lang.Specification | |
@Configuration |
This file contains hidden or 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
return dvds | |
.request() | |
.accept(MediaType.APPLICATION_JSON) | |
.get(new GenericType<List<ConsumedDvd>>(){}) |
This file contains hidden or 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 gulp = require("gulp"); | |
var del = require("del"); | |
var path = require("path"); | |
var lazypipe = require("lazypipe"); | |
var $ = require("gulp-load-plugins")({lazy: false}); | |
var paths = { | |
src: "./src", | |
assets: { | |
src: "./assets", |
This file contains hidden or 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
@JsonDeserialize(converter=MyClassSanitizer.class) // invoked after class is fully deserialized | |
public class MyClass { | |
public String field1; | |
} | |
import com.fasterxml.jackson.databind.util.StdConverter; | |
public class MyClassSanitizer extends StdConverter<MyClass,MyClass> { | |
@Override | |
public MyClass convert(MyClass var1) { | |
var.field1 = munge(var.field1); |
This file contains hidden or 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
JacksonJsonProvider jacksonJsonProvider = new JacksonJaxbJsonProvider(); | |
ObjectMapper objectMapper = new ObjectMapper() | |
.setPropertyNamingStrategy(PropertyNamingStrategy.CAMEL_CASE_TO_LOWER_CASE_WITH_UNDERSCORES) | |
.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false) | |
.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false); | |
jacksonJsonProvider.setMapper(objectMapper); | |
client = ClientBuilder.newClient().register(jacksonJsonProvider); |