Skip to content

Instantly share code, notes, and snippets.

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

Eduardo José Medina Alfaro emedinaa

🏠
Working from home
View GitHub Profile
@emedinaa
emedinaa / gist:549d7528d1e022a03024
Last active August 29, 2015 14:23
Configuración build.gradle SDK 19 con Gradle 1.0.0
apply plugin: 'com.android.application'
android {
compileSdkVersion 19
buildToolsVersion "20.0.0"
defaultConfig {
applicationId "com.isil.am1lesson4"
minSdkVersion 11
targetSdkVersion 19
@emedinaa
emedinaa / DpToPxAndPxToDp
Created October 7, 2015 15:31 — forked from laaptu/DpToPxAndPxToDp
Android convert dp to px and vice versa
public static float convertPixelsToDp(float px){
DisplayMetrics metrics = Resources.getSystem().getDisplayMetrics();
float dp = px / (metrics.densityDpi / 160f);
return Math.round(dp);
}
public static float convertDpToPixel(float dp){
DisplayMetrics metrics = Resources.getSystem().getDisplayMetrics();
float px = dp * (metrics.densityDpi / 160f);
return Math.round(px);
@emedinaa
emedinaa / gist:8b8a11127971567941d0
Created October 23, 2015 17:54
String replace example
public class StringExample {
public static void main(String[] args) {
String originalURL= "/group/{id}/users";
Object object= "x1024";
String annotation= "id";
if(originalURL.contains("{"+annotation+"}"))
{
@emedinaa
emedinaa / RecyclerView Item Listener
Created January 18, 2016 02:56
Android RecyclerView Item Listener
rviProveedores.setHasFixedSize(true);
rviProveedores.addItemDecoration(new MarginDecoration(this));
rviProveedores.setLayoutManager(new LinearLayoutManager(this));
rviProveedores.addOnItemTouchListener(new RecyclerTouchListener(this, rviProveedores, new RecyclerClickListener() {
@Override
public void onClick(View view, int position) {
if (placeEntityList != null) {
PlaceEntity placeEntity = placeEntityList.get(position);
LogUtils.v(TAG, "placeEntity "+placeEntity);
@emedinaa
emedinaa / java
Created March 2, 2016 16:59
Facebook Android SDK - Taggable Friends Limit
Bundle bundle = new Bundle();
bundle.putInt("limit", 5000);
String path= "/me/taggable_friends";
new GraphRequest(
AccessToken.getCurrentAccessToken(),
path,
bundle,
HttpMethod.GET,
new GraphRequest.Callback() {
@emedinaa
emedinaa / java
Created March 5, 2016 15:07
Get the current week
Calendar c1 = Calendar.getInstance();
//first day of week
c1.set(Calendar.DAY_OF_WEEK, 1);
int year1 = c1.get(Calendar.YEAR);
int month1 = c1.get(Calendar.MONTH)+1;
int day1 = c1.get(Calendar.DAY_OF_MONTH);
//last day of week
@emedinaa
emedinaa / .txt
Created March 10, 2016 14:37
Github - Clear commits history
git rm -rf .git
git init
git remote add origin https://github.com/heiswayi/myproject.git
git remote -v
git add --all
git commit -am "Initial commit"
@emedinaa
emedinaa / multiple_ssh_setting.md
Last active April 21, 2016 00:26 — forked from jexchan/multiple_ssh_setting.md
Multiple SSH keys for different github accounts

Multiple SSH Keys settings for different github account

create different public key

create different ssh key according the article Mac Set-Up Git

$ ssh-keygen -t rsa -C "[email protected]"
@emedinaa
emedinaa / .txt
Created March 31, 2016 14:49
MacOSXYosemite-HowtoShow/hide hidden files and folders
defaults write com.apple.finder AppleShowAllFiles YES
killall Finder
defaults write com.apple.finder AppleShowAllFiles NO
killall Finder
@emedinaa
emedinaa / .gradle
Created April 21, 2016 17:05
Retrofit 2.0 build.gradle
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.google.code.gson:gson:2.6.2'
compile 'com.squareup.retrofit2:retrofit:2.0.2'
compile 'com.squareup.okhttp3:okhttp:3.2.0'
}