Skip to content

Instantly share code, notes, and snippets.

Joshua Kovach shekibobo

Block or report user

Report or block shekibobo

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@shekibobo
shekibobo / StringFormatDetectorTest.kt
Last active Aug 27, 2019
Sample test of StringFormatDetector against equivalent Java and Kotlin classes
View StringFormatDetectorTest.kt
import com.android.tools.lint.checks.StringFormatDetector
import com.android.tools.lint.checks.infrastructure.LintDetectorTest
import com.android.tools.lint.detector.api.Detector
import com.android.tools.lint.detector.api.Issue
class StringFormatDetectorTest : LintDetectorTest() {
override fun getDetector(): Detector = StringFormatDetector()
override fun getIssues(): MutableList<Issue> = mutableListOf(
StringFormatDetector.ARG_COUNT,
@shekibobo
shekibobo / InjectableActivityScenario.kt
Created Jul 27, 2019 — forked from rharter/InjectableActivityScenario.kt
An ActivityScenario that allows you to use Dagger Android's automatic, lifecycle based injection without making your Application class `open`, or overriding it in tests.
View InjectableActivityScenario.kt
package com.pixite.pigment.testing
import android.app.Activity
import android.app.Instrumentation
import android.content.Context
import android.content.Intent
import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentActivity
import androidx.fragment.app.FragmentManager
import androidx.lifecycle.Lifecycle
@shekibobo
shekibobo / InjectableActivityScenario.kt
Created Jul 27, 2019 — forked from rharter/InjectableActivityScenario.kt
An ActivityScenario that allows you to use Dagger Android's automatic, lifecycle based injection without making your Application class `open`, or overriding it in tests.
View InjectableActivityScenario.kt
package com.pixite.pigment.testing
import android.app.Activity
import android.app.Instrumentation
import android.content.Context
import android.content.Intent
import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentActivity
import androidx.fragment.app.FragmentManager
import androidx.lifecycle.Lifecycle
@shekibobo
shekibobo / signingconfigs.gradle
Last active Apr 22, 2019
Load signing configs from secret keystore file for gradle build.
View signingconfigs.gradle
signingConfigs {
debug {
storeFile rootProject.file("signing/debug.keystore")
storePassword "android"
keyAlias "androiddebugkey"
keyPassword "android"
}
release {
def keystoreProperties = propertiesFrom("signing/keystore.properties")
@shekibobo
shekibobo / assembleDistribution.gradle
Created Apr 22, 2019
Assemble all distribution apks with filenames and copy the debug and release versions of each build flavor to an `apks` directory.
View assembleDistribution.gradle
task copyApks(type: Copy) {
["debug", "release"].each { type ->
from "build/outputs/apk/${type}/"
}
into "apks/all-${AppVersion.fullVersionCode}-${gitSha}"
include '**/*.apk'
rename { String filename ->
filename.replace("app-", "").replace(".apk", "-${AppVersion.fullVersionCode}-${gitSha}.apk")
}
}
@shekibobo
shekibobo / loadProperties.gradle
Created Apr 22, 2019
Load properties from a given file within the project.
View loadProperties.gradle
def propertiesFrom(filename) {
def properties = new Properties()
def file = rootProject.file(filename)
if (file.exists()) {
properties.load(new FileInputStream(file))
} else {
System.out.println("[WARNING] Properties file ${filename} not found. Returning empty properties.")
}
return properties
}
@shekibobo
shekibobo / ViewGroupExt.kt
Last active Apr 22, 2019
Fill a ViewGroup with items using a given layout. Easy to replace, reuses child views if possible.
View ViewGroupExt.kt
/**
Copyright 2019 Joshua Kovach
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
@shekibobo
shekibobo / CustomTypefaceSpan.kt
Created Feb 12, 2018
Collection of Extensions for String and SpannableString
View CustomTypefaceSpan.kt
package com.collectiveidea.util.string
import android.graphics.Paint
import android.graphics.Typeface
import android.text.TextPaint
import android.text.style.MetricAffectingSpan
class CustomTypefaceSpan(private val typeface: Typeface) : MetricAffectingSpan() {
override fun updateDrawState(drawState: TextPaint) = apply(drawState)
override fun updateMeasureState(paint: TextPaint) = apply(paint)
@shekibobo
shekibobo / LICENSE.md
Last active Feb 24, 2016
Sidekiq+Redis JobManager to allow querying and deleting jobs
View LICENSE.md

The MIT License (MIT)

Copyright (c) 2016 Joshua Kovach

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

@shekibobo
shekibobo / capybara.rb
Created Feb 3, 2016
Capybara to toggle poltergeist/selenium in RSpec features
View capybara.rb
require "capybara/poltergeist"
Capybara.asset_host = "http://localhost:3000"
Capybara.register_driver :poltergeist do |app|
Capybara::Poltergeist::Driver.new app, js_errors: true
end
Capybara.javascript_driver = :poltergeist
You can’t perform that action at this time.