This file contains 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 java.util.*; | |
public class HiLo { | |
int random; | |
int guess; | |
public void generateNumber() { | |
random = (int)(Math.random()*100)+1; | |
} |
This file contains 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 final class FileUtils { | |
//Private constructor | |
static List<File> fetchSongs(File rootDir){ | |
final File[] files = rootDir.listFiles(); | |
if(isEmpty(files)) | |
return Collections.emptyList(); | |
return fetchSongs(files); | |
} |
This file contains 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 MainActivity extends AppCompatActivity { | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { | |
Window w = getWindow(); | |
w.setFlags( | |
WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, |
This file contains 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 static final int SWITCH_STATE_LIST_ALPHA = (int)(0.3f*255); | |
public static ColorStateList buildSwitchCompatColorStateListFromResId( | |
Context context, int activatedColorResId) { | |
return buildSwitchCompatColorStateList( | |
context, ContextCompat.getColor(context, activatedColorResId) | |
); | |
} | |
public static ColorStateList buildSwitchCompatColorStateList(Context context, int activatedColor) { |
This file contains 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.github.ppartisan.watchface; | |
import android.graphics.Bitmap; | |
import android.graphics.BitmapFactory; | |
import android.os.AsyncTask; | |
import android.support.annotation.NonNull; | |
import com.google.android.gms.common.api.GoogleApiClient; | |
import com.google.android.gms.wearable.Asset; | |
import com.google.android.gms.wearable.DataItem; |
This file contains 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
<?xml version="1.0" encoding="utf-8"?> | |
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | |
package="com.github.ppartisan.bookmarklet"> | |
<uses-permission android:name="com.android.browser.permission.READ_HISTORY_BOOKMARKS"/> | |
<application | |
android:allowBackup="true" | |
android:icon="@mipmap/ic_launcher" | |
android:label="@string/app_name" |
This file contains 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 static SpannableString getSpannedString(String text, char... triggers) { | |
SpannableString spanString = new SpannableString(text); | |
for (int i = 0; i < spanString.length(); i++) { | |
for (char trigger : triggers) { | |
if (spanString.charAt(i) == trigger) { | |
spanString.setSpan(new ForegroundColorSpan(Color.CYAN), i, i+1, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); | |
} | |
} |
This file contains 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 char[] reverseCharArray(char[] input){ | |
char[] output = new char[input.length]; | |
char temp; | |
int index = 0; | |
for (int i = (output.length - 1); i >= (output.length/2); i--) { | |
temp = input[i]; | |
output[i] = input[index]; | |
output[index] = temp; |
This file contains 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 java.util.*; | |
import java.lang.*; | |
import java.io.*; | |
class WhatsAbubbleSort { | |
public static void main (String[] args) throws java.lang.Exception { | |
final int[] unsorted = new int[] { 23, 25, 7, 13, 94, 11 }; |
This file contains 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 SlowAutoSwipeViewPager extends ViewPager { | |
public SlowAutoSwipeViewPager(Context context) { | |
super(context); | |
} | |
public SlowAutoSwipeViewPager(Context context, AttributeSet attrs) { | |
super(context, attrs); | |
} | |
NewerOlder