Skip to content

Instantly share code, notes, and snippets.

khatv911

  • Singapore
Block or report user

Report or block khatv911

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View p.md

Kotlin for Javascript DEVs... or vice versa

what in common:

  • Modern Syntax
  • OOP + FP
  • Multiplatform

Variables & Constants

View strategy_controller.kt
// blueprint
open class EpoxyModel {
fun bind() {}
}
class Factory(
val key: Int,
val createModel: (Any) -> EpoxyModel
)
View coinchange.js
fun coinChange(n, coins)
dp=[]// n+1 items
dp[0]=0
for i from 1 to n
minCoins = maxint
for(coin in coins)
if(i >= coin)
min = Math.min(min, dp[i -coin]+1)
dp[i] = min
@khatv911
khatv911 / max_substring.js
Last active Feb 17, 2019
find max substring
View max_substring.js
// find max substring
// using dynamic programming
// Time: O(n)
var maxSubString = s => {
if (s.length <=1) return s
let dp = [] // max-len of the substring at index i
var idx=0// mark start index of max substring
dp[0] =1
for(var i=1; i < s.length; i++){
@khatv911
khatv911 / Home.js
Created May 11, 2017
Hidden SearchBar on scroll
View Home.js
import React, { Component } from 'react';
import { SectionList, StyleSheet, Text, View, ScrollView, Animated } from 'react-native';
import { SearchBar } from 'react-native-elements';
import { Navigation } from 'react-native-navigation';
import LCE from '../../../../global/LCE';
import RoomRowActionButtonList from './RoomRowActionButtonList';
import RoomCell from './RoomCell';
import { CHECK_OUT_TYPE, CHECK_IN_TYPE, STAY_OVER, CHECKED_OUT_TYPE, PROFILE_ACTION, EDIT_ACTION, DATES_ACTION, CASHIER_ACTION } from '../../../../global/constants';
import SectionHeader from './SectionHeader';
const {SeparatorComponent} = require('../../../../global/components/sectionComponent.js');
View SectionHeader.js
import React, {Component} from 'react';
import {View, StyleSheet} from 'react-native';
import {Icon, Text} from 'react-native-elements';
const SectionHeader = (section, index, isActive) => <View style={styles.container}>
<Text h4>{section.title}</Text>
<View style={styles.right}>
<Text style={{
marginRight: 5,
fontSize: 18
You can’t perform that action at this time.