Skip to content

Instantly share code, notes, and snippets.

View amadeu01's full-sized avatar
:octocat:
Working from Stockholm

Amadeu Cavalcante Filho amadeu01

:octocat:
Working from Stockholm
View GitHub Profile
@almozavr
almozavr / jacoco.gradle
Last active January 5, 2021 12:37
Gradle Jacoco config for Android (3.x plugin) with kotlin and custom excludes support
apply plugin: "jacoco"
jacoco {
toolVersion = deps.test.jacocoVersion
}
tasks.withType(Test) {
jacoco.includeNoLocationClasses = true
}
@amadeu01
amadeu01 / my-helper.md
Last active March 1, 2018 17:15
This is me collection of small codes that have been helped me at some point in my life :D

This is my collections of helpers:

public String convert(InputStream inputStream, Charset charset) throws IOException {
 
	StringBuilder stringBuilder = new StringBuilder();
	String line = null;
	
	try (BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream, charset))) {	
# Go parameters
GOCMD=go
GOBUILD=$(GOCMD) build
GOCLEAN=$(GOCMD) clean
GOTEST=$(GOCMD) test
GOGET=$(GOCMD) get
BINARY_NAME=mybinary
BINARY_UNIX=$(BINARY_NAME)_unix
@Ravi61
Ravi61 / CustomDateCoding.swift
Created July 13, 2017 15:16
Custom Date Encoding/Decoding
// Custom Date Decoding
jsonDecoder.dateDecodingStrategy = .custom({ (decoder) -> Date in
let data = try decoder.singleValueContainer().decode(String.self)
//perform your operation on obtained string
let disturbance = "01-07-1977"
let formatter = DateFormatter()
formatter.dateFormat = "dd-MM-yyyy"
if data == "First disturbance in force" {
return formatter.date(from: disturbance) ?? Date()
} else {
public class FileLoggingTree extends Timber.DebugTree {
private static final String TAG = FileLoggingTree.class.getSimpleName();
private Context context;
public FileLoggingTree(Context context) {
this.context = context;
}
@inamiy
inamiy / SwiftElmFrameworkList.md
Last active March 11, 2024 10:20
React & Elm inspired frameworks in Swift
@candostdagdeviren
candostdagdeviren / pre-commit
Last active April 22, 2023 09:32
Git Pre-Commit hook with SwiftLInt
#!/bin/bash
#Path to swiftlint
SWIFT_LINT=/usr/local/bin/swiftlint
#if $SWIFT_LINT >/dev/null 2>&1; then
if [[ -e "${SWIFT_LINT}" ]]; then
count=0
for file_path in $(git ls-files -m --exclude-from=.gitignore | grep ".swift$"); do
export SCRIPT_INPUT_FILE_$count=$file_path
@maxhanglin
maxhanglin / eureka_swift_3:searchable_push_row.swift
Created April 13, 2017 16:20
Searchable Push Row for Eureka
import Eureka
open class _SearchablePushRow<T: Equatable, Cell: CellType> : TableSelectorRow<Cell, SearchableViewController<T>> where Cell: BaseCell, Cell: TypedCellType, Cell.Value == T, T: SearchableItem, T: CustomStringConvertible {
public required init(tag: String?) {
super.init(tag: tag)
onCreateControllerCallback = { [weak self] _ in
let controller = SearchableViewController<T>()
controller.searchPlaceholder = self?.searchPlaceholder
return controller
@danilosilvadev
danilosilvadev / LambdaExpressionsInLessThanTwoMinute.md
Last active April 27, 2021 21:07
Lambda Expressions in less than 2 minutes

Sample:

Fact 1 - Consider the methods has 2 parts: HEAD(public void nameOfMethod(Input input)) and BODY({Everything inside the keys}).

//without lambda you still use the HEAD as always.
    public void printName() {
        System.out.println(“Print without lambda”);
 }
@stefangordon
stefangordon / mjpegexample.js
Created December 21, 2016 16:13
React Native MJPEG
var styles = StyleSheet.create({
backgroundVideo: {
width:400,
height:322
}
})
return (
<View>
<WebView