Skip to content

Instantly share code, notes, and snippets.

View marlonlom's full-sized avatar
😎

Marlon López marlonlom

😎
View GitHub Profile
@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 / 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 / Key_starUML.md
Created November 18, 2020 16:34 — forked from danielquisbert/Key_starUML.md
Key para starUML
@marlonlom
marlonlom / japanese-name-generator.js
Last active November 6, 2020 20:08
Simple Javascript function for Japanese name generator
const japaneseName= (name) => {
const dictionary = {"a": "ka","b": "tu","c": "mi","d": "te","e": "ku","f": "lu","g": "ji","h": "ri","i": "ki","j": "zu","k": "me","l": "ta","m": "rin","n": "to","o": "mo","p": "no","q": "ke","r": "shi","s": "ari","t": "chi","u": "do","v": "ru","w": "na","x": "mei","y": "fu","z": "ra"};
return name.substring(0, name.indexOf(' ') >=0 ? name.indexOf(' ') : name.length).replace(/[a-z]/gi, m => dictionary[m]);
}
@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 / CollapseDateRanges.kt
Last active April 15, 2020 03:13
Formats a dates (start,end) range in Kotlin, presenting the result in a collapsed date range format.
import java.text.SimpleDateFormat
import java.util.Date
import java.util.Locale.ENGLISH
/**
* Creates a "collapsed" date range String representing the period of time
* between two Dates.
*
* @author marlonlom
*/
@marlonlom
marlonlom / SearchViewStyle.java
Created December 20, 2019 15:55 — forked from jaredrummler/SearchViewStyle.java
Customize the SearchView in an ActionBar for Android
/*
* Copyright (C) 2015 Jared Rummler <[email protected]>
*
* 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 / RecyclerViewItemTouchListener.java
Created December 3, 2018 02:44
A helper class for handling click events on a RecyclerView
/**
* Created by Rany Albeg Wein on 07/11/2015.
* Since we currently don't have a LongItemClick listener for the {@link RecyclerView}
* this is an implementation that uses a {@link GestureDetector} to notify us for long click events on one of
* {@link RecyclerView}'s child views. It also handles single-tap-up ( a click ) and a double-click on a child view.
*/
public class RecyclerViewItemTouchListener extends RecyclerView.SimpleOnItemTouchListener {
/**
* A listener that will be invoked on item click events.