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
yell(){ | |
n=$(( $RANDOM % 5 )); | |
case $n in | |
0) | |
echo "WHEATIESSSS BOX" | |
;; | |
1) | |
echo "BISCUITTSSSSSS" | |
;; | |
2) |
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
int temp = 100; //This value could be read in from a GUI | |
if(temp >= 90){ | |
System.out.println("It's pretty hot it's greater than 90 degrees"); | |
}else if(temp <= 90 && temp >= 75){ | |
System.out.println("It's under 90 but over 75"); | |
}else if(temp <= 75 && temp >= 50){ | |
System.out.println("It's under 75 but over 50"); | |
}else if(temp <= 50 && temp >= 33){ | |
System.out.println("It's under 50 but over 33"); | |
}else{ |
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
int one = 1; //int = integer(datatype) one = name of varible | |
int two = 2; // ^^ | |
// = is how you assign a value to a varible | |
// boolean = datatype(true or false) whichIsGreater is the name | |
// one > two = expression that will evaulate to true or false | |
boolean whichIsGreater = (one > two); | |
System.out.println(whichIsGreater); // will print false | |
// I wrapped the expression in parens because that's the order of ops thing (PEMDAS) |
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 class Password{ | |
public static void main(String args[]){ | |
log(isValidPassword("Cookies123%");//Should print true | |
log(isValidPassword("Cookies");//Should print false | |
log(isValidPassword("Cookies12");//Should print false | |
log(isValidPassword("");//Should print false | |
log(isValidPassword(null);//Should print false | |
log(isValidPassword("c");//Should print false |
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
new AsyncTask<Void, Void, String>() { | |
@Override | |
public String doInBackground(Void... params) { | |
String result = new String(); | |
return result; | |
} | |
@Override | |
public void onPostExecute(String response) { | |
} |
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
int[][] scaleImageData(int[][] sourceData, int scaleFactor) { | |
int[][] doubleSource = new int [sourceData.length * scaleFactor][soureData[0].length * scaleFactor]; | |
for(int i = 0; i < sourceData.length; i++){ | |
for(int j = 0; j < sourceData[i].length; j++){ | |
for(int k = 0; k < scaleFactor; k++){ | |
for(int z = 0; z < scaleFactor ; z++) | |
doubleSource[i * scaleFactor + k][j * scaleFactor +z] = sourceData[i][j]; | |
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.itv.util; | |
import android.view.View; | |
import android.view.ViewGroup; | |
import android.widget.BaseAdapter; | |
public class DataDelegateAdapter<T> extends BaseAdapter { | |
private DataAdapterDelegate<T> delegate; | |
private boolean shouldLoadMoreData = true; |
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 class PersistentStore { | |
private static final String SHARED_PREFERENCES = "tvtag_PS_ATGAR"; | |
private static final String SYNC = "sync"; | |
private static SharedPreferences getSharedPreferences(Context context) { | |
return context.getSharedPreferences(SHARED_PREFERENCES, Context.MODE_PRIVATE); | |
} | |
private static SharedPreferences.Editor getSharedPreferencesEditor(Context context) { |
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
-module(bot). | |
-behaviour(gen_server). | |
-export([start_link/0]). | |
-export([init/1, handle_call/3, handle_cast/2, handle_info/2, terminate/2, code_change/3]). | |
start_link() -> | |
gen_server:start_link({local,?MODULE},?MODULE, [], []). | |
init([]) -> {ok, []}. |
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 <T,U> Observable<Response<T>> createRequest(U data, Func1<U, Call<T>> endpoint){ | |
return Observable.create(new Observable.OnSubscribe<Response<T>>() { | |
@Override | |
public void call(Subscriber<? super Response<T>> subscriber) { | |
if (isThereInternetConnection()) { | |
Call<T> request = endpoint.call(data); | |
try { | |
Response<T> response = request.execute(); | |
int code = response.code(); | |
if (response.isSuccess()) { |