- [Data Structures] (https://gist.github.com/lawloretienne/6f7d7d92f72986f5ebd60f226d9044ee#data-structures)
- [Linked Lists] (https://gist.github.com/lawloretienne/6f7d7d92f72986f5ebd60f226d9044ee#linked-lists)
- [Trees] (https://gist.github.com/lawloretienne/6f7d7d92f72986f5ebd60f226d9044ee#trees)
- [Binary Trees] (https://gist.github.com/lawloretienne/6f7d7d92f72986f5ebd60f226d9044ee#binary-trees)
- [Binary Search Tree] (https://gist.github.com/lawloretienne/6f7d7d92f72986f5ebd60f226d9044ee#binary-search-tree)
- [Red-Black Tree] (https://gist.github.com/lawloretienne/6f7d7d92f72986f5ebd60f226d9044ee#red-black-tree)
- [AVL Tree] (https://gist.github.com/lawloretienne/6f7d7d92f72986f5ebd60f226d9044ee#avl-tree)
- [Tries] (https://gist.github.com/lawloretienne/6f7d7d92f72986f5ebd60f226d9044ee#tries)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private Uri getResourceUri(Resources resources, int resourceID) { | |
return Uri.parse("android.resource://"+resources.getResourcePackageName(resourceID)+"/"+ | |
resources.getResourceTypeName(resourceID) + '/' | |
+ resources.getResourceEntryName(resourceID) ); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
final MessageDigest md5 = MessageDigest.getInstance("MD5"); | |
final byte[] digest = md5.digest(text.getBytes()); | |
String hash = new String(digest); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.com.com; | |
import android.util.Log; | |
import java.io.DataInputStream; | |
import java.io.DataOutputStream; | |
import java.io.InputStream; | |
public class CMDProcessor { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
adb shell dumpsys window windows | grep -E 'mCurrentFocus|mFocusedApp|mObscuringWindow' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.simpleframework.xml.Element; | |
import org.simpleframework.xml.ElementList; | |
import org.simpleframework.xml.Root; | |
import java.util.List; | |
@Root(name = "channel",strict = false) | |
class Feed { | |
@Element(name = "channel") | |
Channel channel; |
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static byte[] hexStringToByteArray(String s) { | |
int len = s.length(); | |
byte[] data = new byte[len / 2]; | |
for (int i = 0; i < len; i += 2) { | |
data[i / 2] = (byte) ((Character.digit(s.charAt(i), 16) << 4) | |
+ Character.digit(s.charAt(i+1), 16)); | |
} | |
return data; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static <T> T[] joinArrays(T[] first,T[] second){ | |
T[] joined = (T[]) Array.newInstance(second.getClass(),first.length+second.length); | |
for (int i = 0; i < first.length; i++) { | |
joined[i] = first[i]; | |
} | |
for (int i = 0; i < second.length; i++) { | |
joined[i+first.length] = second[i]; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static void openStream(final Context context){ | |
final InputStream stream = context.getResources().openRawResource(R.raw.messages); | |
String string=convertStreamToString(stream); | |
try { | |
stream.close(); | |
} catch (IOException e) { | |
e.printStackTrace(); | |
} | |
} | |
static String convertStreamToString(java.io.InputStream is) { |