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
Source : https://stackoverflow.com/questions/44200720/difference-between-mock-mockbean-and-mockito-mock | |
Plain Mockito library | |
import org.mockito.Mock; | |
... | |
@Mock | |
MyService myservice; | |
and |
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
// Source: https://stackoverflow.com/questions/16467685/difference-between-mock-and-injectmocks | |
@Mock creates a mock. @InjectMocks creates an instance of the class and injects the mocks that are created with the @Mock (or @Spy) annotations into this instance. Note that you must use @RunWith(MockitoJUnitRunner.class) or Mockito.initMocks(this) to initialise these mocks and inject them. | |
@RunWith(MockitoJUnitRunner.class) | |
public class SomeManagerTest { | |
@InjectMocks | |
private SomeManager someManager; |
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
//pom.xml | |
<dependency> | |
<groupId>com.h2database</groupId> | |
<artifactId>h2</artifactId> | |
<version>1.4.194</version> | |
</dependency> | |
//src/test/resoures/application.properties | |
spring.datasource.driver-class-name=org.h2.Driver | |
spring.datasource.url=jdbc:h2:mem:db;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE |
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 React, {Component} from 'react'; | |
import 'bootstrap/dist/css/bootstrap.css'; | |
import 'font-awesome/css/font-awesome.css' | |
import './App.css'; | |
import $ from "jquery"; | |
window.jQuery = window.$ = $; | |
window.Popper = require('popper.js').default | |
require("bootstrap"); |
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
# filter an array | |
# version 1 | |
areas = ["hallway", 11.25, "kitchen", 18.0, "living room", 20.0, "bedroom", 10.75, "bathroom", 9.50] | |
valid = lambda x: type(x) == float | |
sum = sum( filter (valid, areas) ) | |
# version 2 | |
out = [a for a in areas if type(a) != str] | |
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
# Pearson correlation coeficient | |
# x, y are two arrays | |
np.corrcoef(x,y)[0,1] | |
def ecdf(list): | |
""" | |
Empirical cumulative distribution function | |
Afterwards can be called | |
plt.plot(x, y, marker='.') | |
""" |
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
# Project: https://github.com/reactjs/react-timer-mixin | |
class Status extends Component { | |
constructor(props) { | |
super(props); | |
this.state = { | |
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
Kibana search criteria: | |
------------------------------------------------------ | |
type: http | |
http transition only | |
http.response.headers["content-type"]: *json | |
regex operator | |
responsetime: [10 TO *] | |
range with 10 including |
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
#!/usr/bin/env bash | |
# Script: Create folders need for a new groovy project | |
# Takes: One argument for package name. Example : /com/acme/marketing | |
# Created: August 19, 2016 | |
# Description: Based of the documentation from https://docs.gradle.org/current/userguide/groovy_plugin.html | |
if [ $# -ne 1 ] | |
then | |
echo "Usage: $0 <package_name>" |
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
# Crontab table entries | |
________________________ Minute of the Hour (0–59) | |
| ______________________ Hour of the Day (0–23) | |
| | ____________________ Day of the Month (1–31) | |
| | | __________________ Month of the Year (1–12) | |
| | | | ________________ Day of the Week (0 – 6 for Sunday through Saturday) | |
| | | | | ______________ Command to Execute (Full path is required) | |
| | | | | | | |
| | | | | | |