Skip to content

Instantly share code, notes, and snippets.

View ngangavic's full-sized avatar
💻
I love deadlines

Ng'ang'a Victor ngangavic

💻
I love deadlines
View GitHub Profile
private fun sendNotification(messageBody: String) {
val channelId = getString(R.string.default_notification_channel_id)
val defaultSoundUri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION)
val notificationBuilder = NotificationCompat.Builder(this, channelId)
.setSmallIcon(R.drawable.ic_stat_name)
.setContentTitle(getString(R.string.fcm_message))
.setContentText(messageBody)
.setAutoCancel(true)
.setSound(defaultSoundUri)
@ngangavic
ngangavic / custom_button.xml
Created October 8, 2020 08:13
Custom buton lines stack on each other.(No solution yet)
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:top="-6dp"
android:left="-6dp"
android:right="-6dp"
android:bottom="5dp">
<shape android:shape="rectangle">
<stroke android:color="#9FB3CF" android:width="3dp"/>
</shape>
@ngangavic
ngangavic / CheckTransaction.java
Created June 17, 2020 11:45
Africas Talking Check Transaction
package africastalking;
import com.africastalking.AfricasTalking;
import com.africastalking.PaymentService;
import com.africastalking.payment.Transaction;
import com.africastalking.payment.response.CheckoutResponse;
public class CheckTransaction {
public static void main(String[] args) {
Privacy Policy
Kilifi Apartment Finder app is a Free app. This SERVICE is provided by ngangavic at no cost and is intended for use as is.
This page is used to inform visitors regarding my policies with the collection, use, and disclosure of Personal Information if anyone decided to use my Service.
If you choose to use my Service, then you agree to the collection and use of information in relation to this policy. The Personal Information that I collect is used for providing and improving the Service. I will not use or share your information with anyone except as described in this Privacy Policy.
The terms used in this Privacy Policy have the same meanings as in our Terms and Conditions, which is accessible at MyShop unless otherwise defined in this Privacy Policy.
Information Collection and Use
<?php
if(isset($_POST['name'])&&isset($_POST['email'])&&isset($_POST['message'])){
$name = $_POST["name"];
$email = $_POST["email"];
$message = $_POST["message"];
$to = "[email protected]";
$subject = "Message From $name";
$headers = "From: $name ".$email;
@ngangavic
ngangavic / stkpush.php
Created January 14, 2020 09:22
Lipa Na Mpesa Online php script
<?php
//Authenticate your app-----Access Token
$consumerKey='';
$consumerSecret='';
$headers=['Content-Type:application/json; charset=utf8'];
$url = 'https://sandbox.safaricom.co.ke/oauth/v1/generate?grant_type=client_credentials';
$curl = curl_init($url);
curl_setopt($curl,CURLOPT_HTTPHEADER,$headers);
curl_setopt($curl,CURLOPT_RETURNTRANSFER,true);
curl_setopt($curl,CURLOPT_HEADER,false);
@ngangavic
ngangavic / myshop.txt
Last active December 28, 2019 14:34
My Shop Privacy Policy
Privacy Policy
MyShop app is a Free app. This SERVICE is provided by ngangavic at no cost and is intended for use as is.
This page is used to inform visitors regarding my policies with the collection, use, and disclosure of Personal Information if anyone decided to use my Service.
If you choose to use my Service, then you agree to the collection and use of information in relation to this policy. The Personal Information that I collect is used for providing and improving the Service. I will not use or share your information with anyone except as described in this Privacy Policy.
The terms used in this Privacy Policy have the same meanings as in our Terms and Conditions, which is accessible at MyShop unless otherwise defined in this Privacy Policy.
Information Collection and Use
@ngangavic
ngangavic / MainActivity.java
Last active December 26, 2019 21:07
Mpesa Api Android dependency sample Activity file
package com.example.mpesaapi;
import android.os.Build;
import android.os.Bundle;
import android.os.StrictMode;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;
import androidx.annotation.RequiresApi;
@ngangavic
ngangavic / IpAddress.java
Created November 11, 2019 11:43
Get IP Address of a computer using computer name
import java.net.InetAddress;
public class IpAddress {
public static void main(String args[]) throws Exception{
InetAddress inetAddress = InetAddress.getByName("HOME-OFFICE");
System.out.println(inetAddress.getHostAddress());
}
}
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:viewportWidth="700"
android:viewportHeight="35"
android:width="700dp"
android:height="35dp">
<path
android:pathData="M111.85 14.61L118.88 28.65L104.83 28.65L90.79 28.65L97.81 14.61L104.83 0.56L111.85 14.61Z"
android:fillColor="#ffffff" />
<path