Skip to content

Instantly share code, notes, and snippets.

import Foundation
// Complete the countApplesAndOranges function below.
func countApplesAndOranges(s: Int, t: Int, a: Int, b: Int, apples: [Int], oranges: [Int]) -> Void {
var countApple: Int = 0
var countOranges: Int = 0
for apple in apples {
if (a + apple) >= s && (a + apple) <= t {
// Find nth Fibonacci number
func fibonaci(_ n: Int) -> Int {
if (n == 1 || n == 2) { return 1 }
return (fibonaci(n-1) + fibonaci(n-2))
}
@lhvan89
lhvan89 / UIImagePickerController.swift
Last active March 27, 2020 04:41
how to pick image with UIImagePickerController in iOS swift
//
// ViewController.swift
// ImagePicker_Pickup_Photo_and_Image
//
// Created by Van Le on 3/27/20.
// Copyright © 2020 Van Le. All rights reserved.
//
import UIKit
@lhvan89
lhvan89 / download_anonymous_icons_from_drive.rb
Created April 2, 2019 08:05 — forked from rockwotj/download_anonymous_icons_from_drive.rb
Downloads all of the icons of anonymous animals from Google Drive
#!/usr/bin/env ruby
icon_list = "alligator, anteater, armadillo, auroch, axolotl, badger, bat, beaver, buffalo, camel, chameleon, cheetah, chipmunk, chinchilla, chupacabra, cormorant, coyote, crow, dingo, dinosaur, dolphin, duck, elephant, ferret, fox, frog, giraffe, gopher, grizzly, hedgehog, hippo, hyena, jackal, ibex, ifrit, iguana, koala, kraken, lemur, leopard, liger, llama, manatee, mink, monkey, narwhal, nyan cat, orangutan, otter, panda, penguin, platypus, python, pumpkin, quagga, rabbit, raccoon, rhino, sheep, shrew, skunk, slow loris, squirrel, turtle, walrus, wolf, wolverine, wombat"
for icon in icon_list.split ', ' do
element = icon.sub ' ', ''
`curl https://ssl.gstatic.com/docs/common/profile/#{element}_lg.png -o icons/#{element}.png`
end
import React, { Component } from 'react';
import { View, Text, TouchableOpacity, Image } from 'react-native';
import FastImage from 'react-native-fast-image';
import { withNavigation } from 'react-navigation';
// import Moment from "moment";
class BookingItem extends Component {
constructor(props) {
super(props);
this.state = {
import React, { Component } from 'react'
import { StyleSheet, Text, View, Dimensions, FlatList } from 'react-native'
import { TabView, SceneMap } from 'react-native-tab-view';
import BookingItem from './BookingItem';
export default class BookingList extends Component {
constructor(props) {
super(props);
import React, { Component } from 'react'
import { Text, View, ScrollView } from 'react-native'
import BookingList from './BookingList';
export default class TabViewDemoScreen extends Component {
constructor(props) {
super(props)
import React from 'react';
import { StyleSheet, Text, View, Image } from 'react-native';
export default class App extends React.Component {
render() {
return (
<View style={styles.container}>
<View style={{ backgroundColor: 'white', marginTop: 50, flexDirection: 'row' }}>
<Image
style={{ width: 69, height: 69, borderRadius: 69 / 2 }}
@lhvan89
lhvan89 / redux-first-demo.js
Last active December 28, 2018 02:55
Redux First Demo
const { createStore } = require('redux');
const defaultState = { value: 0 };
const reducer = (state = defaultState, action) => {
if (action.type === 'UP') {
return { value: state.value + 1 };
}
if (action.type === 'DOWN') {
return { value: state.value - 1 };