Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

JCarlos JCarlosR

🏠
Working from home
View GitHub Profile
@JCarlosR
JCarlosR / ApiAdapter.java
Created Jun 1, 2020
Retrofit 2 Example: Parsing dynamic JSON responses
View ApiAdapter.java
package com.youtube.sorcjc.proyectoprofesionales.io;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.squareup.okhttp.OkHttpClient;
import com.squareup.okhttp.logging.HttpLoggingInterceptor;
import com.youtube.sorcjc.proyectoprofesionales.io.deserializers.LoginDeserializer;
import com.youtube.sorcjc.proyectoprofesionales.io.responses.LoginResponse;
import retrofit.GsonConverterFactory;
@JCarlosR
JCarlosR / KineController.php
Last active May 12, 2019
Cargar contenido de forma dinámica al hacer Scroll (JS y Laravel)
View KineController.php
<?php
namespace App\Http\Controllers;
use App\Kine;
use Illuminate\Http\Request;
class KineController extends Controller
{
public function index()
@JCarlosR
JCarlosR / PreferenceHelper.kt
Last active Apr 8, 2021 — forked from krupalshah/PreferenceHelper.kt
Helper for shared preferences management - Kotlin version
View PreferenceHelper.kt
package com.programacionymas.helpers
import android.content.Context
import android.content.SharedPreferences
import android.preference.PreferenceManager
object PreferenceHelper {
fun defaultPrefs(context: Context): SharedPreferences
= PreferenceManager.getDefaultSharedPreferences(context)
@JCarlosR
JCarlosR / index.php
Created Jun 14, 2018
Ejemplo API Rest - Google Maps Geocoding
View index.php
<?php
if (isset($_GET['direccion']))
{
$direccion = $_GET['direccion'];
echo "Se ha ingresado 1 dirección: " . $direccion;
$google_maps_url = "https://maps.googleapis.com/maps/api/geocode/json?address=" . urlencode($direccion) ."&key=AIzaSyApj6gLFFjVQ2sFXJ6k-U1yyiCfvBchybI";
$google_maps_json = file_get_contents($google_maps_url);
$google_maps_array = json_decode($google_maps_json, true);
$lat = $google_maps_array["results"][0]["geometry"]["location"]["lat"];