Skip to content

Instantly share code, notes, and snippets.

View harryhan24's full-sized avatar

harry han harryhan24

View GitHub Profile
@drewwiens
drewwiens / rxjs-operators.ts
Last active September 8, 2024 06:11
Handy custom RxJS operators for Angular etc
import { AbstractControl, FormArray, FormGroup } from '@angular/forms';
import { map, toPairs, fromPairs, differenceWith, isEqual, isNull, isUndefined } from 'lodash';
import { Observable, OperatorFunction, defer, empty, of, merge, pipe } from 'rxjs';
import { distinctUntilChanged, filter, map, shareReplay, pairwise } from 'rxjs/operators';
/**
* Convenience RxJS operator that filters out undefined & null and modifies the downstream type
* appropriately.
*/
export function exists<T>(): OperatorFunction<T | undefined | null, T> {
@rlarla245
rlarla245 / 1. 순서
Last active August 4, 2018 10:19
Firebase 11 - Remote Config
11. Firebase – Remote Config(Change Value)
● 원격으로 앱의 배경색, 프로레스 작동 및 종료가 가능합니다.
1. 문서로 이동합니다. 원격 구성 탭으로 이동합니다.
- compile 코드를 붙여넣습니다.
- 작동 원리 부분의 mFirebaseRemoteConfig 코드를 가져옵니다. HomeActivity로 이동하여 remoteConfig() 메소드를 생성해 바디 부분으로 붙여넣습니다. 에러는 스스로 잡습니다.
해당 코드는 디버깅 테스트를 할 때 에러를 잡아주는 기능입니다.
- 문서 내 하단의 디폴트 설정 값을 입력하는 코드도 복사해 해당 메소드 하단에 붙여넣습니다.
해당 코드는 서버에 해당되는 값이 없을 때 참조하는 기능입니다.
@matteocrippa
matteocrippa / flutter.md
Last active April 20, 2025 03:41
Flutter Cheatsheet

Flutter

A quick cheatsheet of useful snippet for Flutter

Widget

A widget is the basic type of controller in Flutter Material. There are two type of basic Widget we can extend our classes: StatefulWidget or StatelessWidget.

Stateful

StatefulWidget are all the widget that interally have a dynamic value that can change during usage. It can receive an input value in the constructor or reference to functions. You need to create two classes like:

@didil
didil / asyncConcat.js
Created July 16, 2018 11:14
asyncConcat lambda handler
const jsonResponse = require("../lib/jsonResponse");
const asyncConcatService = require("../lib/asyncConcatService");
module.exports.handler = async (event, context) => {
let { a, b } = event.queryStringParameters;
if (!a || !b) {
return jsonResponse.error({
message: "Please specify 2 strings a and b to concatenate"
});
@ArthurNagy
ArthurNagy / RoundedBottomSheetDialogFragment.kt
Last active March 10, 2025 08:53
Rounded modal bottom sheet as seen in new Google products(Tasks, News, etc.), described in this article: https://medium.com/halcyon-mobile/implementing-googles-refreshed-modal-bottom-sheet-4e76cb5de65b
package com.your.package
import android.app.Dialog
import android.os.Bundle
import com.your.package.R
import com.google.android.material.bottomsheet.BottomSheetDialog
import com.google.android.material.bottomsheet.BottomSheetDialogFragment
/**
* BottomSheetDialog fragment that uses a custom
@dabit3
dabit3 / index.js
Last active December 29, 2021 06:38
Lambda function to interact with Amazon Polly & Amazon Translate
var AWS = require('aws-sdk')
AWS.config.update({region: 'us-east-1'})
const uuidV4 = require('uuid/v4')
var translate = new AWS.Translate();
var polly = new AWS.Polly();
var s3 = new AWS.S3({
params: {
Bucket: 'YOURBUCKETNAME',
}
})
@lub0s
lub0s / ordinal.kt
Created April 17, 2018 16:22
ordinal of sealed class subclass
sealed class Event {
object One : Event()
object Two : Event()
data class Three(val int: Int) : Event()
}
inline fun <reified T : Any> T.ordinal() =
T::class.java.superclass.classes.indexOfFirst { sub -> sub == this@ordinal::class.java }
fun testOrdinal() {
@iChintanSoni
iChintanSoni / ApiService.kt
Last active January 23, 2020 00:34
Daggering kotlin-android: AppModule.kt
interface ApiService {
@GET("api")
fun getUsers(@Query("result") result: Int): Observable<RandomUserResponse>
}
@albertogiunta
albertogiunta / Extensions.kt
Created March 20, 2018 10:30
Extension functions (Kotlin) & build.gradle files for Android projects
/**
* ANY
*/
fun Any.toJson(): String = GsonInitializer.toJson(this)
/**
* VIEW
*/
fun View.toggleVisibility(setAsVisible: Boolean) = if (setAsVisible) this.visible() else this.gone()
@mjuric
mjuric / DockerUserNamespacesOnCentOS74.md
Last active September 6, 2023 18:31
Setting up Docker with user namespaces on CentOS 7.4

Setting up Docker with user namespaces on CentOS 7.4

The procedure below has been tested on a Digital Ocean VM with CentOS 7.4

# Install docker from RHEL’s standard repos
yum install -y docker

#
# We’ll activate the ‘user namespaces’ feature that defends against