Skip to content

Instantly share code, notes, and snippets.

View marcusmotill's full-sized avatar
👋

Marcus Motill marcusmotill

👋
View GitHub Profile
@marcusmotill
marcusmotill / BitmapUtils.kt
Created March 12, 2016 18:36
Image compression for Android in Kotlin
class BitmapUtils {
companion object
}
fun BitmapUtils.Companion.getCompressedImage(pathName: String, scalingLogic: ImageView.ScaleType): String {
val options = BitmapFactory.Options()
options.inJustDecodeBounds = true
BitmapFactory.decodeFile(pathName, options)
options.inJustDecodeBounds = false
val dstWidth: Double = ((options.outWidth.toDouble() / (options.outWidth.toDouble() * options.outHeight.toDouble())) * 1000) * options.outWidth.toDouble()
@marcusmotill
marcusmotill / secureUserStorage.kt
Created March 12, 2016 18:46
Secure User Storage
class SecureUserStorage {
fun putUser(user: User, context: Context) {
val sharedpreferences = context.getSharedPreferences("userPrefs", Context.MODE_PRIVATE)
val crypto = Crypto(
SharedPrefsBackedKeyChain(context),
SystemNativeCryptoLibrary())
try {
val json = LoganSquare.serialize(user)
val cipherArray = crypto.encrypt(json.toByteArray(), Entity("user"))
var rootFolder = $firebaseObject(FolderService.getFolders($scope.courseID));
//reference to rootFolder is created and can be used, once the data is loaded
//it will show up in scope
//or wait till loaded like below
rootFolder.$loaded().then(function(){
//do stuff with rootFolder
})
...
getFolders: function(courseID) {
{
"login": {
"message": "If you are having trouble logging in please contact your account administrator."
},
"main.home": {
"message": "This is your course home, a general overview of your current course load and to-do"
},
"main.conversation": {
"message": "Welcome to your conversations! If you see nothing here try to create a conversations from the icon next to the one you just clicked!"
},
//settings

Actions

Action Life Cycle

Action Create, then...

  • User (click) Dismiss → Action state = dismiss, user will never see that action again
    • Dismiss event created
  • User (click) Complete → Action state = complete, user will never see that action again
    • Complete event created
  • Action definition indicates action is deprecated -> Action state = deprecate, user will never see that action again unless un-deprecated
  • Action definition indicates action is disabled -> Action state = deprecate, user will never see that action again unless enabled

Opportunity Close Date

{"##RANGE##":{"opportunity.closeDate":{"lte":"now-15M/d"}}}
OpportunityLineItem ContractLineItem WorkOrderLineItem
ConnectionReceivedId AssetId Address
ConnectionSentId Description AssetId
CurrencyIsoCode Discount City
Description EndDate Country
Discount LastReferencedDate CurrencyIsoCode
HasQuantitySchedule LastViewedDate Description
HasRevenueSchedule LineItemNumber Discount
HasSchedule ListPrice Duration
@marcusmotill
marcusmotill / sourceContentTypeByTeam.es
Created July 14, 2022 16:26
Query for seeing how many activity defs exist on a team for a given sourceContent type
{
"query": {
"bool": {
"must": [
{
"has_parent": {
"parent_type": "globalDefinition",
"score": true,
"query": {
"term": {