Skip to content

Instantly share code, notes, and snippets.

rishabhmhjn / executeShellInGradle
Created November 5, 2014 07:26
Executing shell commands and getting output in gradle
View executeShellInGradle
def getVersionName = { ->
def hashStdOut = new ByteArrayOutputStream()
exec {
commandLine "git", "rev-parse", "--short", "HEAD"
standardOutput = hashStdOut
def buildNumberStdOut = new ByteArrayOutputStream()
exec {
commandLine 'echo', "$BUILD_NUMBER"
rishabhmhjn / android_pkg_name_validate.js
Last active March 2, 2022 02:04
Regex to validate Android Package Name
View android_pkg_name_validate.js
var pattern = /^[a-z][a-z0-9_]*(\.[a-z0-9_]+)+[0-9a-z_]$/i;
rishabhmhjn /
Created December 19, 2014 17:33
Creating Arc shaped progress bars (
package me.rishabhmhjn.droid.widgets;
import android.content.Context;
import android.content.res.TypedArray;
rishabhmhjn / tweetLinky.js
Last active June 5, 2020 19:25
This is an AngularJS filter to linkify #hashtags and @mention texts into respective Twitter URLsDemo -
View tweetLinky.js
var app = angular.module('tLinky', ['ngSanitize']);
app.filter('tweetLinky',['$filter', '$sce',
function($filter, $sce) {
return function(text, target) {
if (!text) return text;
var replacedText = $filter('linky')(text, target);
var targetAttr = "";
if (angular.isDefined(target)) {
View ThreeDotsLoadingBar
package in.jasonleon.vanityviews.widget;
import android.animation.ObjectAnimator;
import android.animation.PropertyValuesHolder;
import android.animation.ValueAnimator;
import android.annotation.TargetApi;
import android.content.Context;
import android.content.res.TypedArray;
import android.os.Build;
import android.util.AttributeSet;
rishabhmhjn /
Created January 16, 2014 04:20
Installing tmux for a local user
# Install libevent
tar -zxf libevent-2.0.21-stable.tar.gz
cd libevent-2.0.21-stable
./configure --prefix=/home/unix_user/usr
make && make install
# Install ncurses
tar -zxf ncurses-5.7.tar.gz
rishabhmhjn /
Last active December 18, 2017 08:08
Custom ListView for use case such as endless scrolling
package me.rishabhmhjn.widgets;
import me.rishabhmhjn.R; // might be diffrent for your use
import android.content.Context;
import android.util.AttributeSet;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.AbsListView;
import android.widget.AbsListView.OnScrollListener;
View .jsbeautifyrc
// The plugin looks for a .jsbeautifyrc file in the same directory as the
// source file you're prettifying (or any directory above if it doesn't exist,
// or in your home folder if everything else fails) and uses those options
// along the default ones.
// Details:
// Documentation:
"html": {
"allowed_file_extensions": ["htm", "html", "xhtml", "shtml", "xml", "svg"],
rishabhmhjn / ip-num-conversion.js
Created July 1, 2016 04:52
Convert IP into Integer and Integer into IP
View ip-num-conversion.js
import _ from 'lodash';
import {
} from 'lodash';
const IP_CAL = [Math.pow(256, 3), Math.pow(256, 2), Math.pow(256, 1), Math.pow(256, 0)];
function ipToNum(ip) {
rishabhmhjn /
Last active January 4, 2016 21:48
bundle install troubleshooting on osx
## Error log
# Using dm-do-adapter (1.2.0)
# Using dm-master-slave-adapter (0.0.4)
# Installing do_mysql (0.10.13)
# Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
# /Users/user/.rvm/rubies/ruby-1.9.3-p448/bin/ruby extconf.rb
# checking for mysql_query() in -lmysqlclient... no
# *** extconf.rb failed ***
# Could not create Makefile due to some reason, probably lack of