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
| 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
| 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
| //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
| 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
| client = ClientBuilder.newClient(); | |
| client.register(new LoggingFilter()); | |
| client.property(ClientProperties.CONNECT_TIMEOUT, timeoutInMillis); | |
| client.property(ClientProperties.READ_TIMEOUT, timeoutInMillis); |
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
| @Component | |
| @Provider | |
| public class SiteWithParamsConverterProvider implements ParamConverterProvider { | |
| @Autowired | |
| private Converter converter; | |
| @Override | |
| public <T> ParamConverter<T> getConverter(Class<T> rawType, Type genericType, Annotation[] annotations) { | |
| if (genericType.equals(SiteWithParams.class)) { |
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.ta.domain; | |
| import javax.ws.rs.DefaultValue; | |
| import javax.ws.rs.QueryParam; | |
| /** | |
| * Created by fbelov on 4/16/16. | |
| */ | |
| public class QueryParamWithDefaultValueRequest { |
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 resource="applicationContext.log.db.${log.to.db:false}.xml"/> | |
| //http://stackoverflow.com/questions/3035630/how-to-achieve-conditional-resource-import-in-a-spring-xml-context | |
| private void loadConditionalProperties() { | |
| try { | |
| Properties properties = new Properties(); | |
| try (InputStream stream = FileUtils.openInputStream(new File(getDefaultConfigPath()))) { | |
| properties.load(stream); | |
| } |
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
| <!-- http://stackoverflow.com/a/36707798 --> | |
| <appender name="main" class="ch.qos.logback.core.rolling.RollingFileAppender"> | |
| <file>/var/log/http-file-cache/cache.log</file> | |
| <encoder> | |
| <pattern>%d{HH:mm:ss.SSS} [%thread] [%X] %-5level %logger{36} - %msg%n</pattern> | |
| </encoder> | |
| <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"> | |
| <fileNamePattern>/var/log/http-file-cache/cache.%d{yyyy-MM-dd}.%i.log.gz</fileNamePattern> | |
| <maxFileSize>10MB</maxFileSize> | |
| <maxHistory>30</maxHistory> |