Skip to content

Instantly share code, notes, and snippets.

export ANDROID_HOME="$HOME/Library/Android/sdk"
export PATH=$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools
export JAVA_HOME=/Applications/Android\ Studio.app/Contents/jre/jdk/Contents/Home/
# reloads the prompt, usefull to take new modifications into account
alias reload="source ~/.bash_profile"
#alias pull="git smart-pull"
#alias push="git push origin master"
alias log="adb logcat -v time"
@dmnugent80
dmnugent80 / LongestConsecutive.java
Created October 28, 2018 23:58
Longest Consecutive Integers in a list
class Solution {
public int longestConsecutive(int[] nums) {
if (nums.length == 0) return 0;
Set<Integer> numSet = new HashSet<>();
for (int num : nums) {
numSet.add(num);
}
int maxCon = Integer.MIN_VALUE;
for (int i = 0; i < nums.length; i++) {
@dmnugent80
dmnugent80 / PriorityQueueSortMapValue.java
Created October 28, 2018 20:15
PriorityQueue sort HashMap by value - character frequency
class Solution {
public String frequencySort(String s) {
if (s.length() < 1) return "";
Map<Character, Integer> charMap = new HashMap<>();
for (char ch : s.toCharArray()) {
Integer count = charMap.get(ch);
if (count != null) {
charMap.put(ch, count + 1);
export ANDROID_HOME="$HOME/android-sdk-macosx"
export PATH=$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools
export ANDROID_NDK=/usr/local/Cellar/android-ndk/r10e
export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"
# reloads the prompt, usefull to take new modifications into account
alias reload="source ~/.bash_profile"
alias pull="git smart-pull"
String[] user_name_array = new String[3];
user_name_array[0] = "test_user_1";
user_name_array[1] = "test_user_2";
user_name_array[2] = "test_user_3";
StringList.ByReference members = new StringList.ByReference();
//members.length = 3;
//members.strings = new StringArray(user_name_array);
members.writeField("length", 3);
members.writeField("strings", new StringArray(user_name_array));
MyNativeLibrary.myMethod(members);
# Skip this section below if this device is not connected by USB
SUBSYSTEM!="usb", GOTO="android_usb_rules_end"
LABEL="android_usb_rules_begin"
# Devices listed here in android_usb_rules_{begin...end} are connected by USB
# Acer
ATTR{idVendor}=="0502", ENV{adb_user}="yes"
# Iconia Tab A500
ATTR{idVendor}=="0502", ATTR{idProduct}=="3325", SYMLINK+="android_adb"
class PostAsync extends AsyncTask<String, String, JSONObject> {
JSONParser jsonParser = new JSONParser();
private ProgressDialog pDialog;
private static final String LOGIN_URL = "http://dnugent.nicewebsite.info/DevTest/json_php/testPost.php";
private static final String TAG_SUCCESS = "success";
private static final String TAG_MESSAGE = "message";
import android.util.Log;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.BufferedInputStream;
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException;
public class JSONParser {
static InputStream is = null;
static JSONObject jObj = null;
static String json = "";
// constructor
public JSONParser() {
}
// function get json from url
// by making HTTP POST or GET method
public JSONObject makeHttpRequest(String url, String method,
<?php
// array for JSON response
$response = array();
// check for required fields
if (isset($_POST['name']) && isset($_POST['password'])) {
$name = $_POST['name'];
$message = $_POST['message'];