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
// Clock | |
class Clock extends React.Component { | |
state = { | |
date: new Date(), | |
} | |
componentDidMount() { | |
this.timerID = setInterval( | |
() => this.tick(), | |
1000 |
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
// rotate array | |
const rotateArray = function(array, number) { | |
let formerPart = array; | |
formerPart = formerPart.splice(0, number); | |
let latterPart = array; | |
return latterPart.concat(formerPart); | |
} | |
rotateArray([1, 2, 3, 4, 5], 4); // [5, 1, 2, 3, 4]; |
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
const Values = function() { | |
this.values = {}; | |
} | |
Values.prototype.get_value = function(variable) { | |
return this.values[variable]; | |
} | |
Values.prototype.set_value = function(variable, value) { | |
let newValue = 0; |
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
const findChildNode = function(array) { | |
const index = {}; | |
let target; | |
for (let i = 0; i < array.length; i++) { | |
const parentNode = array[i][0]; | |
const childNode = array[i][1]; | |
if (index[childNode]) { | |
index[childNode].push(parentNode); | |
} else { | |
index[childNode] = [parentNode]; |
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
function maxRangeSum(string) { | |
const splitString = string.split(" "); | |
splitString.shift(); | |
const gainsLossesArray = []; | |
for (let i = 0; i < splitString.length; i++) { | |
gainsLossesArray.push(parseInt(splitString[i])); | |
} | |
let currentMax = 0; | |
let maxGain = 0; |
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
const onesIndex = { | |
'0': '', | |
'1': 'One', | |
'2': 'Two', | |
'3': 'Three', | |
'4': 'Four', | |
'5': 'Five', | |
'6': 'Six', | |
'7': 'Seven', | |
'8': 'Eight', |
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
const rawAddress = '1234 Main boulevard Ste 65-b San Francisco CA 94105'; | |
function addressParser(address) { | |
const splitAddress = address.split(" "); | |
const result = { | |
'Address Line 1': '', | |
'Address Line 2': '', | |
'City': '', | |
'State': '', | |
'Zip Code': '', |
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 { | |
GET_PLACES, | |
GET_PLACES_SUCCESS, | |
GET_PLACES_FAILURE | |
} from '../../actions/getPlaces'; | |
const INITIAL_STATE = { | |
places: [], | |
errors: [], | |
} |
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
export const GET_PLACES = "DOUMI_NATIVE/GET_PLACES"; | |
export const GET_PLACES_SUCCESS = "DOUMI_NATIVE/GET_PLACES_SUCCESS"; | |
export const GET_PLACES_FAILURE = "DOUMI_NATIVE/GET_PLACES_FAILURE"; | |
export function getPlacesFailure(errors) { | |
return { | |
type: GET_PLACES_FAILURE, | |
errors, | |
} | |
} |
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 React from 'react'; | |
import { Text, View, Image, StyleSheet, Dimensions } from 'react-native'; | |
import { WebBrowser } from 'expo'; | |
import { bindActionCreators } from 'redux'; | |
import { connect } from 'react-redux'; | |
import Carousel from 'react-native-snap-carousel'; | |
import { Container, Content, CardItem, Button, Right } from 'native-base'; | |
import { getPlaces } from '../actions/getPlaces'; | |
const styles = StyleSheet.create({ |
NewerOlder