Skip to content

Instantly share code, notes, and snippets.

View marlonlom's full-sized avatar
😎

Marlon López marlonlom

😎
View GitHub Profile
@marlonlom
marlonlom / ResultSetParserUtil.java
Last active February 27, 2024 11:07
A simple Java Utility for converting java.sql.ResultSet object and contents into some Output formats (JSON, XML) .
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import org.json.JSONArray;
import org.json.JSONObject;
/**
* Utility for converting ResultSets into some Output formats
*
* @author marlonlom
@marlonlom
marlonlom / LatLngConverter.kt
Last active September 17, 2023 22:56
LatLngConverter - Utility class for converting a coordinate into its DMS / Kotlin version
/*
* Copyright (c) 2023 Marlonlom
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
/*
* Copyright 2023 marlonlom
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
@marlonlom
marlonlom / Either.kt
Created March 20, 2023 19:27
Either.kt by Fernando Cejas Open Source Project
/**
* Copyright (C) 2019 Fernando Cejas Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@marlonlom
marlonlom / CustomBitmapDescriptorFactory.java
Last active March 13, 2023 13:05
This is a custom BitmapDescriptorFactory, prepared for converting color string (#cfer45) to its HUE form, and use it for Android Google Maps Marker coloring
package co.malm.android.utils.gms.maps.model;
import android.graphics.Color;
import com.google.android.gms.maps.model.BitmapDescriptorFactory;
import com.google.android.gms.maps.model.BitmapDescriptor;
/**
* Custom {@link com.google.android.gms.maps.model.BitmapDescriptorFactory} Used to create a definition of an image,
* using HEX color strings as parameter, used for marker icons and ground overlays.
*
@marlonlom
marlonlom / dateDiff.spec.ts
Last active August 30, 2022 03:32 — forked from RienNeVaPlus/dateDiff.ts
🕤 dateDiff() - returns a detail object about the difference between two dates
describe('date-diff', () => {
it('Should check if no date diff results shown for comparing exact same dates', () => {
const date0 = new Date('2020-11-01T01:00:00');
const date1 = new Date('2020-11-01T01:00:00');
const expectedResult = {
millennium: 0,
century: 0,
decade: 0,
year: 0,
quarter: 0,
@marlonlom
marlonlom / LatLngConverter.java
Created October 1, 2015 21:25
LatLngConverter: Utility class for converting a coordinate into its DMS (degrees, minutes, seconds) representation, for information visualization of coordinates
package co.marlonlom.demos.latlng.converters;
/**
* Utility class for converting a coordinate into its DMS (degrees, minutes,
* seconds) representation
*
* @author marlonlom
*/
public final class LatLngConverter {
/**
@marlonlom
marlonlom / uuid.demo.js
Created November 20, 2017 02:01
Gist for javascript function that creates universally unique identifier (UUID), which is a 128-bit number used to identify information in computer systems.
console.log(uuid());
@marlonlom
marlonlom / activity-results-api-firebase-auth.medium.md
Last active June 3, 2021 07:14
Gist for medium post related to androidx activity result api, moving the firebase auth to the new results api

Adapting FirebaseAuth for the new Activity Result API

Activity Result API is a new set of classes that enhances the way we use the recently deprecated methods startActivityForResult and onActivityResult, thats a usual way for interact with another apps using intents and a response code for checking the result data.

In this short post, i'm sharing to you how adapt the firebase auth flow using the Activity Result APIs

Activity Result APIs are available since AndroidX Activity 1.2.0-alpha02 and Fragment 1.3.0-alpha02. Remember to use -ktx artifacts to get additional extensions that helps you write cleaner Kotlin code.

(app/build.gradle)

@marlonlom
marlonlom / Key_starUML.md
Created November 18, 2020 16:34 — forked from danielquisbert/Key_starUML.md
Key para starUML