Skip to content

Instantly share code, notes, and snippets.

View houssemzaier's full-sized avatar

Houssem Zaier houssemzaier

View GitHub Profile
@houssemzaier
houssemzaier / SCSS_.idea_.name
Created October 30, 2014 07:23
sass working good on the webstorm
SCSS
@houssemzaier
houssemzaier / Application.groovy
Created March 3, 2016 15:42 — forked from ethankhall/Application.groovy
Auth0 Spring Boot Java Config
package com.example
import groovy.util.logging.Slf4j
import org.springframework.boot.SpringApplication
import org.springframework.boot.autoconfigure.EnableAutoConfiguration
import org.springframework.context.ApplicationContext
import org.springframework.context.annotation.ComponentScan
import org.springframework.context.annotation.Configuration
import org.springframework.context.annotation.Import
import org.springframework.web.servlet.config.annotation.EnableWebMvc
@houssemzaier
houssemzaier / spark.md
Created May 23, 2016 20:48 — forked from jesperfj/spark.md
Spark on Heroku

This guide will get you started using Spark on Heroku/Cedar. Spark is basically a clone of Sinatra for Java. 'Nuff said.

Create your app

Create a single Java main class in src/main/java/HelloWorld.java:

:::java
import static spark.Spark.*;
import spark.*;
@houssemzaier
houssemzaier / LoginScreen.java
Last active September 21, 2017 09:19 — forked from lparoli/LoginScreen
Screen Object Pattern class example
package qa.com.espressospoonstructure.screenObjects;
import android.support.test.espresso.ViewInteraction;
import org.hamcrest.Matcher;
import static android.support.test.espresso.Espresso.onView;
import static android.support.test.espresso.action.ViewActions.clearText;
import static android.support.test.espresso.action.ViewActions.click;
import static android.support.test.espresso.action.ViewActions.scrollTo;
@houssemzaier
houssemzaier / TestLogin.java
Created September 21, 2017 15:39 — forked from lparoli/TestLogin
Class example for testing a Login screen using Screen Object Pattern & JUnit4.
package qa.com.espressospoonstructure.tests;
import org.junit.Test;
import qa.com.espressospoonstructure.screenObjects.LoginScreen;
import static android.support.test.espresso.assertion.ViewAssertions.matches;
import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed;
public class TestLoginScreen extends BaseTestCase<MainActivity> {
@houssemzaier
houssemzaier / sample_dsl_with_kotlin.kt
Last active November 21, 2017 12:23
sample dsl with kotlin
package com.example.hzaier.myapplicationkt.dsl
import org.junit.Test
interface Matcher<T> {
fun test(lhs: T)
infix fun or(other: Matcher<T>): Matcher<T> = object : Matcher<T> {
override fun test(lhs: T) {
@houssemzaier
houssemzaier / ApiResponse.java
Created May 4, 2018 15:02 — forked from AkshayChordiya/ApiResponse.java
LiveData adapter for Retrofit
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.util.ArrayMap;
import java.io.IOException;
import java.util.Collections;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@houssemzaier
houssemzaier / ApiResponse.java
Created May 4, 2018 15:02 — forked from AkshayChordiya/ApiResponse.java
LiveData adapter for Retrofit
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.util.ArrayMap;
import java.io.IOException;
import java.util.Collections;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@houssemzaier
houssemzaier / main.kt
Created July 26, 2018 21:13
This sample shows replayed response (that could have a param) from an Observable Subject used like a proxy between the client and original Observable
import io.reactivex.Observable
import io.reactivex.subjects.PublishSubject
import java.util.*
fun main(args: Array<String>) {
val vm = VM(Repo())
vm.observableData.subscribe {
println("from sub1 $it")
}
Thread.sleep(3333)
@houssemzaier
houssemzaier / SticktModeUtil.kt
Created February 9, 2020 22:23
This solution gives the possibility to just hide the "android.os.strictmode.UntaggedSocketViolation" or just log it in a verbose lever, which I prefer.
@RequiresApi(Build.VERSION_CODES.P)
fun StrictMode.VmPolicy.Builder.detectAllExpect(ignoredViolationPackageName: String, justVerbose: Boolean = true): StrictMode.VmPolicy.Builder {
return detectAll()
.penaltyListener(Executors.newSingleThreadExecutor(), StrictMode.OnVmViolationListener
{
it.filter(ignoredViolationPackageName, justVerbose)
})
}