This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Scope | |
@Retention(AnnotationRetention.RUNTIME) | |
annotation class ActivityScope |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#gives you details on the installed version of Docker | |
docker version | |
#runs a container from the image (if it has not a copy of the image in its cache, will download it beforehand) | |
docker container run hello-world | |
#getting a list of running containers | |
docker container ls | |
#getting a list of all containers | |
docker container ls --all |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- Create Security Profiles | |
- Wireless -> Security Profiles | |
- Create wireless interface | |
- Wireless -> Interfaces -> add Virtual AP | |
- name: wlan2 | |
- SSID: my_custom_ssid | |
- Master Interface: wlan | |
- Assign an IP Pool and Address | |
- IP -> Address > + | |
- Address: 10.10.10.1/24 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- when to use removeObservers? | |
- reuse LD in repo or create new instance per repo requet? i prefer to reuse | |
- use singleton repos? | |
- use single event? or LiveData.setValue(null)? | |
- best practice: use Event class (see https://link.medium.com/qjuB2VGnoV) | |
- use live data or single event in repo? | |
- if we don't reuse LD in repo, then we could use LD (single event is useless) | |
- observeForever is not implemented in single live event | |
- mediators internally use observeForever | |
- Use a repo livedata in two view models: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Using ES6's Proxy for safe Object property access | |
This gist is inspired from: | |
https://gidi.io/2016/02/07/using-es6-s-proxy-for-safe-object-property-access.html | |
*/ | |
const isObject = (obj: any) => obj && typeof obj === "object"; | |
const hasKey = (obj: any, key: string | number | symbol) => key in obj; | |
const UndefinedObj: ProxyHandler<{}> = new Proxy( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
docker pull node:8.12-alpine | |
docker image ls | |
docker image rm | |
docker run --name <container-name> node:8.12-alpine | |
docker ps -a | |
docker rm <container-name> | |
docker run -it --name dnode node:8.12-alpine sh | |
docker start dnode | |
docker stop dnode | |
docker restart dnode |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# example of running this file: python play_mp3.py path/to/root/mp3/directory 45 | |
# 45 in above example is number of files to play (optional) | |
import os,random,time,sys,subprocess,threading | |
def getFiles(path, extension, recursive=True): | |
files = [] | |
directories = [] | |
for path,directory,element in os.walk(path,False): | |
if recursive: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
aapt.exe dump badging %1 | findstr versionName | |
pause |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
def subModify(subtitleStr): | |
modified = [] | |
words = subtitleStr.split() | |
insertIndex = -1 | |
curIsEn = False | |
preIsEn = False | |
for word in words: | |
preIsEn = curIsEn |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.iranfmcg.dokan.customer.helper; | |
import android.os.AsyncTask; | |
import android.support.annotation.MainThread; | |
import android.support.annotation.WorkerThread; | |
/* Copyright (C) Farzad Tabashir <ftabashir@gmail.com> 15 February 2017, 8:38 AM | |
* All Rights Reserved | |
*/ | |
public abstract class SafeAsyncTask<Params, Progress, Result> { |
NewerOlder