Skip to content

Instantly share code, notes, and snippets.

View JCarlosR's full-sized avatar
🏠
Working from home

Juan Ramos JCarlosR

🏠
Working from home
View GitHub Profile
@JCarlosR
JCarlosR / index.php
Created June 14, 2018 13:35
Ejemplo API Rest - Google Maps Geocoding
<?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"];
@JCarlosR
JCarlosR / KineController.php
Last active May 12, 2019 01:30
Cargar contenido de forma dinámica al hacer Scroll (JS y Laravel)
<?php
namespace App\Http\Controllers;
use App\Kine;
use Illuminate\Http\Request;
class KineController extends Controller
{
public function index()
@JCarlosR
JCarlosR / ApiAdapter.java
Created June 1, 2020 04:19
Retrofit 2 Example: Parsing dynamic JSON responses
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 / PreferenceHelper.kt
Last active December 25, 2023 08:20 — forked from krupalshah/PreferenceHelper.kt
Helper for shared preferences management - Kotlin version
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)