Skip to content

Instantly share code, notes, and snippets.

View harmittaa's full-sized avatar
💻
📲

Matti Mäki-Kihniä harmittaa

💻
📲
View GitHub Profile
{
"language": "android",
"jdk": "oraclejdk8",
"android": {
"components": [
"tools",
"tools",
"platform-tools",
"build-tools-24.0.2",
"android-19",
@harmittaa
harmittaa / .travis.yml
Last active November 22, 2020 05:38
Example .travis.yml file for Android
# Tutorial here: https://medium.com/@harmittaa/travis-ci-android-example-357f6e632fc4
language: android
sudo: required
jdk: oraclejdk8
before_cache:
- rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
- rm -fr $HOME/.gradle/caches/*/plugin-resolution/
@harmittaa
harmittaa / Cyber security project report
Last active November 3, 2022 17:59
Cyber security project report
Cyber Security Base - Course Project I
I made a web application to which users can register and login to submit comments.
Logged in users can logout, view their own profile, delete their own comments and
delete their account as well as create new comments.
The application includes five different security flaws from the OWASP’s 2013 10 Most Critical Web Application Security Risks
list (https://www.owasp.org/index.php/Top_10_2013-Top_10). The flaws are as follows:
A2 - Broken Authentication and Session Management
A3 - Cross-Site Scripting (XSS)
@harmittaa
harmittaa / CameraFocusController.cs
Last active July 21, 2023 00:49
CameraFocusController.cs for Vuforia ARCamera camera focus mode example
// full tutorial here:
// https://medium.com/@harmittaa/setting-camera-focus-mode-for-vuforia-arcamera-in-unity-6b3745297c3d
using UnityEngine;
using System.Collections;
using Vuforia;
public class CameraFocusController: MonoBehaviour {
// code from Vuforia Developer Library
@harmittaa
harmittaa / ButtonWithImage.swift
Created October 5, 2017 06:18
UIButton with label and right aligned image
import UIKit
class ButtonWithImage: UIButton {
override func layoutSubviews() {
super.layoutSubviews()
if imageView != nil {
imageEdgeInsets = UIEdgeInsets(top: 5, left: (bounds.width - 35), bottom: 5, right: 5)
titleEdgeInsets = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: (imageView?.frame.width)!)
}
@harmittaa
harmittaa / ExamplePreferences.kt
Created July 13, 2019 14:11
Koin 2.0 example module
import android.content.Context
import android.content.SharedPreferences
import org.koin.android.ext.koin.androidContext
import org.koin.dsl.module
val prefModule = module {
single { ExamplePreferences(androidContext()) }
}
class ExamplePreferences(context: Context) {
@harmittaa
harmittaa / MainActivity.kt
Created July 13, 2019 14:30
Koin 2.0 example Activity
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import com.github.harmittaa.koinexample.R
import com.github.harmittaa.koinexample.fragment.ExampleFragment
import com.github.harmittaa.koinexample.persistence.ExamplePreferences
import org.koin.android.ext.android.inject
class MainActivity : AppCompatActivity() {
private val preferences: ExamplePreferences by inject()
private val exampleFragment: ExampleFragment by inject()
@harmittaa
harmittaa / ExampleFragment.kt
Created July 13, 2019 14:51
Koin 2.0 example fragment
import android.os.Bundle
import android.util.Log
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.fragment.app.Fragment
import androidx.lifecycle.Observer
import com.github.harmittaa.koinexample.R
import org.koin.androidx.viewmodel.ext.android.viewModel
import org.koin.dsl.module
@harmittaa
harmittaa / ExampleViewModel.kt
Created July 13, 2019 14:53
Koin 2.0 example ViewModel
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
import com.github.harmittaa.koinexample.persistence.ExamplePreferences
import org.koin.dsl.module
val viewModelModule = module {
factory { ExampleViewModel(get()) }
}
class ExampleViewModel(preferences: ExamplePreferences) : ViewModel() {
@harmittaa
harmittaa / RetrofitClient.kt
Last active January 13, 2021 10:30
Koin 2.0 Retrofit example
import com.github.harmittaa.koinexample.BuildConfig
import okhttp3.OkHttpClient
import org.koin.dsl.module
import retrofit2.Retrofit
import retrofit2.converter.gson.GsonConverterFactory
val networkModule = module {
factory { AuthInterceptor() }
factory { provideOkHttpClient(get()) }
factory { provideForecastApi(get()) }