Skip to content

Instantly share code, notes, and snippets.

@adrielAd
adrielAd / ConnectDotsView.java
Created October 11, 2017 13:37 — forked from lecho/ConnectDotsView.java
Connect dots android view.
public class ConnectDotsView extends View {
private Bitmap mBitmap;
private Canvas mCanvas;
private Path mPath;
private Paint mPaint;
private static final int TOUCH_TOLERANCE_DP = 24;
private static final int BACKGROUND = 0xFFDDDDDD;
private List<Point> mPoints = new ArrayList<Point>();
private int mLastPointIndex = 0;
@adrielAd
adrielAd / Create Digest.java
Created July 4, 2018 06:02
digest for calling api in fibodo
public static String getDigest(String url){
StringBuilder stringBuilder = new StringBuilder();
String username = String.format("username=\"%1$s\"", BuildConfig.username);
String realm = String.format("realm=\"%1$s\"", BuildConfig.realm);
long nonceTime = Calendar.getInstance(TimeZone.getTimeZone("UTC")).getTimeInMillis()/1000;
String nonce = String.format("nonce=\"%1$d\"", nonceTime);
String uri = String.format("uri=\"%1$s\"", BuildConfig.api_path + BuildConfig.version + url);
String HA1 = md5(BuildConfig.username + ":" + BuildConfig.realm + ":" + BuildConfig.password);
String HA2 = md5("POST:"+ url);
@adrielAd
adrielAd / AroundMeFragment.java
Created August 9, 2018 07:24
around me with circle radius
package in.bazzme.fragments;
import android.annotation.SuppressLint;
import android.annotation.TargetApi;
import android.app.Activity;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.pm.PackageManager;
// make listEmails global and also initialise this in onCreate so you get already saved emails when you come to this screen
ArrayList<String> listEmails;
public void getDataForId() {
SharedPreferences authToken = getSharedPreferences("authToken", Context.MODE_PRIVATE);
String token = authToken.getString("token", "");
apiInterface = ApiClient.getApiClient().create(ApiInterface.class);
Call<UserResponse> call = apiInterface.getData("Bearer " + token);
@adrielAd
adrielAd / gist:cca6696c0474ec5198317ef10c31e42c
Created September 9, 2019 13:05 — forked from roundrop/gist:1432442
A sample to shorten url using Google URL Shortener API.
package jp.roundrop.util;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLEncoder;
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2">
<Document>
<Collection>
<title>AD-0 Andorra</title>
<groups>Group 1, Group2</groups>
<description>Description of location</description>
<info>An expanded description of the collection that may provide further, usually technical, information.</info>
<links>The links to be offered when presenting the collection.</links>
<type>Whether the collection is free of charge or its payment level.</type>
@SerializedName("golf_landing_page_title")
@Expose
private String golfLandingPageTitle = "My Golf";
@SerializedName("golf_history")
@Expose
private String golfHistory = "History";
@SerializedName("golf_bookings")
@Expose
@adrielAd
adrielAd / Live Payment
Created August 25, 2021 11:23
Payment Request Response
URL - https://oppwa.com/v1/
Request -
entityId=8ac9a4cb66aafd790166ceedc52b1884&amount=0.15&currency=JOD&paymentType=DB&merchantTransactionId=16118_1629890067&customParameters[branch_id]=1&customParameters[teller_id]=1&customParameters[device_id]=1&customParameters[bill_number]=16118_1629890067&card.number=xxxxxxxxxxxxxx43&card.holder=Mahan&card.expiryMonth=xx&card.expiryYear=xxxx&card.cvv=xxx&paymentBrand=VISA&shopperResultUrl=https://theoutfit.me/module/webservices/validation?method=VISA&shipping.city=B3Building&shipping.country=JO&shipping.customer.givenName=Neerav&shipping.customer.surname=Ahuja&shipping.street1=B3Building#51SaeedPenoStreet&shipping.street2=B3Building#51SaeedPenoStreet&billing.city=B3Building&billing.country=JO&customer.givenName=Neerav&customer.surname=Ahuja&billing.street1=B3Building#51SaeedPenoStreet&billing.street2=B3Building#51SaeedPenoStreet
Response -
{"id":"8ac9a4a37b7c3a8a017b7d04be68628d","paymentType":"DB","paymentBrand":"VISA","amount":"0.15","currency":"JOD","descriptor":"09
Sub EmailAll()
Dim oApp As Object
Dim oMail As Object
Dim SendToName As String
Dim theSubject As String
Dim theBody As String
For Each c In Selection 'loop through (manually) selected records
'''For each row in selection, collect the key parts of
'''the email message from the Table