Skip to content

Instantly share code, notes, and snippets.

View fernandodev's full-sized avatar
💭
⭐️ ⭐️ ⭐️ ⭐️

Fernando Martínez fernandodev

💭
⭐️ ⭐️ ⭐️ ⭐️
View GitHub Profile
@fernandodev
fernandodev / hmacsha512.java
Created June 25, 2015 17:56
Android - Encrypt passwords with HMAC SHA512
/**
* You have to use: compile 'commons-codec:commons-codec:1.4'
* as dependency
*/
public static String HMACSHA512(String value, String securityHmac) throws UnsupportedEncodingException,
NoSuchAlgorithmException, InvalidKeyException {
SecretKeySpec key = new SecretKeySpec((securityHmac).getBytes("UTF-8"), "HmacSHA512");
Mac mac = Mac.getInstance("HmacSHA512");
mac.init(key);
@fernandodev
fernandodev / HashUtils.java
Created April 20, 2015 14:26
A Hash Util (Build hash as easy as possible). Just map("key", value)!
/**
* Created by fernandomartinez on 12/22/14.
*/
public class HashUtils {
public static Map map(Object... keyValuePair) {
Map<Object, Object> map = new HashMap<>();
for (int i = 0; i < keyValuePair.length; i += 2) {
if (( i + 1 ) < keyValuePair.length &&
keyValuePair[i] != null &&
@fernandodev
fernandodev / JavaFacilities.md
Last active August 29, 2015 14:11
Java helpers that will make your life pretty easy

Java Facilities

The collections of code snippets que will make your life pretty much easy!

Hash Builder

Make your life easy! 😃

[1,2,3].map(&:inspect).join(", ") # "1, 2, 3"
@fernandodev
fernandodev / compiz_ubuntu.sh
Created November 13, 2013 00:46
Installing Compiz on Ubuntu 12.04
sudo apt-get install compiz
sudo apt-get install compizconfig-settings-manager
sudo apt-get install compiz-fusion-plugins-extra
sudo apt-get install compiz-plugins-extra
@fernandodev
fernandodev / activeadmin_custom_filter_belongs_to.rb
Last active December 27, 2015 20:39
How to create a simple custom filter for activeadmin when I have a relationship belongs_to
ActiveAdmin.register User do
filter :enterprise, collection: proc { Enterprise.all.map { |enterprise| [enterprise.name, enterprise.id] } }
end
@fernandodev
fernandodev / .gitignore-android
Last active December 23, 2015 18:49
If you are creating a new android project probably you'll setup .gitignore as below To save time and memory, just copy+paste
# built application files
*.apk
*.ap_
# files for the dex VM
*.dex
# Java class files
*.class