Skip to content

Instantly share code, notes, and snippets.

Orhan Obut orhanobut

Block or report user

Report or block orhanobut

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@orhanobut
orhanobut / gist:9362716
Created Mar 5, 2014
find the node in k distance in a given tree list, solution 2 : reverse back complexity = o (n)
View gist:9362716
public class HelloWorld {
public static void main(String[] args) {
Node r = new Node(0);
r.left = new Node(1);
r.right = new Node(2);
r.left.left = new Node(3);
r.left.right = new Node(4);
@orhanobut
orhanobut / gist:9362671
Last active Aug 29, 2015
find the node in k distance in a given tree list, solution 1 : shifting -> complexity = o (n)
View gist:9362671
public class HelloWorld {
public static void main(String[] args) {
Node r = new Node(0);
r.left = new Node(1);
r.right = new Node(2);
r.left.left = new Node(3);
r.left.right = new Node(4);
@orhanobut
orhanobut / gist:f1f0d9e59cb57c95b916
Created Oct 19, 2014
Create strike effect on text
View gist:f1f0d9e59cb57c95b916
textview.setText("my text");
textview.setPaintFlags(textview.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG);
View proguard.pro
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in /Applications/Android Studio.app/sdk/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the proguardFiles
# directive in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# Add any project specific keep options here:
View hotspotforwindows.txt
netsh wlan set hostednetwork mode=allow ssid=name_of_network key=password
netsh wlan start hostednetwork
@orhanobut
orhanobut / MoveView.java
Created Dec 3, 2014
Move a view with fingers
View MoveView.java
//set imageview listener
imageView.setOnTouchListener(onButtonTouchListener);
//control the movement
private final View.OnTouchListener onButtonTouchListener = new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
switch (event.getAction()){
case MotionEvent.ACTION_DOWN:
return true;
@orhanobut
orhanobut / stringmatchnumeric.java
Created Dec 16, 2014
To check whether string is positive numeric
View stringmatchnumeric.java
string.matches("\\d+")
View git best practices.md

#to get started with dev -create a fork of the Signal-iOS repo https://github.com/WhisperSystems/Signal-iOS (click fork)

-clone that repo into a nice local directory

-add the original repository as a remote git remote add upstream https://github.com/WhisperSystems/Signal-iOS.git

@orhanobut
orhanobut / ReverseSinglyList.java
Created Apr 22, 2015
Reverse singly list in place
View ReverseSinglyList.java
public static Node reverse(Node root){
if (root == null) return null;
Node p = null;
Node n = root;
while (n != null){
Node t = n.next;
n.next = p;
p = n;
n = t;
}
View User.java
public class User {
private String name;
private Account account;
public String getName(){
return name;
}
public Account getAccount(){
return account;
You can’t perform that action at this time.