Skip to content

Instantly share code, notes, and snippets.

View gauravrai1's full-sized avatar

Gaurav Rai gauravrai1

View GitHub Profile
@gauravrai1
gauravrai1 / ExampleRVAdapter.kt
Created May 14, 2021 11:07
Recycler View Template
class ExampleRVAdapter(
var data: List<String>? = null,
val context: Context? = null):
RecyclerView.Adapter<ExampleRVAdapter.ViewHolder>() {
override fun onCreateViewHolder(
parent: ViewGroup,
viewType: Int
): ViewHolder {
val view = LayoutInflater.from(parent.context)
@ruthlessfish
ruthlessfish / haversine.php
Created August 24, 2011 21:06
haversine formula for MySQL in PHP
<?php
function haversine($lat1, $long1, $lat2, $long2)
{
return "(3959 * acos(cos(radians($lat1)) * cos(radians($lat2)) * cos(radians($long2) - radians($long1)) + sin(radians($lat1)) * sin(radians($lat2))))";
}