Skip to content

Instantly share code, notes, and snippets.

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

Udayaditya Barua ubarua123

🏠
Working from home
View GitHub Profile
@aoudiamoncef
aoudiamoncef / DataLoaderConfig.java
Last active January 9, 2023 11:00
GraphQL Java Dataloader Redis generic Cachemap (Spring Boot 2 )
@Configuration
public class DataLoaderConfig {
@Autowired
private RedisCacheRepository<String, ObjectId, Home> homeByObjectIdCacheMapRepository;
@Autowired
private RedisCacheRepository<String, String, Home> homeByStringCacheMapRepository;
@Bean
public DataLoaderRegistry dataLoaderRegistry() {
@heyarne
heyarne / build.gradle
Created February 3, 2017 13:40
Android build version with git commit hash
// merge this with your current build.gradle
// generates a version name from currently checked out git commit
def getCommitHash = { ->
def stdout = new ByteArrayOutputStream()
exec {
commandLine 'git', 'rev-parse', '--short', 'HEAD'
standardOutput = stdout
}
return stdout.toString().trim()
}
@NikolaDespotoski
NikolaDespotoski / ToolbarNavigationUtil.java
Last active October 7, 2020 12:03
Util for finding components of Toolbar such as navigation icon view
public class ToolbarNavigationUtil{
public static View getToolbarNavigationIcon(Toolbar toolbar){
//check if contentDescription previously was set
boolean hadContentDescription = TextUtils.isEmpty(toolbar.getNavigationContentDescription());
String contentDescription = !hadContentDescription ? toolbar.getNavigationContentDescription() : "navigationIcon";
toolbar.setNavigationContentDescription(contentDescription);
ArrayList<View> potentialViews = new ArrayList<View>();
//find the view based on it's content description, set programatically or with android:contentDescription
toolbar.findViewsWithText(potentialViews,contentDescription, View.FIND_VIEWS_WITH_CONTENT_DESCRIPTION);
//Nav icon is always instantiated at this point because calling setNavigationContentDescription ensures its existence