Skip to content

Instantly share code, notes, and snippets.

Irina Galata igalata

Block or report user

Report or block igalata

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View triangle.frag
// Author:
// Title:
#ifdef GL_ES
precision mediump float;
#endif
uniform vec2 u_resolution;
bool insideTriangle(vec2 uv) {
View MainActivity.java
import android.animation.ObjectAnimator;
import android.animation.TypeConverter;
import android.animation.ValueAnimator;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.view.ViewPropertyAnimator;
import android.view.animation.TranslateAnimation;
import android.widget.Button;
View CustomView.java
import android.animation.ValueAnimator;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Path;
import android.support.annotation.Nullable;
import android.util.AttributeSet;
import android.view.View;
import android.view.animation.Interpolator;
View MajorityElement.java
public class MajorityElement {
public static void main(String[] args) {
System.out.println(findMajority(new int[]{3, 4, 5, 3, 5, 3, 3, 3, 3, 5, 5, 5, 5, 5, 5, 5, 5}));
}
public static int findMajority(int[] array) {
int candidate = findCandidate(array);
return validate(array, candidate) ? candidate : -1;
}
View GLRenderer.kt
Shape.create {
shape { ShapeType.RECTANGLE }
height { 0.1f }
width { 0.1f }
bitmap { BitmapFactory.decodeResource(context.resources, R.drawable.image) }
}
View ShapeType.kt
enum class ShapeType {
CIRCLE, RECTANGLE, TRIANGLE, NONE
}
View GLRenderer.kt
Shape.create {
shape { ShapeType.RECTANGLE }
height { 0.4f }
width { 0.4f }
bitmap { BitmapFactory.decodeResource(context.resources, R.drawable.circle_2) }
}
View GLRenderer.kt
Shape.create {
shape { ShapeType.TRIANGLE }
height { 0.1f }
width { 0.1f }
color { R.color.colorAccent.rgba(context) }
}
View extensions.kt
fun Int.rgba(context: Context) = ContextCompat.getColor(context, this).rgba()
fun Int.rgba(): Vec4 = Vec4(
Color.red(this).toFloat() / 256f,
Color.green(this).toFloat() / 256f,
Color.blue(this).toFloat() / 256f,
Color.alpha(this).toFloat() / 256f)
View SinInterpolator.kt
class SinInterpolator: Interpolator {
override fun getInterpolation(input: Float) = Math.sin(input.toDouble()).toFloat()
}
You can’t perform that action at this time.