Skip to content

Instantly share code, notes, and snippets.

@vishna
vishna / push-n-pull
Created November 9, 2012 12:15
push & pull
#!/usr/bin/env ruby
BRANCH = `git rev-parse --abbrev-ref HEAD`
MESSAGE = ARGV[0]
REMOTE = "vishna"
_REMOTE = "eyeem"
_BRANCH = "3.4_maintenance"
`git push #{REMOTE} #{BRANCH}`
`hub pull-request \"#{MESSAGE}\" -b #{_REMOTE}:#{_BRANCH} -h #{REMOTE}:#{BRANCH}`
@vishna
vishna / OutsetDrawable.java
Last active July 3, 2019 11:33
Adds margins to your drawables. Based on InsetDrawable which adds padding.
package com.eyeem.widgets;
/*
* Copyright (C) 2008 The Android Open Source Project
* Copyright (C) 2014 EyeEm Mobile GmbH
*
* 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
*
@vishna
vishna / RecyclerUtils.java
Created March 13, 2015 09:47
Missing RecyclerView ScrollListener API
package whatever;
import android.support.v7.widget.RecyclerView;
import java.lang.reflect.Field;
import java.util.HashSet;
/**
* Created by vishna on 28/10/14.
*/
import android.annotation.TargetApi;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.res.Resources;
import android.graphics.Canvas;
import android.media.AudioManager;
import android.media.MediaFormat;
import android.media.MediaPlayer;
import android.net.Uri;
package android.support.design.widget;
import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
/**
* Created by vishna on 04/11/15.
*/
public class AppBarLayoutWorkaroundBehavior extends AppBarLayout.Behavior {
@vishna
vishna / fotofall-desktop.md
Created November 20, 2015 20:17
Run Fotofall on Desktop (EXPERIMENTAL )

Privacy Policy

Last revised on 2017-03-11

Fotofall

fotofall for Android

fotofall would like all users to carefully read the information provided. All inquiries are to be directed to: fotofallapp@gmail.com

@vishna
vishna / debounce-broadcast.kt
Created November 5, 2017 19:38
Debounce input from an EditText and relay to a TextView with a timeout.
package me.vishna.kdebounce
import android.support.v7.app.AppCompatActivity
import android.os.Bundle
import android.text.Editable
import android.text.TextWatcher
import android.widget.EditText
import android.widget.TextView
import kotlinx.coroutines.experimental.*
import kotlinx.coroutines.experimental.android.UI
@vishna
vishna / debounce-broadcast.kt
Created November 5, 2017 19:38
Debounce input from an EditText and relay to a TextView with a timeout.
package me.vishna.kdebounce
import android.support.v7.app.AppCompatActivity
import android.os.Bundle
import android.text.Editable
import android.text.TextWatcher
import android.widget.EditText
import android.widget.TextView
import kotlinx.coroutines.experimental.*
import kotlinx.coroutines.experimental.android.UI
@vishna
vishna / better-safe-than-sorry.kt
Created October 4, 2018 15:24
Better safe than sorry
inline fun <T> safe(block: () -> T?) : T? {
return try {
block.invoke()
} catch (t: Throwable) {
null // ¯\_(ツ)_/¯
}
}