Skip to content

Instantly share code, notes, and snippets.

View DiegoGSantos's full-sized avatar

Diego Santos DiegoGSantos

  • will bank
  • Ribeirão Preto
View GitHub Profile
lateinit var server: MockWebServer
@Before
fun setUp() {
server = MockWebServer()
server.start()
}
@Test
fun test() {
testImplementation 'com.squareup.okhttp3:mockwebserver:(insert latest version)'
testCompile group: 'org.mockito', name: 'mockito-inline', version: '2.23.3'
testCompile group: 'org.mockito', name: 'mockito-core', version: '2.10.0'
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.diegosantos.constraintlayoutexample.MainActivity">
<View
android:id="@+id/leftLine"
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="vertical">
<LinearLayout
android:layout_width="wrap_content"
@DiegoGSantos
DiegoGSantos / getTranslateXY.js
Last active January 15, 2018 12:32
Get Translate XY with javascript
getTranslateXY(obj) {
const transArr = [];
if (window.getComputedStyle) {
const style = getComputedStyle(obj);
const transform = style.transform || style.webkitTransform || style.mozTransform;
let mat = transform.match(/^matrix3d\((.+)\)$/);
if (mat) return parseFloat(mat[1].split(', ')[13]);
mat = transform.match(/^matrix\((.+)\)$/);
if (mat) {