Skip to content

Instantly share code, notes, and snippets.

View robertoestivill's full-sized avatar

Roberto Estivill robertoestivill

View GitHub Profile
/**
* Podes llamar al PreferenceHelper desde cualquier lado de codigo, aun sin un contexto.
*
*/
public MyFragment extends Fragment{
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
...
@robertoestivill
robertoestivill / Main class
Last active August 29, 2015 14:26
Object to KML
import com.google.gson.Gson;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.util.LinkedList;
import java.util.List;
@robertoestivill
robertoestivill / aca kml
Last active August 29, 2015 14:26
Estaciones de servicio y paradores A.C.A en KML
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2">
<Document> <Style id="aca"> <IconStyle>
<Icon>
<href>http://miraargentina.com/components/com_jreviews_addons/geomaps/icons/aca.png</href>
</Icon>
</IconStyle>
</Style>
<Style id="campingsite"> <IconStyle>
<Icon>
@robertoestivill
robertoestivill / Reason
Last active May 4, 2016 01:03
Intellij Case Sensitivity Warning Fix
This is a quick fix for the IntelliJ / AndroidStudio case sensitivity warning.
https://confluence.jetbrains.com/display/IDEADEV/Filesystem+Case-Sensitivity+Mismatch
This warning comes up everytime after platform updates, and it is display when projects are located in case sensitive partition.
@robertoestivill
robertoestivill / gist:eec8d899d4d148d879b096de2f72f2ea
Last active April 29, 2017 22:34
android-things-panic-button
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Say>You just got your ass saved!</Say>
</Response>
@robertoestivill
robertoestivill / branchy.sh
Created July 17, 2017 11:15
Iterate over local git branches and prompt the user for deletion confirmation.
#!/bin/bash
CURRENT=$(git branch | grep "*" | cut -c3-)
printf "Your current branch is '$CURRENT'. Will be ignored.\n\n"
BRANCHES=$(git branch | cut -c3-)
BRANCHES=${BRANCHES[@]/$CURRENT}
for BRANCH in ${BRANCHES}
do
@robertoestivill
robertoestivill / hide_apple_apps.sh
Last active April 8, 2018 10:13
Hide Apple apps
#!/bin/bash
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root"
exit 1
fi
declare -a arr=(
"Calendar.app"
"Chess.app"
@robertoestivill
robertoestivill / main.kt
Last active May 24, 2018 12:11
Kotlin ReceiverChannel example with background and "UI" threads.
package testkotlin
import kotlinx.coroutines.experimental.channels.ReceiveChannel
import kotlinx.coroutines.experimental.channels.consumeEach
import kotlinx.coroutines.experimental.channels.produce
import kotlinx.coroutines.experimental.newFixedThreadPoolContext
import kotlinx.coroutines.experimental.newSingleThreadContext
import kotlinx.coroutines.experimental.runBlocking
import kotlinx.coroutines.experimental.withContext
import kotlin.coroutines.experimental.CoroutineContext
@robertoestivill
robertoestivill / md_colors.xml
Last active June 18, 2018 08:42
Material Design color palette for Android applications.
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!--
References
- https://www.materialpalette.com/colors
- https://www.materialui.co/colors
- https://material-ui.com/style/color/
-->
@robertoestivill
robertoestivill / themes-debug.xml
Last active June 18, 2018 13:57 — forked from dlew/themes-debug.xml
With the new theming in AppCompat, a lot of assets are tinted automatically for you via theme attributes. That has often led me to wonder "where the hell did this color come from?" You can replace your normal theme with this debug theme to help figure out the source of that color.
<!-- You can change the parent around to whatever you normally use -->
<style name="DebugColors" parent="Theme.AppCompat">
<!-- System colors -->
<item name="android:windowBackground">@color/__debugWindowBackground</item>
<item name="android:colorPressedHighlight">#FF4400</item>
<item name="android:colorLongPressedHighlight">#FF0044</item>
<item name="android:colorFocusedHighlight">#44FF00</item>
<item name="android:colorActivatedHighlight">#00FF44</item>