Skip to content

Instantly share code, notes, and snippets.

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

Francisco Abarza abarza

🏠
Working from home
  • Chile
View GitHub Profile
@abarza
abarza / BottomDecoratorHelper.java
Created September 28, 2016 20:52
Add extra bottom space to the last item in a RecyclerView in order to avoid overlap information with the FloatingActionButton
public class BottomDecoratorHelper extends RecyclerView.ItemDecoration {
private final int bottomOffset;
public BottomDecoratorHelper(int bottomOffset) {
this.bottomOffset = bottomOffset;
}
@Override
public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
@abarza
abarza / Java alpha Animation method
Created September 14, 2016 13:20
Animation method to android element (compatible with api 10). Use view.setAlpha(alpha) from api 11
public void setAnimation(float fromAlpha, float toAlpha, long duration, View view){
AlphaAnimation alpha = new AlphaAnimation(fromAlpha, toAlpha);
alpha.setDuration(duration); // Make animation instant
alpha.setFillAfter(true); // Tell it to persist after the animation ends
view.startAnimation(alpha); //Attach to l
}
@abarza
abarza / mail.php
Created May 12, 2015 16:41
Contact form 7 & Freegeoip IP Country localization
if ( '_remote_ip' == $name ) {
if ( $remote_ip = $submission->get_meta( 'remote_ip' ) ) {
$pageContent = file_get_contents('http://freegeoip.net/json/' . $remote_ip);
$parsedJson = json_decode($pageContent);
return htmlspecialchars($parsedJson->country_name);
} else {
return '';
}
}
@abarza
abarza / videostaphpls.js
Created April 15, 2014 17:18
Stop videos when you close the modal box
$(document).ready(function(){
$('.modal').each(function(){
var src = $(this).find('iframe').attr('src');
$(this).on('click', function(){
$(this).find('iframe').attr('src', '');
$(this).find('iframe').attr('src', src);
});
@abarza
abarza / .conkyrc
Created April 12, 2014 04:07
My Conky config file
# conky configuration
#
# The list of variables has been removed from this file in favour
# of keeping the documentation more maintainable.
# Check http://conky.sf.net for an up-to-date-list.
#
# For ideas about how to modify conky, please see:
# http://crunchbanglinux.org/forums/topic/59/my-conky-config/
#
# For help with conky, please see:
@abarza
abarza / .gitignore
Created April 11, 2014 22:50
.gitignore for Windows + Eclipse + Android
#################
## Eclipse
#################
*.pydevproject
.project
.metadata
bin/
tmp/
*.tmp
@abarza
abarza / Default New Doc Sizes.doc
Last active December 10, 2015 17:48
Document presets for Photoshop, replacing the default values given by the software with the Android and iOS screen sizes.
;------------------------------------------------------------------------------
; Generic mobile device sizes
;------------------------------------------------------------------------------
"mobile"
"Android LDPI Small QVGA" 240 320 pixels 120 dpi RGB 8 1.0 white "none"
"Android LDPI Normal WQVGA400" 240 400 pixels 120 dpi RGB 8 1.0 white "none"
"Android LDPI Normal WQVGA432" 240 432 pixels 120 dpi RGB 8 1.0 white "none"
"Android LDPI Extra Large" 1024 600 pixels 120 dpi RGB 8 1.0 white "none"