Skip to content

Instantly share code, notes, and snippets.

View cesarferreira's full-sized avatar

César Ferreira cesarferreira

View GitHub Profile
@cesarferreira
cesarferreira / RxLiveData.kt
Created September 28, 2018 10:39 — forked from rubixhacker/RxLiveData.kt
Kotlin extension functions to convert LiveData to and from a Flowable
// Add the following to your build.gradle file
// implementation "android.arch.lifecycle:reactivestreams:1.0.0-beta1"
import android.arch.lifecycle.LifecycleOwner
import android.arch.lifecycle.LiveData
import android.arch.lifecycle.LiveDataReactiveStreams
import io.reactivex.Flowable
/**
@cesarferreira
cesarferreira / base64-to-png.js
Created July 20, 2018 23:42 — forked from miguelmota/base64-to-png.js
Base64 to PNG in Node.js
var fs = require('fs');
var path = require('path');
function base64ToPNG(data) {
data = data.replace(/^data:image\/png;base64,/, '');
fs.writeFile(path.resolve(__dirname, '../tmp/image.png'), data, 'base64', function(err) {
if (err) throw err;
});
}
@cesarferreira
cesarferreira / gist:4ff01dcd68a2489f99344b88bee2a85a
Last active March 29, 2018 18:35 — forked from n00neimp0rtant/gist:9515611
simple squash without rebase

within current branch, squashes all commits that are ahead of master down into one

useful if you merged with upstream in the middle of your commits (rebase could get very ugly if this is the case)

commit any working changes on branch "mybranchname", then...

git checkout master
git checkout -b mybranchname_temp
git merge --squash mybranchname
git commit -am "Message describing all squashed commits"
git branch -m mybranchname mybranchname_unsquashed
@cesarferreira
cesarferreira / better-nodejs-require-paths.md
Created September 25, 2017 22:38 — forked from branneman/better-nodejs-require-paths.md
Better local require() paths for Node.js

Better local require() paths for Node.js

Problem

When the directory structure of your Node.js application (not library!) has some depth, you end up with a lot of annoying relative paths in your require calls like:

var Article = require('../../../models/article');

Those suck for maintenance and they're ugly.

Possible solutions

@cesarferreira
cesarferreira / tmux.md
Created September 20, 2017 14:06 — forked from andreyvit/tmux.md
tmux cheatsheet

tmux cheat sheet

(C-x means ctrl+x, M-x means alt+x)

Prefix key

The default prefix is C-b. If you (or your muscle memory) prefer C-a, you need to add this to ~/.tmux.conf:

remap prefix to Control + a

@cesarferreira
cesarferreira / zsh.md
Created June 14, 2017 10:00 — forked from tsabat/zsh.md
Getting oh-my-zsh to work in Ubuntu
@cesarferreira
cesarferreira / README.md
Created August 26, 2016 10:37 — forked from jxson/README.md
README.md template

Synopsis

At the top of the file there should be a short introduction and/ or overview that explains what the project is. This description should match descriptions added for package managers (Gemspec, package.json, etc.)

Code Example

Show what the library does as concisely as possible, developers should be able to figure out how your project solves their problem by looking at the code example. Make sure the API you are showing off is obvious, and that your code is short and concise.

Motivation

@cesarferreira
cesarferreira / howto.md
Created February 29, 2016 10:54 — forked from neworld/howto.md
How to make faster Android build without sacrificing new api lint check

Original solution sacrifices new api lint check.

Here my solution:

int minSdk = hasProperty('minSdk') ? minSdk.toInteger() : 16

apply plugin: 'com.android.application'

android {
 compileSdkVersion 23
@cesarferreira
cesarferreira / update.sh
Created January 19, 2016 00:58 — forked from kaushikgopal/update.sh
My morning cli ritual
echo "y" | android update sdk --no-ui; echo "yes" | apm upgrade; sudo softwareupdate -i -a; brew update; brew upgrade --all; brew cleanup; brew cask cleanup; npm update npm -g; npm update -g; sudo gem update