Skip to content

Instantly share code, notes, and snippets.

Avatar
💻
I love deadlines

Ng'ang'a Victor ngangavic

💻
I love deadlines
View GitHub Profile
View Notification.kt
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 Oct 8, 2020
Custom buton lines stack on each other.(No solution yet)
View custom_button.xml
<?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 Jun 17, 2020
Africas Talking Check Transaction
View CheckTransaction.java
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) {
View kilifi apartment finder
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
View contact.php
<?php
if(isset($_POST['name'])&&isset($_POST['email'])&&isset($_POST['message'])){
$name = $_POST["name"];
$email = $_POST["email"];
$message = $_POST["message"];
$to = "youremail@email.com";
$subject = "Message From $name";
$headers = "From: $name ".$email;
@ngangavic
ngangavic / stkpush.php
Created Jan 14, 2020
Lipa Na Mpesa Online php script
View stkpush.php
<?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 Dec 28, 2019
My Shop Privacy Policy
View myshop.txt
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 Dec 26, 2019
Mpesa Api Android dependency sample Activity file
View MainActivity.java
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 Nov 11, 2019
Get IP Address of a computer using computer name
View IpAddress.java
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());
}
}
View white_line_arrow.xml
<?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