This file contains hidden or 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
#!/usr/bin/python | |
''' | |
A script to generate current timestamp in hexadecimal | |
''' | |
from time import time | |
print hex(int(time())) |
This file contains hidden or 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 android.content.res.Resources; | |
import android.graphics.drawable.Drawable; | |
import android.text.Spannable; | |
import android.text.SpannableStringBuilder; | |
import android.text.style.ImageSpan; | |
import android.view.View; | |
import android.widget.ImageView; | |
import android.widget.LinearLayout; | |
import android.widget.SearchView; | |
import android.widget.TextView; |
This file contains hidden or 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.regex.Pattern; | |
public static final Pattern CPF = Pattern.compile("^([0-9]{3}\\.?){3}-?[0-9]{2}$"); | |
public static final Pattern CEP = Pattern.compile("[0-9]{5}-?[0-9]{3}"); |
This file contains hidden or 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 android.animation.Animator; | |
import android.animation.AnimatorSet; | |
import android.animation.ObjectAnimator; | |
import android.support.v7.widget.RecyclerView; | |
import android.view.View; | |
import android.view.animation.AccelerateDecelerateInterpolator; | |
import java.util.ArrayList; | |
import java.util.List; |
This file contains hidden or 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
#!/usr/local/bin/lua | |
Alah = {} | |
Alah.__index = Alah | |
function Alah:new(latin, arabic, portuguese) | |
o = {} | |
setmetatable(o, self) | |
self.__index = self | |
self.latin = latin |
This file contains hidden or 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
#!/usr/bin/env python | |
from time import time | |
''' | |
Verify if 0 + 1 + 2 + ... + n is equals to (n * (n + 1)) / 2, this | |
method is not using mathematical induction, it is using exhaustion | |
''' | |
def proof(n): | |
for i in range(n + 1): |
This file contains hidden or 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
// Using Lazy on Kotlin | |
private val foo by Delegates.lazy { Foo(getContext()) } | |
//------------------------------------------------------------------------------ | |
// Using the nearest from Lazy in Java 7 | |
private Foo mFoo; | |
public Foo getFoo() { | |
if (mFoo == null) { |
This file contains hidden or 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
// Using Closure on Kotlin | |
button.setOnClickListener { | |
Thread { | |
// Amazing! Just 2 identations, 5 lines and 55 characters "lesser than a half of tweet" | |
}.start() | |
} | |
//------------------------------------------------------------------------------ | |
// Using the nearest from Closure in Java 7 |
This file contains hidden or 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
// Using Singleton on Kotlin | |
public object MySingleton { | |
public fun foo() { | |
} | |
} | |
// And use it on Kotlin | |
MySingleton.foo() |
This file contains hidden or 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
// Using Variables on Kotlin | |
var foo = "mutable foo" | |
val finalFoo = "final foo" | |
val explicitFoo: String = "explicit foo" | |
//------------------------------------------------------------------------------ | |
// Using Variables in Java 7 |