Skip to content

Instantly share code, notes, and snippets.

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Portfólio</title>
<style>
body {
background-color: #000000;
@jgabrielfreitas
jgabrielfreitas / SimpleStopwatch.md
Last active August 3, 2020 02:07
Simple stopwatch in kotlin
object SimpleStopwatch {
    suspend fun <T> runWithStopWatch(log: Logger, tag: String, block: suspend () -> T): T {
        val start = System.currentTimeMillis()
        val result = block()
        val executionTime = System.currentTimeMillis() - start
        log.info("=======> $tag took ${executionTime}ms to finish")
        return result
 }
public interface IRepository<T>
{
Task Insert(T entity);
Task<T> Get(T Id);
Task Update(T entity);
Task Delete(T entity);
}
public interface IUserRepository : IRepository<User> {
}
public void Update(User user)
{
var result = db.Users.SingleOrDefault(currentUser => currentUser.Id == user.Id);
if (result != null)
{
db.SaveChanges();
}
}
@jgabrielfreitas
jgabrielfreitas / transaction_notifier.md
Created September 28, 2018 22:53
Transaction Notifier contracts

Transaction Notifier

Enums

CancellationReason
Option Resolution
Unspecified Unspecified reason
CustomerCancellation The customer requested a cancellation
TimeoutWaitingForResponse Timeout waiting for a response
UnexpectedResponse The received response message was different than expected, e.g., an HTTP 500 status
@jgabrielfreitas
jgabrielfreitas / cip.md
Last active February 19, 2018 20:39
status mapeados da CIP

CIP

Status iOS Android API
toReceive 0 0
created 10 10
paid 30 30
discount 31 31
discount2 40 40
scheduled 20 20
@jgabrielfreitas
jgabrielfreitas / train.sh
Created August 18, 2017 05:19
shell script to git push and show a train
git add --all
git commit -m "$1"
git push -u origin master
echo "\n\n\n"
echo " ( ) (@@) ( ) (@) () @@ O @ O @"
echo " (@@@)"
echo " ( ) **********************"
echo " (@@@@) *** DEMO PUBLISHED ***"
# Black 0;30 Dark Gray 1;30
# Red 0;31 Light Red 1;31
# Green 0;32 Light Green 1;32
# Brown/Orange 0;33 Yellow 1;33
# Blue 0;34 Light Blue 1;34
# Purple 0;35 Light Purple 1;35
# Cyan 0;36 Light Cyan 1;36
# Light Gray 0;37 White 1;37
# .---------- constant part!
# vvvv vvvv-- the code from above
@jgabrielfreitas
jgabrielfreitas / sdk_cleaner.sh
Created February 10, 2017 17:23
remove *.txt files from Stone's SDK for android
path="$PWD"
for item in $(find "$path" -name \*.jar)
do
filename=`basename $item`
if grep -q "sdk" <<<$filename; then
7z d "$item" org/apache/commons/codec/language/bm/
fi
done
dependencies {
  // todas aquelas libs maravilhosas que já conhecemos
  // compile project(':logger') <- antiga referência
  compile 'com.jgabrielfreitas:logger:1.0.0'
}