Skip to content

Instantly share code, notes, and snippets.

🤓
🦀

Felipe Lima felipecsl

🤓
🦀
Block or report user

Report or block felipecsl

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@felipecsl
felipecsl / restart coreaudio daemon
Created Mar 16, 2013
Restart Mac OS X coreaudio daemon. Useful if you cannot change the audio output device to Airplay.
View restart coreaudio daemon
sudo kill `ps -ax | grep 'coreaudiod' | grep 'sbin' |awk '{print $1}'`
View install-ffmpeg-amazon-linux.sh
sudo yum install autoconf automake bzip2 bzip2-devel cmake freetype-devel gcc gcc-c++ git libtool make mercurial pkgconfig zlib-devel -y
mkdir ~/ffmpeg_sources
# nasm
cd ~/ffmpeg_sources
curl -O -L https://www.nasm.us/pub/nasm/releasebuilds/2.14.02/nasm-2.14.02.tar.bz2
tar xjvf nasm-2.14.02.tar.bz2
cd nasm-2.14.02
./autogen.sh
./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin"
@felipecsl
felipecsl / GifDecoder.java
Last active Mar 28, 2019
Android custom ImageView that handles animated GIFs.
View GifDecoder.java
/**
* Copyright (c) 2013 Xcellent Creations, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
@felipecsl
felipecsl / ExceptionParser.java
Last active Jan 28, 2019
Helper class to parse error response body on Retrofit 2
View ExceptionParser.java
public static class ExceptionParser {
private final ResponseBody body;
private final String bodyString;
private final Converter.Factory converterFactory;
public ExceptionParser(Response response, Converter.Factory converterFactory) {
this.converterFactory = converterFactory;
this.body = cloneResponseBody(response.errorBody());
this.bodyString = getBodyAsString(body);
}
@felipecsl
felipecsl / code-of-conduct.md
Last active Oct 19, 2018
Brazil Tech Expats Slack group Code of Conduct
View code-of-conduct.md

Código de Conduta

O Brazil Tech Expats se esforça para criar um espaço confortável para todos os membros da nossa comunidade em crescimento. Nós acreditamos em respeito, compaixão, compreensão e inclusão, e esperamos que todos os membros da comunidade se comportem em concordância com estes valores.

Não toleramos qualquer espécie de assédio. Qualquer pessoa que for identificada participando de comportamentos de assédio será contactada por uma pessoa da administração, que solicitará a interrupção de quaisquer atividades inapropriadas ou que a pessoa se desligue imediatamente da nossa comunidade.

Assédio inclui, mas não se limita a:

  • Comentários ofensivos sobre a identidade de uma pessoa;
  • Comentários indesejados sobre as escolhas e práticas de estilo de vida de uma pessoa;
@felipecsl
felipecsl / NoOverscrollSwipeRefreshLayout.java
Last active Jul 21, 2018
Modified Android SwipeRefreshLayout that does not move down the content view on swipe down (no overscroll)
View NoOverscrollSwipeRefreshLayout.java
/*
* Copyright (C) 2013 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@felipecsl
felipecsl / MutableLazy.kt
Created Oct 22, 2017
A Kotlin lazy that can be set to override the initializer value
View MutableLazy.kt
private fun <T> mutableLazy(initializer: () -> T) = Delegate(lazy(initializer))
class Delegate<T>(private val lazy: Lazy<T>) {
private var value: T? = null
operator fun getValue(thisRef: Any?, property: KProperty<*>): T {
return value ?: lazy.getValue(thisRef, property)
}
operator fun setValue(thisRef: Any?, property: KProperty<*>, value: T) {
@felipecsl
felipecsl / phone-number-combinations.rs
Created Apr 15, 2018
My first Rust program - Given a string containing digits from 2-9 inclusive, return all possible letter combinations that the number could represent.
View phone-number-combinations.rs
// https://leetcode.com/problems/letter-combinations-of-a-phone-number/description/
use std::collections::HashMap;
use std::char;
use std::iter::FromIterator;
fn main() {
let mappings = init_map();
find_combinations("23", mappings)
}
@felipecsl
felipecsl / extensions.kt
Last active Jan 30, 2018
Helpful Kotlin extension functions
View extensions.kt
import com.fasterxml.jackson.core.type.TypeReference
import com.fasterxml.jackson.databind.ObjectMapper
import org.gradle.api.Task
import org.gradle.api.Project
import org.gradle.api.UnknownTaskException
import org.gradle.api.GradleException
import org.gradle.api.plugins.ExtraPropertiesExtension
@SuppressWarnings("UNCHECKED_CAST")
fun <T> Project.ext(key: String): T {
View longest-substring.rb
def length_of_longest_substring(str)
if str.empty?
return 0
end
map = {}
curr_start = 0
max_length = 0
found_start = 0
found_end = 0
i = 0
You can’t perform that action at this time.