Skip to content

Instantly share code, notes, and snippets.

// Example of INotifyPropertyChanged
// * Other examples online were missing consumming the event itself.
// * https://learn.microsoft.com/en-us/dotnet/api/system.componentmodel.inotifypropertychanged.propertychanged
// Can try running this example at: https://dotnetfiddle.net/pWjjGo
using System;
using System.ComponentModel;
using System.Runtime.CompilerServices;

Stash only unstagged lines

git stash -k

Merge two stashes

https://stackoverflow.com/a/14506564/1244574

  1. Pop our 1st commit
    • git stash pop
  2. Make a temp commit, will undo at step 4.
    • git add . && git commit -am 'WIP'
  3. Pop our 2nd commit
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
apply plugin: 'androidx.navigation.safeargs'
apply plugin: 'io.fabric'
buildscript {
repositories {
maven { url 'https://plugins.gradle.org/m2/'}
}
@jkasten2
jkasten2 / build.gradle
Last active October 1, 2019 13:02 — forked from sannyo/build.gradle
OneSignalSDK version matching error when using google-services plugin
//App build.gradle
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'
android {
compileSdkVersion 27
/**** #### Problem This Solves #### ****/
// Sometimes libraries added with "compile" will include their own dependencies.
// This can conflict with specific versions in your project or cause automatic upgrades
// overriding your specified versions as gradle resolves the highest value.
// A simpile workaround is to use the `force` flag on compile to override specific modules
// however this can be a pain to hunt down and define if there are multipile modules and groups.
/**** 1. How to use *****/
// 1.1 Place this your app's buidle.gradle and it will force override
// all Google Play services (GMS) and Android Support Libraries versions.
// Singleton pattern - static way to get instance
// Example 1 - Basic
class ExampleClassName {
// A "companion object" is required to make "static" methods / properites.
companion object {
// Property - private stetter, internal getter
// @JvmStatic - Only required if used outside of Kotlin
@JvmStatic lateinit var instance: Context private set
}
}
@jkasten2
jkasten2 / DebugClasses.m
Last active November 23, 2016 00:22
Some Objective-c debug functions
void DumpProtocols(Class cls) {
unsigned count;
Protocol * __unsafe_unretained * pl = class_copyProtocolList(cls, &count);
for (unsigned i = 0; i < count; i++)
NSLog(@"Class %@ implements protocol <%s>", cls, protocol_getName(pl[i]));
free(pl);
@jkasten2
jkasten2 / AppDelegate.m
Last active November 10, 2016 08:06
OneSignal2.2.2_Swizzle_testing
/**
* Modified MIT License
*
* Copyright 2016 OneSignal
*
* 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
@jkasten2
jkasten2 / README.MD
Last active June 13, 2020 01:10
Use a local OneSignal SDK .aar file with Android Studio

Using a local onesignal.aar file

  1. Create a libs folder under the app directory in your project.
  2. Place onesignal.aar in the newly created app/libs directory.
  3. Open your project's root build.gradle file and add the folowing under repositories {...}.
flatDir {
  dirs 'libs'
}
  1. Open your app/build.gradle.
package com.onesignal.example;
import android.app.Application;
import android.util.Log;
import com.onesignal.OneSignal;
import org.json.JSONObject