Skip to content

Instantly share code, notes, and snippets.

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

Fernando Martínez fernandodev

💭
⭐️ ⭐️ ⭐️ ⭐️
View GitHub Profile
@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
@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 / 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
[1,2,3].map(&:inspect).join(", ") # "1, 2, 3"
@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! 😃

@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 / 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);

Letras:

a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z

Vamos ouvir?

Números:

Número Escrita
@fernandodev
fernandodev / MTLJSONAdapter.swift
Last active December 28, 2015 11:09
A simple useful extension to transform easier dictionaries in models using mantle
/*
The MIT License (MIT)
Copyright (c) contact@fernandodev.com
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION W
@fernandodev
fernandodev / clear_cache.sh
Created February 3, 2016 15:42
Remove all unnecessary files from OSX [Developer Edition]
#!/bin/sh
rm -rf ~/Library/Developer/XCode/DerivedData/*
rm -rf "~/Library/Developer/XCode/iOS Device Logs/*"
rm -rf "~/Library/Logs/*"
rm -rf ~/.Trash/*