Skip to content

Instantly share code, notes, and snippets.

View basith374's full-sized avatar

Basith Kunimal basith374

View GitHub Profile
@basith374
basith374 / activity_main.xml
Created July 2, 2020 09:57
android webview splash
<?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"
tools:context=".MainActivity">
<WebView
android:id="@+id/webview"
@basith374
basith374 / MainActivity.kt
Created July 2, 2020 09:42
android webview splash
import kotlinx.android.synthetic.main.activity_main.webview;
import kotlinx.android.synthetic.main.activity_main.splash;
class MainActivity : Activity() {
private class MyWebViewClient() : WebViewClient() {
override fun onPageFinished(view: WebView?, url: String?) {
super.onPageFinished(view, url)
splash.setVisibility(View.INVISIBLE); // can't call function on this reference
@basith374
basith374 / MainActivity.kt
Created July 1, 2020 09:36
android webview
import kotlinx.android.synthetic.main.activity_main.webview;
class MainActivity : Activity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
webview.loadUrl("https://example.com")
@basith374
basith374 / GoogleMap.js
Created May 19, 2020 20:32
google maps wrapper
import React, { useEffect, useRef, useState } from "react";
import "./map.css";
import moment from "moment";
import _ from "lodash";
import { resolvePlugin } from "@babel/core";
/**
* geofences format
{
geofenceid: 1,
@basith374
basith374 / client.js
Created April 23, 2020 16:47
wserver test
const io = require('socket.io-client');
let url = 'https://config.intellicar.in/socket.io';
const sock = io.connect(url);
sock.on('connect', () => {
console.log('connect')
sock.disconnect();
});
@basith374
basith374 / download.js
Last active April 6, 2020 07:26
javascript file download
function downloadCSV(content, filename) {
download(content, 'text/csv', filename + '.csv')
}
/**
* @param {string} content - The file content in raw string format
* @param {string} type - The filetype eg. text/plain, application/json, image/svg
* @param {string} filename - The filename with extension
*/
function download(content, type, filename) {
@basith374
basith374 / credentials.lua
Created February 23, 2020 14:22
nodemcu lua websocket aws
-- Credentials
SSID = ""
PASSWORD = ""
@basith374
basith374 / places.js
Last active February 1, 2020 09:16
kannur places
[
{
"name": "Kannur",
"home": true
},
{
"name": "Payyanur",
"home": true
},
{
@basith374
basith374 / data.json
Created October 5, 2019 07:23
BBMP Waste Plants
[{"title":"13.03800000","lat":"13.03800000","lng":"77.56200000","icon":" http://maps.google.com/mapfiles/ms/icons/red.png","description":"<div class=\"panel panel-primary\"> <div class=\"panel-body\"><div> <label>Agency Name : </label><strong> Harish </strong> <br /></div><div> <label>Zone : </label><strong> East </strong> <br /></div><div> <label>Ward : </label><strong> 18 </strong> <br /></div><div> <label>Agency Address : </label><strong> Dollers colony, Near Storm water drain, Hebbal, bengalore-560024 </strong> <br /></div><div> <label>Phone Number : </label><strong> 9901269491 </strong> <br /></div><div> <label>Name of Facility : </label><strong> </strong> <br /></div><div> <label>Capacity : </label><strong> </strong> <br /></div></div></div>"},{"title":"13.04100000","lat":"13.04100000","lng":"77.58200000","icon":" http://maps.google.com/mapfiles/ms/icons/red.png","description":"<div class=\"panel panel-primary\"> <div class=\"panel-body\"><div> <label>Agency Name : </label><strong> Harish </
@basith374
basith374 / duration.js
Created May 21, 2019 12:05
moment better duration
export function duration(ms) {
if(!ms) return 'N/A';
if(ms < (60 * 1000)) {
let dur = Math.floor(ms / 1000);
if(dur < 2) return 'a second';
return dur + ' seconds';
}
if(ms < (60 * 60 * 1000)) {
let minutes = Math.floor(ms / 1000 / 60);
let seconds = Math.floor(ms % (1000 * 60) / 1000);