Skip to content

Instantly share code, notes, and snippets.

View brunodles's full-sized avatar

Bruno de Lima e Silva brunodles

  • São Paulo, São Paulo - Brasil
View GitHub Profile
function toCamel(value) {
return value.replace(' ', '_').toLowerCase();
};
var views = $$('li.color');
var result = "<resources>\n";
var lastName = "";
for (i in views) {
var colorItem = views[i];
if ($('span.name', colorItem) !== null) continue;
@brunodles
brunodles / StringFormat.java
Last active November 6, 2016 20:19
Medium - Java Formatter
System.out.printf("%s", object);
String.format("%S -> %1$s", object.getValue());
String.format("%i", object.getInteger());
String.format("%2.2f", object.getFloat());
@brunodles
brunodles / lima-agnoster.zsh-theme
Created October 22, 2016 01:53
A simple change on agnoster theme. This will add the time of the last command on the right size.
# vim:ft=zsh ts=2 sw=2 sts=2
#
# agnoster's Theme - https://gist.github.com/3712874
# A Powerline-inspired theme for ZSH
#
# # README
#
# In order for this theme to render correctly, you will need a
# [Powerline-patched font](https://github.com/Lokaltog/powerline-fonts).
# Make sure you have a recent version: the code points that Powerline
@brunodles
brunodles / LinearLayoutWrapper.java
Last active December 13, 2016 01:50
Add new views on a LinearLayout like you do on a ListView or RecycleView
import android.database.DataSetObserver;
import android.os.Handler;
import android.os.Looper;
import android.support.annotation.UiThread;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Adapter;
@brunodles
brunodles / ViewPagerAdapter.java
Created June 21, 2016 19:15
Base adapter for Views inside viewpager
import android.support.v4.view.PagerAdapter;
import android.view.View;
import android.view.ViewGroup;
public abstract class ViewPagerAdapter extends PagerAdapter {
@Override
public Object instantiateItem(ViewGroup container, int position) {
import org.jetbrains.spek.api.Spek
import kotlin.test.assertEquals
import kotlin.test.assertFalse
import kotlin.test.assertNull
import kotlin.test.assertTrue
/**
* Created by bruno on 10/03/16.
*/
@brunodles
brunodles / ApplicationTest.java
Last active April 5, 2016 21:35
This is a test to show how to use expresso to check if a toast was displayed.
package com.github.brunodles.toastespresso;
import android.support.test.rule.ActivityTestRule;
import android.support.test.runner.AndroidJUnit4;
import android.test.suitebuilder.annotation.LargeTest;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
@brunodles
brunodles / gist:badaa6de2ad3a84138d517795f15efc7
Last active February 17, 2023 03:10
This is a test to show how to use expresso to check if a toast was displayed.
package com.github.brunodles.toastespresso;
import android.support.test.rule.ActivityTestRule;
import android.support.test.runner.AndroidJUnit4;
import android.test.suitebuilder.annotation.LargeTest;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
@brunodles
brunodles / Stack.java
Created April 5, 2016 18:51
My history through Java Testing — Main Methods
import java.util.ArrayList;
import java.util.List;
public class Stack<T> {
private List<T> list = new ArrayList<>();
public boolean isEmpty() {
return list.isEmpty();
}
@brunodles
brunodles / strings_fonts.xml
Created March 2, 2016 11:56
Just a String res file to use autocompletation for fonts
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- This file is just to simplify the font usage.-->
<string name="sans_serif" translatable="false">sans-serif</string>
<string name="sans_serif_light" translatable="false">sans-serif-light</string>
<string name="sans_serif_thin" translatable="false">sans-serif-thin</string>
<string name="sans_serif_condensed" translatable="false">sans-serif-condensed</string>
<string name="sans_serif_medium" translatable="false">sans-serif-medium</string>
<string name="sans_serif_black" translatable="false">sans-serif-black</string>