Skip to content

Instantly share code, notes, and snippets.

View marlonlom's full-sized avatar
😎

Marlon López marlonlom

😎
View GitHub Profile
@marlonlom
marlonlom / google_staticmaps_router.js
Last active January 26, 2018 21:43
Google staticmaps Router implementation. Used for map images downloading using Nodejs + ExpressJS
/**
* Google staticmaps Router implementation.
*/
const express = require('express'),
request = require('request'),
router = express.Router(),
StaticMaps = {
baseHost: "https://maps.googleapis.com/maps/api"
};
@marlonlom
marlonlom / slugify.js
Created November 20, 2017 02:03 — forked from codeguy/slugify.js
Create slug from string in Javascript
function string_to_slug (str) {
str = str.replace(/^\s+|\s+$/g, ''); // trim
str = str.toLowerCase();
// remove accents, swap ñ for n, etc
var from = "àáäâèéëêìíïîòóöôùúüûñç·/_,:;";
var to = "aaaaeeeeiiiioooouuuunc------";
for (var i=0, l=from.length ; i<l ; i++) {
str = str.replace(new RegExp(from.charAt(i), 'g'), to.charAt(i));
}
@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 / Aes128EncryptionCompat.java
Last active October 2, 2017 21:12
AES 128bit Cross Platform (Java) Encryption Compatibility
/*
* Copyright (c) 2017, marlonlom
*
* 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,
@marlonlom
marlonlom / MiddleNumber.java
Created August 22, 2017 00:10
MiddleNumber.java
public class MiddleNumber
{
public static void main(String[] args)
{
MiddleNumber myObject = new MiddleNumber();
int[] numberz = {1,2,4,60,8,20};
int[] resultz= myObject.makeMiddle(numberz);
System.out.print("myObject.makeMiddle: "+resultz[0]);
}
@marlonlom
marlonlom / Preferences.java
Last active July 23, 2017 03:04
Gist for Preferences.java, Utility class for handling read/write operations using SharedPreferences
/*
* Copyright (c) 2017, marlonlom
*
* 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,
@marlonlom
marlonlom / error-uploading-mvn.txt
Created June 21, 2016 23:57
build failed when uploading archives
Could not transfer artifact com.github.marlonlom:staticmaps-builder:aar:1.0.0 from/to remote (https://oss.sonatype.org/service/local/staging/deploy/maven2/): Access denied to: https://oss.sonatype.org/service/local/staging/deploy/maven2/com/github/marlonlom/staticmaps-builder/1.0.0/staticmaps-builder-1.0.0.aar, ReasonPhrase: Forbidden.
Could not transfer artifact com.github.marlonlom:staticmaps-builder:pom:1.0.0 from/to remote (https://oss.sonatype.org/service/local/staging/deploy/maven2/): Access denied to: https://oss.sonatype.org/service/local/staging/deploy/maven2/com/github/marlonlom/staticmaps-builder/1.0.0/staticmaps-builder-1.0.0.pom, ReasonPhrase: Forbidden.
Could not transfer artifact com.github.marlonlom:staticmaps-builder:jar.asc:javadoc:1.0.0 from/to remote (https://oss.sonatype.org/service/local/staging/deploy/maven2/): Access denied to: https://oss.sonatype.org/service/local/staging/deploy/maven2/com/github/marlonlom/staticmaps-builder/1.0.0/staticmaps-builder-1.0.0-javadoc.jar.asc, ReasonPhras
@marlonlom
marlonlom / simple-pagination.js
Created April 7, 2016 22:07 — forked from kottenator/simple-pagination.js
Simple pagination algorithm
// Implementation in ES6
function pagination(c, m) {
var current = c,
last = m,
delta = 2,
left = current - delta,
right = current + delta + 1,
range = [],
rangeWithDots = [],
l;
@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 / EmptyRecyclerView.java
Last active September 7, 2015 20:41 — forked from mobiRic/EmptyRecyclerView.java
RecyclerView doesn't have an emptyView support, we gotta fix that
/*
* Copyright (C) 2015 Glowworm Software
* Copyright (C) 2014 Nizamutdinov Adel
*
* 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
*