Skip to content

Instantly share code, notes, and snippets.

View imran0101's full-sized avatar

Imran imran0101

  • India
View GitHub Profile
@jarun
jarun / Goa tips.md
Last active July 17, 2021 19:51
Notes from Goa, India trip (22 Oct 2017)

Sunset at Benaulim

  1. Use Google Maps, save Goa offline for quick access. Jio works everywhere.
  2. Buy hats. Goa is hot and humid (between Feb to Dec).
  3. If you reach Madgaon by train and want to go to North Goa, take an auto to the Madgaon Bus stand (around Rs. 120). Book a ticket for the non-stop express bus to the Panjim Bus stand. At Panjim Bus stand, take a KTC prepaid taxi to North Goa.
  4. A nice place to homestay is Joe and Marietta's guesthouse, Calangute Goa. They have all amenities like AC, fridge, hot water, wifi... It's very near to KFC. They will provide numbers to cab and bike services too. But do NOT buy petrol from them even if the lady insists. They charged Rs. 80/ltr when the petrol price in Goa was Rs. 52/ltr on the day. There are petrol pumps everywhere. One can stay in North Goa and visit Old Goa + Panjim by bike.
  5. Autos and cabs will cost you dearly. Hire a bike for a few days (~Rs. 300/day for Honda Activa). No Uber or Ola, thanks to govt
/*
* Copyright 2016 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@AlecKazakova
AlecKazakova / BriteDatabaseUtils.kt
Last active February 7, 2021 15:36
Extension functions on SQLBrite's BriteDatabase to make working with SQLDelight easier
fun BriteDatabase.createQuery(query: SqlDelightStatement) = createQuery(query.tables, query.statement, *query.args)
inline fun <T: SqlDelightCompiledStatement> BriteDatabase.bindAndExecute(compiledStatement: T, bind: T.() -> Unit): Long {
synchronized(compiledStatement) {
compiledStatement.bind()
return when (compiledStatement) {
is SqlDelightCompiledStatement.Insert -> {
executeInsert(compiledStatement.table, compiledStatement.program)
}
is SqlDelightCompiledStatement.Update -> {
import android.support.v7.widget.RecyclerView;
public class RecyclerViewSwipeListener extends RecyclerView.OnFlingListener {
private static final int SWIPE_VELOCITY_THRESHOLD = 2000;
boolean mIsScrollingVertically;
// change swipe listener depending on whether we are scanning items horizontally or vertically
RecyclerViewSwipeListener(boolean vertical) {
@nickbutcher
nickbutcher / avd_bundle.xml
Last active December 31, 2021 01:03
An example of the Android xml bundle format for creating an AnimatedVectorDrawable. See https://plus.google.com/+NickButcher/posts/A8KKxnJdg4r
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2016 Google Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
public class ArcToBezier {
/**
* Usage:
*
* javac ArcToBezier.java
* java ArcToBezier x0 y0 x1 x2 rx ry theta large-arc-flag sweep-flag
*
* where (x0, y0) are the starting points of the arc, and the rest of the
* arguments correspond to the values in the elliptical arc curve command:
def buildConfigAndResStringField(variant, name, value) {
variant.resValue 'string', name.toLowerCase(), value
variant.buildConfigField 'String', name, "\"$value\""
}
afterEvaluate {
android.applicationVariants.all { variant ->
variant.resValue 'string', 'application_id', variant.applicationId
buildConfigAndResStringField variant, "ACCOUNT_TYPE", variant.applicationId
buildConfigAndResStringField variant, "CONTENT_AUTHORITY", variant.applicationId + ".provider"
@hamakn
hamakn / height.java
Created April 6, 2015 02:41
Android: Get height of status, action, navigation bar (pixels)
// status bar height
int statusBarHeight = 0;
int resourceId = getResources().getIdentifier("status_bar_height", "dimen", "android");
if (resourceId > 0) {
statusBarHeight = getResources().getDimensionPixelSize(resourceId);
}
// action bar height
int actionBarHeight = 0;
final TypedArray styledAttributes = getActivity().getTheme().obtainStyledAttributes(
@f2prateek
f2prateek / Converter.java
Last active August 29, 2015 14:05
A mini gson implementation.
import java.io.InputStream;
import java.io.OutputStream;
public interface Converter {
public <T> T fromJson(InputStream in, Class<T> clazz) throws ConversionException;
public <T> void toJson(OutputStream os, T object) throws ConversionException;
public class ConversionException extends Exception {
public ConversionException(Throwable throwable) {
@benjchristensen
benjchristensen / EventBus.java
Last active February 24, 2022 03:02
EventBus.java
import rx.Observable;
import rx.subjects.PublishSubject;
import rx.subjects.SerializedSubject;
import rx.subjects.Subject;
/**
* Simple pass-thru event bus with error handling and reconnect.
*/
public class EventBus {