Interactive tool for creating directed graphs, created using d3.js.
Demo: http://bl.ocks.org/cjrd/6863459
Operation:
- drag/scroll to translate/zoom the graph
interface DispatcherProvider { | |
val mainImmediate: CoroutineDispatcher | |
val io: CoroutineDispatcher | |
val default: CoroutineDispatcher | |
val unconfined: CoroutineDispatcher | |
} |
class MainViewModel : ViewModel() { | |
private fun doIoOperation() = onIO { | |
// do your IO work here | |
} | |
private fun heavyCalculation() = onDefault { | |
// do your calculation here | |
} | |
// Implementation details omitted. Check out full sample | |
class DrawingCanvas: View(context) { | |
// When the user pinches the view, zoom in, when they reverse pinch the view, zoom out | |
private val scaleGestureDetector = ScaleGestureDetector(context, object : | |
ScaleGestureDetector.SimpleOnScaleGestureListener() { | |
override fun onScale(detector: ScaleGestureDetector?): Boolean { | |
detector?.let { | |
scaleX *= detector.scaleFactor | |
scaleY *= detector.scaleFactor |
Copyright (c) 2013 Ross Kirsling | |
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: |
Interactive tool for creating directed graphs, created using d3.js.
Demo: http://bl.ocks.org/cjrd/6863459
Operation:
import android.content.Context; | |
import android.content.pm.PackageInfo; | |
import android.content.pm.PackageManager; | |
import android.content.pm.PackageManager.NameNotFoundException; | |
import android.content.pm.Signature; | |
public class TamperCheck { | |
//we store the hash of the signture for a little more protection | |
private static final String APP_SIGNATURE = "1038C0E34658923C4192E61B16846"; |
import android.content.Context; | |
import android.content.pm.ApplicationInfo; | |
import android.content.pm.PackageInfo; | |
public class InstallerCheck{ | |
private static final String PLAY_STORE_APP_ID = "com.google.android"; | |
public static boolean verifyInstaller(final Context context) { |