Skip to content

Instantly share code, notes, and snippets.

@aemxn
aemxn / AppAPI.java
Created Aug 23, 2017
API interface
View AppAPI.java
package com.myapp.core.data.network;
interface AppAPI {
// other API interface
//POST Login user
@POST("user/login")
Call<LoginResponse> loginUser(@Body Login login);
View APIManager.java
package com.myapp.core.data.network;
public class APIManager {
private static APIManager sInstance;
private final AppAPI mApi;
public static APIManager getInstance() {
if (sInstance == null) {
@aemxn
aemxn / LoginResponse.java
Created Aug 23, 2017
LoginResponse model
View LoginResponse.java
public class LoginResponse {
private static final String KEY_SUCCESS = "success";
private static final String KEY_TOKEN = "token";
@SerializedName(KEY_SUCCESS)
private int success;
@SerializedName(KEY_TOKEN)
private String token;
View Login.java
public class Login {
private static final String KEY_USERNAME = "username";
private static final String KEY_PASSWORD = "password";
private static final String KEY_DEVICEID = "deviceid";
private static final String KEY_DEVICENAME = "devicename";
private static final String KEY_NOTIFICATIONTOKEN = "notificationtoken";
@SerializedName(KEY_USERNAME)
private String username;
@aemxn
aemxn / hide-timeline.user.js
Last active Apr 16, 2017
[UserScript] Hide Facebook news feed
View hide-timeline.user.js
// ==UserScript==
// @name Hide Yo' Feed
// @namespace https://gist.github.com/aimanbaharum/b8262ebcafdcdedd4461fdb4105c6b10
// @include https://*.facebook.com/
// @version 0.2
// @description Hide Facebook news feed like you never care seeing them! Facebook is still usable, news feed will be hidden, thus increasing productivity and never procrastinate anymore!
// @author aimanb
// @grant none
// ==/UserScript==
@aemxn
aemxn / fcm-test.php
Last active Feb 28, 2017
Simple FCM push notification PHP snippet
View fcm-test.php
<?php
$to =
"USER_PUSH_TOKEN_HERE";
$fields = array(
'to' => $to,
// custom payload for a client to handle
// use `notification` array for more general predefined key/value payload instead
'data' => array(
"title" => "test notification title " . rand(1, 1000),
"body" => "Christopher Edward Hansen (born September 13, 1959)[2] is an American television journalist. He is known for his work on Dateline NBC, in particular the former segment To Catch a Predator, which revolved around catching potential Internet sex predators using a sting operation. His also hosts Killer Instinct on Investigation Discovery, which documents homicide investigations.[3] He is also the new host of the syndicated show Crime Watch Daily. [4]<br/><br/><img src=\"http://www.kualalumpurpost.net/wp-content/uploads/2013/10/tpeli.jpg\">",
@aemxn
aemxn / ImageInputHelper.java
Created Jul 4, 2016 — forked from eluleci/ImageInputHelper.java
Android: Helper for Android for selecting image from gallery, taking a photo with camera and cropping image.
View ImageInputHelper.java
import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Environment;
import android.provider.MediaStore;
import android.support.v4.app.Fragment;
import android.util.Log;
import java.io.File;
import java.io.IOException;
View rx-google-maps.java
public class MainActivity extends AppCompatActivity
implements GoogleApiClient.ConnectionCallbacks,
GoogleApiClient.OnConnectionFailedListener {
private static final String TAG = MainActivity.class.getSimpleName();
private SupportMapFragment mapFragment;
private MapObservableProvider mapObservableProvider;
private CompositeSubscription subscriptions = Subscriptions.from();
private GoogleMap googleMap;
@aemxn
aemxn / speedtest-cli.py
Created Oct 28, 2015
Internet speed test python cli
View speedtest-cli.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 2012-2015 Matt Martz
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
@aemxn
aemxn / index.php
Created Jul 5, 2015
crud-slim-tutorial
View index.php
<?php
/**
* ROUTES:
* (Authorization header with api key is required for user session)
*
* /register
* method - post
* params - name, email, password
*