Skip to content

Instantly share code, notes, and snippets.

View ElFeesho's full-sized avatar

ElFeesho

View GitHub Profile
build.doLast() {
// Augmented from https://github.com/bascan/kotlin-js-example/blob/master/build.gradle
def jsFileFilter = { fileTreeElement ->
def path = fileTreeElement.path
path.endsWith(".js") && (path.startsWith("META-INF/resources/") || !path.startsWith("META-INF/"))
}
configurations.compile.each { File file ->
copy {
@ElFeesho
ElFeesho / main.cpp
Created May 19, 2016 18:47
Rule of 5 and Rule of 0 demonstration
#include <iostream>
#include "refcount.h"
class Foo {
public:
explicit Foo() { }
private:
RefCount<Foo> _ref;
@ElFeesho
ElFeesho / ProfileImageView.java
Last active December 19, 2015 15:55
ProfileImageView
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Matrix;
import android.graphics.drawable.Drawable;
import android.renderscript.Allocation;
import android.renderscript.Element;
import android.renderscript.RenderScript;
import android.renderscript.ScriptIntrinsicBlur;
import android.os.SystemClock;
import android.util.Log;
public class ProfileLog {
private static final long startTime = SystemClock.uptimeMillis();
public static void tick()
{
StackTraceElement stackTraceElement = new Exception().getStackTrace()[1];
package uk.czcz.themeingtest;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Matrix;
import android.util.AttributeSet;
import android.widget.ImageView;
public class ProfileImageView extends ImageView {
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Matrix;
import android.util.AttributeSet;
import android.widget.ImageView;
public class ProfileImageView extends ImageView {
private Matrix matrix = null;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.RectF;
import android.util.AttributeSet;
import android.view.View;
import java.util.ArrayList;
import java.util.List;
class MyObject
{
public:
MyObject(int someInt)
{
this->someInt = someInt; // someInt will be allocated and then set to a value separately (inefficient)
}
private:
int someInt;
};
Annoying and difficult to work with
class AwesomeService
{
public List<Model> getMyAwesomeModel()
{
... Takes a long time
}
}
@ElFeesho
ElFeesho / gist:f42a56c48b88f4ac0c2c
Created November 27, 2015 20:21
Simple line only Pie chart
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.RectF;
import android.util.AttributeSet;
import android.view.View;
import java.util.ArrayList;
import java.util.List;