Skip to content

Instantly share code, notes, and snippets.

View ademar111190's full-sized avatar
Lightning Networking the Bitcoin

Ademar ademar111190

Lightning Networking the Bitcoin
  • CEO of Bitcoin
  • Itatiba
View GitHub Profile
@ademar111190
ademar111190 / classFieldsExample.java
Last active August 29, 2015 14:17
One month with Kotlin: class fields example
// Using Class Fields on Kotlin
public class Foo(var variable: String, val value: String, val withDefault: String = "o") {
}
// And use it on Kotlin
Foo("f", "o", "o")
Foo("f", "o")
//------------------------------------------------------------------------------
@ademar111190
ademar111190 / nullableExample.java
Last active August 29, 2015 14:17
One month with Kotlin: nullable example
// Using Nullables on Kotlin
var nothing = null
var stringNullable: String? = null
//------------------------------------------------------------------------------
// Using Nullables in Java 7
String alwaysCanBeNull = null
@ademar111190
ademar111190 / lambdaExample.java
Last active January 14, 2018 20:03
One month with Kotlin: lambda example
// Using Lambdas on Kotlin
val items = ArrayList<String>()
items.sortBy { item ->
item.length()
}
//or more implicity
items.sortBy { it.length() }
//------------------------------------------------------------------------------
@ademar111190
ademar111190 / rippleManually.java
Created April 1, 2015 22:36
Just an way to create ripple drawables in java code
// TODO test if works
if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
int[][] states = new int[][] { new int[] { android.R.attr.state_pressed } };
int[] colors = new int[] { color };
ColorStateList colorStateList = new ColorStateList(states, colors);
RippleDrawable rippleDrawable = new RippleDrawable(colorStateList, null, null);
view.setBackground(rippleDrawable);
}
@ademar111190
ademar111190 / README.md
Last active August 29, 2015 14:22
A little example of how manipulate matrix with threads in C

#A little example of how manipulate matrix with threads in C

  • compile:

$ gcc -pthread squareMatrixItemsWithThreads.c -o squareMatrixItemsWithThreads

  • run

$ ./squareMatrixItemsWithThreads

@ademar111190
ademar111190 / .gitconfig
Last active August 29, 2015 14:24
Git config
[user]
email = [email protected]
name = Ademar Alves de Oliveira
[push]
default = simple
[alias]
a = add
b = branch
c = commit
d = diff
@ademar111190
ademar111190 / README.md
Last active August 29, 2015 14:25
Just a study of biological sequence and how Dynamic Programming Alignment works

#Dynamic Programming

Just a study of biological sequence and how Dynamic Programming Alignment works

#How to

./dynamicProgramming.py -a ATA -b GATC > result.json

the result is a json that contains contains:

@ademar111190
ademar111190 / RecyclerItemClickListener.java
Created August 6, 2015 15:17
RecyclerItemClickListener example
import android.support.v7.widget.RecyclerView;
import android.view.GestureDetector;
import android.view.MotionEvent;
public class RecyclerItemClickListener implements RecyclerView.OnItemTouchListener {
private GestureDetector mGestureDetector;
public RecyclerItemClickListener(Context context) {
mGestureDetector = new GestureDetector(context, new GestureDetector.SimpleOnGestureListener() {
@ademar111190
ademar111190 / levenshtein.kt
Last active April 28, 2025 09:11
Levenshtein Distance algorithm implementation using Kotlin
import kotlin.math.min
fun levenshtein(lhs : CharSequence, rhs : CharSequence) : Int {
if(lhs == rhs) { return 0 }
if(lhs.isEmpty()) { return rhs.length }
if(rhs.isEmpty()) { return lhs.length }
val lhsLength = lhs.length + 1
val rhsLength = rhs.length + 1
@ademar111190
ademar111190 / .gitignore
Last active September 7, 2015 23:04
EP1 - Reconhecimento de padrões
out/