Skip to content

Instantly share code, notes, and snippets.

@thetekst
thetekst / .gitignore
Last active April 19, 2018 09:23
gradle Spring Boot 2 setup
/.gradle/
/.idea/
/build/
**/*.iml
**/target/
**/out
**/log
@thetekst
thetekst / Child.java
Created April 7, 2018 20:31
powermock. мокаем конструктор внутри класса
package ru;
import lombok.Data;
/**
* Created by Dmitry Tkachenko on 4/7/18
*/
@Data
public class Child {
@thetekst
thetekst / Car.java
Created April 2, 2018 13:00
PowerMockito mock constructor
package ru.test;
/**
* Created by Dmitry Tkachenko on 02.04.18
*/
public class Car {
public int test() {
Go go = new Go();
private static final String FILE_SRC_PATH = "src/main/resources/logo.jpg";
private static final String FILE_DEST_PATH = "src/main/resources/logo-copy.jpg";
// копируем jpg-изображение
// не работает
// исходное изображение 13.1 kB
// новое изображение размером:
// 1. при условии (len = fin.read()) != -1 равняется 1.6MB
// 2. при условии (len = fin.read()) > 0 равняется 950 byte
try(FileInputStream fin = new FileInputStream(FILE_SRC_PATH);
public static int rand6() {
int max = 6;
int min = 1;
Random rand = new Random();
return rand.nextInt(max) + min;
}
private static int rand7() {
int sum = 0;
@thetekst
thetekst / gist:6485658
Created September 8, 2013 15:32
MODX-Revolution-2 / MainMenu with chunk
<!-- Menu BEGIN -->
<div class="widthController">
[[!Wayfinder?
&startId=`0`
&outerTpl=`outerTpl`
&outerClass=`font-normal`
&rowTpl=`rowTpl`
&innerTpl=`innerTpl`
&innerRowTpl=`innerRowTpl`
&hereTpl=`hereTpl`
@thetekst
thetekst / gist:6485649
Created September 8, 2013 15:31
MODX-Revolution-2 / MainMenu
<!-- Menu BEGIN -->
<div class="widthController">
<ul id="MainMenu" class="font-normal">
<li><a href="">О компании</a></li>
<li><a href="">Фотоальбом</a></li>
<li><a href="">Контакты</a></li>
</ul>
</div>
<!-- Menu END -->
@thetekst
thetekst / gist:6485583
Created September 8, 2013 15:22
MODX-Revolution-2 / hereTpl
<li [[+wf.classes]]><span>[[+wf.linktext]]</span>[[+wf.wrapper]]</li>
@thetekst
thetekst / gist:6485071
Last active December 22, 2015 14:19
MODX-Revolution-2 / menuLIChild chunks
<li [[+wf.classes]]>
<a href="[[+wf.link]]" title="[[+wf.title]]" [[+wf.attributes]]>[[+wf.linktext]]</a>
[[+wf.wrapper]]
</li>
@thetekst
thetekst / gist:6485052
Created September 8, 2013 14:20
MODX-Revolution-2 / menuULChild chunks
<ul>[[+wf.wrapper]]</ul>