Skip to content

Instantly share code, notes, and snippets.

@gnumilanix
gnumilanix / AbstractRealmPrimitiveTypeAdapter.java
Created April 5, 2016 02:18
Realm Primitive Wrapper for GSON
package com.realm.primitive.adapter;
import com.realm.primitive.RealmBoolean;
import com.realm.primitive.RealmDouble;
import com.realm.primitive.RealmInteger;
import com.realm.primitive.RealmLong;
import com.realm.primitive.RealmString;
import com.google.gson.TypeAdapter;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;
@gnumilanix
gnumilanix / KeyboardDismissingRecyclerView.java
Created February 28, 2017 04:57
Implementation of RecyclerView that will dismiss keyboard when scrolling.
package com.lalamove.core.view;
import android.content.Context;
import android.support.annotation.Nullable;
import android.support.v7.widget.RecyclerView;
import android.util.AttributeSet;
import android.view.inputmethod.InputMethodManager;
/**
* Implementation of {@link RecyclerView} that will dismiss keyboard when scrolling.
@gnumilanix
gnumilanix / CircleLayout.java
Last active May 15, 2017 08:27
Implementation of FrameLayout that can wrap any components within with a circle bezel.
package com.milanix.view;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Path;
import android.os.Build;
import android.support.annotation.RequiresApi;
import android.util.AttributeSet;
@gnumilanix
gnumilanix / ProgressChromeClient.java
Last active June 2, 2017 01:52
Implementation of WebViewClient that can be used to monitor/show/hide progress
import android.annotation.TargetApi;
import android.graphics.Bitmap;
import android.webkit.WebResourceError;
import android.webkit.WebResourceRequest;
import android.webkit.WebView;
import android.webkit.WebViewClient;
/**
* Extension of {@link WebViewClient} that can update caller about changes in the loading progress
*
public class CheckableImageView extends AppCompatImageView implements Checkable {
private boolean isChecked;
private OnUpdateImageListener onUpdateImageListener;
public CheckableImageView(Context context) {
super(context, null);
}
public CheckableImageView(Context context, AttributeSet attrs) {
super(context, attrs, 0);
@gnumilanix
gnumilanix / ProgressLayout.java
Last active August 20, 2017 02:28
Implementation of FrameLayout that can show progress with in the entire layout
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.ObjectAnimator;
import android.animation.TypeEvaluator;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Path;
import android.graphics.RectF;
@gnumilanix
gnumilanix / StepperView.java
Created August 20, 2017 02:29
View that allows incrementing or decrementing values
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.annotation.RequiresApi;
import android.util.AttributeSet;
import android.view.ViewGroup;
import android.widget.ImageView;

Software Engineer Challenge (Backend)

Introduction

In LalaFood, we are receiving order of delivery day and night. As a software engineer in LalaFood, you have to provide a reliable backend system to clients. Your task here is to implement three endpoints to list/place/take orders.

Requirement

  1. We value a clean, simple working solution.
  2. The application must be run in Docker, candidate must provide docker-compose.yml, which should setup all relevant services/applications.
@gnumilanix
gnumilanix / 2c2p hash.kt
Created August 27, 2020 01:31
Hash function for 2c2p
fun generateHash(data: String, key: String, algorithm: String): String {
val secretKeySpec = SecretKeySpec(key.toByteArray(), algorithm.type)
val mac = Mac.getInstance(algorithm)
mac.init(secretKeySpec)
return Hex.encodeHexString(mac.doFinal(data.toByteArray()))
}
@gnumilanix
gnumilanix / README.md
Last active February 23, 2023 03:17
Mounting EFS volume to ECS task (EC2) with Terraform

This gist provides a sample terraform configuration to use EFS volume in ECS task running on EC2:

  1. Create a security group A for service B
  2. Create a security group for EFS to allow B
  3. Create EFS file system C and mount target on multiple subnets
  4. Create ECS task D with EFS volume C
  5. Create ECS service for ECS task C with security group A