Skip to content

Instantly share code, notes, and snippets.

View tyzero's full-sized avatar
🎯
code make me cry😕

Awsl tyzero

🎯
code make me cry😕
View GitHub Profile
@NikolaDespotoski
NikolaDespotoski / ViewModelParameterizedProvider.kt
Last active August 12, 2019 08:11
ViewModelProvider that instantiates ViewModel with parameterized constructor
import android.arch.lifecycle.ViewModel
import android.arch.lifecycle.ViewModelProvider
import android.arch.lifecycle.ViewModelStore
import android.arch.lifecycle.ViewModelStores
import android.support.v4.app.Fragment
import android.support.v4.app.FragmentActivity
import java.util.concurrent.atomic.AtomicBoolean
/**
* Created by Nikola on 7/19/2017.
@erkattak
erkattak / AndroidManifest.xml
Created June 19, 2017 18:47
Android Application Setup for use with Charles Proxy
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme"
android:networkSecurityConfig="@xml/network_security_config">
@gerarldlee
gerarldlee / Experimenting with ChromeOS on VirtualBox.md
Last active May 21, 2024 17:12
Installing ChromeOS on VirtualBox using the NeverWare build

Installing ChromeOS on VirtualBox

  1. Download the NeverWare's ChromeOS build from http://www.neverware.com/freedownload

  2. Extract the *.bin.zip

  3. Convert it to VDI. vboxmanage convertdd chromiumos_image.bin chromiumos_image.vdi

  4. mv chromiumis_image.vdi C:\t\v\chromeos\

public class MainActivity extends AppCompatActivity {
public static class Shop {
public int id;
public String name;
public List<Coordinate> coordinates = new ArrayList<>();
@Override
public String toString() {
String str = id + " (" + name + ") [ ";
# A simple systemd unit file for shadowsocks server (python version)
# See tutorial at shadowsocks' repo master: https://github.com/shadowsocks/shadowsocks/tree/master
#
# Prerequisites
# a) installed shadowsocks server in /usr/local/bin (the default if done through pip)
# b) shadowsocks server configuration json file in /etc/shadowsocks.json
# c) a user called "shadowsocks" that the server will run as
#
# Remember to place this file in /etc/systemd/systemd and then enable this unit with "systemctl enable shadowsocks.service" to have it start at boot
@jaydp17
jaydp17 / build.gradle
Created October 30, 2015 03:31
Kotlin and dataBinding
apply plugin: 'com.android.application'
apply plugin: 'com.android.databinding'
apply plugin: 'kotlin-android'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "com.example.mvptestkotlin"
@jamestalmage
jamestalmage / forward.md
Last active April 9, 2024 17:21
Using Firebase to Authenticate to Google Drive

Note: There is a lot of information here, but if I have provided a link, it is probably something you should click on and read. OAuth is a complex enough subject on it's own, and hacking these two services together only adds to it.

Even so, I have found Firebase's API to be simpler than almost any other OAuth solution I have explored. When all is said and done, the important bits of code related to authentication is actually less than 10 lines. If you have ever tried to implement your own OAuth flow before, you know how amazing that is.

In the end, it may be worth using Firebase for authentication, even if that's the ONLY thing you use it for.

@pyricau
pyricau / OomExceptionHandler.java
Created May 6, 2015 17:18
Dump the heap on OutOfMemoryError crashes in your debug builds.
import android.content.Context;
import android.os.Debug;
import java.io.File;
public class OomExceptionHandler implements Thread.UncaughtExceptionHandler {
private static final String FILENAME = "out-of-memory.hprof";
public static void install(Context context) {
Thread.UncaughtExceptionHandler defaultHandler = Thread.getDefaultUncaughtExceptionHandler();
@bowmanb
bowmanb / RxJavaCollectExample.java
Last active February 22, 2020 14:07
RxJava collect() example. Converting a list of phrases into a list of their IDs only.
@Override
public void onNext(ArrayList<Phrase> phrases) {
ArrayList<Integer> phraseIDs = new ArrayList<>();
Observable
.from(phrases)
.collect(phraseIDs, new Action2<ArrayList<Integer>, Phrase>() {
@Override
public void call(ArrayList<Integer> integers, Phrase phrase) {
integers.add(phrase.getId());
}
@JaviLorbada
JaviLorbada / FRP iOS Learning resources.md
Last active April 8, 2024 18:07
The best FRP iOS resources.

Videos