Skip to content

Instantly share code, notes, and snippets.

View Cassie-von-Clausewitz's full-sized avatar
🏠
Working from home

Cassie von Clausewitz Cassie-von-Clausewitz

🏠
Working from home
View GitHub Profile
@Cassie-von-Clausewitz
Cassie-von-Clausewitz / gist:5d3870c0f3c1205c7e9c
Created January 11, 2015 20:22
Computer Science 1 Java Setup Ubuntu
#!/usr/bin/env bash
sudo su
#add the java 8 repo
sudo add-apt-repository -y ppa:webupd8team/java
#add the Sublime Text 3 repo
sudo add-apt-repository -y ppa:webupd8team/sublime-text-3
{
"bold_folder_labels": true,
"color_scheme": "Packages/Material Theme/schemes/Material-Theme.tmTheme",
"fade_fold_buttons": false,
"font_size": 14,
"highlight_line": true,
"ignored_packages":
[
"Vintage"
],
echo Converting $1
mkdir -p res/drawable-mdpi
mkdir -p res/drawable-hdpi
mkdir -p res/drawable-xhdpi
mkdir -p res/drawable-xxhdpi
m=48
h=72
x=96
public static Bitmap getBitmapFromView(View view) {
//Define a bitmap with the same size as the view
Bitmap returnedBitmap = Bitmap.createBitmap(view.getWidth(), view.getHeight(), Bitmap.Config.ARGB_8888);
//Bind a canvas to it
Canvas canvas = new Canvas(returnedBitmap);
//Get the view's background
Drawable bgDrawable = view.getBackground();
if (bgDrawable != null) {
//has background drawable, then draw it on the canvas
bgDrawable.draw(canvas);
@Cassie-von-Clausewitz
Cassie-von-Clausewitz / andoird_sdk_accept
Last active December 27, 2016 20:19
Accept Android tools license build server
(while :
do
echo 'y'
sleep 2
done) | android update sdk --no-ui --filter build-tools-25.0.2,android-25,extra-android-m2repository
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
<base-config>
<trust-anchors>
<certificates src="system"/>
<certificates src="user"/>
</trust-anchors>
</base-config>
</network-security-config>

Keybase proof

I hereby claim:

  • I am kylealanr on github.
  • I am kylealanr (https://keybase.io/kylealanr) on keybase.
  • I have a public key ASCNT3EJU4rTHNzz9olE-a8l2sWCu4ofIJnBKxi301cXAwo

To claim this, I am signing this object:

@Cassie-von-Clausewitz
Cassie-von-Clausewitz / BottomSheet.java
Created April 17, 2017 19:02
Clean up the state of the NestedScrollView inside the CoordinatorLayout. Use to test if this would work before subclassing CoordinatorLayout and calling the protected method directly.
try {
Class c = parent.getClass().getSuperclass();
Method cleanupLayoutState = c.getDeclaredMethod("cleanupLayoutState", View.class);
if(!cleanupLayoutState.isAccessible()) {
cleanupLayoutState.setAccessible(true);
}
cleanupLayoutState.invoke(parent, this);
# Your init script
#
# Atom will evaluate this file each time a new window is opened. It is run
# after packages are loaded/activated and after the previous editor state
# has been restored.
#
# An example hack to log to the console when each text editor is saved.
#
# atom.workspace.observeTextEditors (editor) ->
# editor.onDidSave ->
@Cassie-von-Clausewitz
Cassie-von-Clausewitz / GestureDetectors.java
Created May 3, 2017 17:41
OnGestureEvent implimentations for use with GestureDetectorCompat. Makes it easer to use lambdas.
import android.view.GestureDetector;
import android.view.MotionEvent;
import com.fernandocejas.arrow.functions.Function;
import com.fernandocejas.arrow.functions.Predicate;
public class GestureDetectors {
public static class OnDown implements GestureDetector.OnGestureListener {
private final Predicate<MotionEvent> predicate;