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
public class TempConversion {
//fahren to cel
public int celsius(int fahrenheit) {
int cel = (fahrenheit-32)*5/9;
return cel;
}
@ngangavic
ngangavic / activity_login.xml
Last active November 9, 2019 18:50 — forked from polojerry/activity_login.xml
Login design for dating app
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<?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
@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());
}
}
@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 / 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 / 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);
<?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;
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
@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) {