Skip to content

Instantly share code, notes, and snippets.

@SwiftyWang
SwiftyWang / config.fish
Created April 12, 2018 02:59 — forked from overtrue/init.fish
config.fish set environment variables from bash_profile
# Fish shell
egrep "^export " ~/.bash_profile | while read e
set var (echo $e | sed -E "s/^export ([A-Z_]+)=(.*)\$/\1/")
set value (echo $e | sed -E "s/^export ([A-Z_]+)=(.*)\$/\2/")
# remove surrounding quotes if existing
set value (echo $value | sed -E "s/^\"(.*)\"\$/\1/")
if test $var = "PATH"
@SwiftyWang
SwiftyWang / Fibonacci.java
Created April 16, 2018 04:50
Best Rx Fibonacci
import java.util.ArrayList;
import java.util.Arrays;
import io.reactivex.Observable;
import io.reactivex.disposables.Disposable;
import io.reactivex.functions.BiFunction;
import io.reactivex.functions.Consumer;
import io.reactivex.functions.Function;
public class Fibonacci {
@SwiftyWang
SwiftyWang / Fibonacci.kt
Created April 16, 2018 04:56
Best Rx Fibonacci
import io.reactivex.Observable
import org.junit.Test
import java.util.*
class Fibonacci {
fun main(args: Array<String>) {
val fibonacci = fibonacci(7)
val disposable = fibonacci.subscribe { integer -> println(integer) }
}
@SwiftyWang
SwiftyWang / util.java
Last active September 7, 2018 07:22
Android get maxTextureSize
public static int getMaxTextureSize() {
int maxTextureSize;
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.JELLY_BEAN_MR1) {
// get a hold of the default display, and initialize.
// This could get more complex if you have to deal with devices that could have multiple displays,
// but will be sufficient for a typical phone/tablet
EGLDisplay dpy = EGL14.eglGetDisplay(EGL14.EGL_DEFAULT_DISPLAY);
int[] vers = new int[2];
EGL14.eglInitialize(dpy, vers, 0, vers, 1);
@SwiftyWang
SwiftyWang / config.fish
Last active October 31, 2018 02:45 — forked from overtrue/init.fish
vi ~/.config/fish/config.fish set environment variables from bash_profile after changed use source ~/.config/fish/config.fish
# Fish shell
egrep "^export " ~/.bash_profile | while read e
set var (echo $e | sed -E "s/^export ([a-zA-Z_]+)=(.*)\$/\1/")
set value (echo $e | sed -E "s/^export ([a-zA-Z_]+)=(.*)\$/\2/")
# remove surrounding quotes if existing
set value (echo $value | sed -E "s/^\"(.*)\"\$/\1/")
if test $var = "PATH"
# Description, Motivation and Context
# Link to the resources (mockups, change description)
# What is the destination branch of this PR?
# How Has This Been Tested?
# Screenshots:
# Does this change require updates outside of the code, like updating the documentation, configuration? If so, was this done?
# Do reviewers should manually test your changes?
# Is the code testable? If not - why?
# Does similar functionality already exist in the codebase? If so, why isn’t this functionality reused?
# Checklist: