Skip to content

Instantly share code, notes, and snippets.

Find: ^(\W+public void .*?)_([A-Z]{1})([a-zA-Z]*)_([A-Z]{1})([a-zA-Z]*)\(\) \{$
Replace: $1_\l$2$3_\l$4$5() {
This will cause all texts like this:
" public void method1_DoThisDoThat_ReturnThisReturnThat() {"
be relaced with:
" public void method1_doThisDoThat_returnThisReturnThat() {"
@mrleolink
mrleolink / Percolation.java
Last active February 16, 2017 12:38
My implementation of the union-find assignment at: http://coursera.cs.princeton.edu/algs4/assignments/percolation.html. This implementation includes handling backwash with only ONE union-find object and one extra integer array of size n*n to save status of components.
import edu.princeton.cs.algs4.WeightedQuickUnionUF;
/**
* Created by leolink on 11/24/16.
*/
public class Percolation {
private static final int UNOPENED = 0b000;
private static final int OPENED = 0b001;
private static final int CONNECTED_TOP = 0b010;
private static final int CONNECTED_BOTTOM = 0b100;
@mrleolink
mrleolink / open-atlassian-stash-pullrequest.sh
Last active February 22, 2017 06:09 — forked from jakub-g/open-atlassian-stash-pullrequest.sh
Open Atlassian Stash pull request from command line (open browser at the right URL)
#!/bin/bash
##################################################################
# Open Atlassian Stash pull request from command line.
# (opens the default browser at the proper URL with data prefilled)
#
# It infers current branch name, repo name, current user name, from git config.
############################### CONFIG ###########################
URL_PREFIX="https://YOU_GIT_DOMAIN.com/your/project/path/compare/commits?commits&"
package net.leolink.android.rxbus;
import android.support.annotation.IntDef;
import android.support.annotation.NonNull;
import android.util.SparseArray;
import java.lang.annotation.Retention;
import java.util.HashMap;
import java.util.Map;
@mrleolink
mrleolink / WrapContentViewPager.java
Last active February 8, 2018 03:17
ViewPager that wraps current page's height
import android.content.Context;
import android.support.annotation.Nullable;
import android.support.v4.view.PagerAdapter;
import android.support.v4.view.ViewPager;
import android.util.AttributeSet;
import android.view.View;
import android.view.ViewGroup;
/**
* {@link ViewPager} that wraps current page's height