This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static Map<String, String> getHashMapResource(Context c, int hashMapResId) { | |
Map<String, String> map = null; | |
XmlResourceParser parser = c.getResources().getXml(hashMapResId); | |
String key = null, value = null; | |
try { | |
int eventType = parser.getEventType(); | |
while (eventType != XmlPullParser.END_DOCUMENT) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func tmpl(w io.Writer, text string, data interface{}) { | |
t := template.New("top") | |
t.Funcs(template.FuncMap{ | |
"trim": strings.TrimSpace, | |
// deref allows to use pointer in templates | |
"deref": func(data interface{}) string { | |
if reflect.ValueOf(data).IsNil() { | |
return "" | |
} | |
switch vv := data.(type) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public View getViewByPosition(int pos, ListView listView) { | |
final int firstListItemPosition = listView.getFirstVisiblePosition(); | |
final int lastListItemPosition = firstListItemPosition + listView.getChildCount() - 1; | |
if (pos < firstListItemPosition || pos > lastListItemPosition ) { | |
return listView.getAdapter().getView(pos, null, listView); | |
} else { | |
final int childIndex = pos - firstListItemPosition; | |
return listView.getChildAt(childIndex); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package something; | |
import java.util.regex.Matcher; | |
import java.util.regex.Pattern; | |
public class PlaceHolderConverter | |
{ | |
public Pattern lookForVar; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Date.metaClass.round = { String period -> | |
delegate.clearTime() | |
GregorianCalendar gc = new GregorianCalendar() | |
gc.time = delegate | |
switch (period) { | |
case 'week': | |
def dayToSet = 2 //monday | |
def dayWeek = gc.get(Calendar.DAY_OF_WEEK) | |
def distance = dayWeek == 1 ? -6 : dayToSet - dayWeek |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for (StackTraceElement el : Thread.currentThread().getStackTrace()) { | |
logger.e("stacktrace %s %s", el.getClassName(), el.getMethodName()); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
buildscript { | |
repositories { | |
mavenCentral() | |
maven { | |
url "https://oss.sonatype.org/content/repositories/snapshots/" | |
} | |
} | |
dependencies { | |
classpath 'com.novoda:gradle-android-test-plugin:0.9.7-SNAPSHOT' | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.comalia.gesicamobile.test; | |
import com.actionbarsherlock.app.ActionBar; | |
import org.fest.assertions.api.ANDROID; | |
public class MyANDROID extends ANDROID { | |
public static SupportActionBarAssert assertThat(ActionBar actionBar) { | |
return new SupportActionBarAssert(actionBar); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.comalia.gesicamobile.manager.widget; | |
import android.content.Context; | |
import android.content.res.TypedArray; | |
import android.text.TextUtils; | |
import android.util.AttributeSet; | |
import android.util.Log; | |
import android.widget.TextView; | |
import com.comalia.gesicamobile.manager.R; |