Skip to content

Instantly share code, notes, and snippets.

View redleafar's full-sized avatar
🎯
Focusing

Rafael Bermúdez redleafar

🎯
Focusing
  • Globant
  • Bogotá, Colombia
View GitHub Profile
@redleafar
redleafar / Problem_mysql_mac.md
Created January 29, 2019 18:04
Problems with MySql in Mac
@redleafar
redleafar / format_data_from_server_in_java.md
Created February 12, 2018 18:50
Format date from server in java
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ");
@redleafar
redleafar / composer_error_memory_exhausted.md
Created February 12, 2018 18:49
Composer error: Fatal error: Allowed memory size of ... bytes exhausted

This happens when trying to install a new dependency and there is not enough memory, so you can raise the memory (in this case to 3GB) temporarily using :

php -d memory_limit=3G C:\ProgramData\ComposerSetup\bin\composer.phar require  excelwebzone/r

Check the actual memory limit with:

php -r "echo ini_get('memory_limit').PHP_EOL;"
@redleafar
redleafar / strange_characters_cmd.md
Created February 12, 2018 18:48
Strange characters in CMD

https://stackoverflow.com/questions/35387667/git-bash-is-displaying-strange-characters-on-windows-7

Having used git on windows for over three years now, I’ve fallen back in love with the command line. Bash, of course, not the windows command prompt. Beautiful, ubiquitous, warty bash. Git depends heavily on GNU utilities so on Windows it requires either cygwin or msys. Having been burned by cygwin in the past, I prefer the minimalism and simplicity of msys + mingw. Along with git, the entire ruby ecosystem lives in the shell. However, the numerous tools, gems and utilities that assume standard ANSI color support in the shell began to wear on me. Lo and behold, there is a lovely solution to provide ansi color support for bash (and cmd) on Windows: ansicon.

Download the zip and extract (https://github.com/adoxa/ansicon/downloads). There are a few ways to install:

Extract to a permanent location (I use C:/bin/ansicon). Execute ansicon.exe -i from within the appropriate directory for your system (x86/x64),

@redleafar
redleafar / ubable_to_set_layout_dimmensions.md
Last active February 12, 2018 18:46
Unable to set layout width, height and weight of inflated view in XML in Android

Use:

View preview = layoutInflater.inflate(R.layout.item_cm_preview_image,parent,false);

and not:

View preview = layoutInflater.inflate(R.layout.item_cm_preview_image,null);
@redleafar
redleafar / paginator_without_complete_entities.md
Last active February 12, 2018 18:45
Paginator without complete entities
@redleafar
redleafar / ScrollListView.java
Created January 18, 2018 20:30 — forked from marteinn/ScrollListView.java
ScrollListView - Detect bottom reached for ListView
package se.marteinn.ui;
import android.content.Context;
import android.util.AttributeSet;
import android.widget.AbsListView;
import android.widget.ListView;
/**
* Triggers a event when scrolling reaches bottom.
@redleafar
redleafar / gist:e3b4386039391a6f8f0f76e23047a6da
Created June 8, 2017 00:04 — forked from prime31/gist:5675017
Simple PHP script showing how to send an Android push notification. Be sure to replace the API_ACCESS_KEY with a proper one from the Google API's Console page. To use the script, just call scriptName.php?id=THE_DEVICE_REGISTRATION_ID
<?php
// API access key from Google API's Console
define( 'API_ACCESS_KEY', 'YOUR-API-ACCESS-KEY-GOES-HERE' );
$registrationIds = array( $_GET['id'] );
// prep the bundle
$msg = array