Skip to content

Instantly share code, notes, and snippets.

View basekays's full-sized avatar

Hyejin Kay Albito basekays

View GitHub Profile
// Clock
class Clock extends React.Component {
state = {
date: new Date(),
}
componentDidMount() {
this.timerID = setInterval(
() => this.tick(),
1000
// 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];
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;
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];
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;
const onesIndex = {
'0': '',
'1': 'One',
'2': 'Two',
'3': 'Three',
'4': 'Four',
'5': 'Five',
'6': 'Six',
'7': 'Seven',
'8': 'Eight',
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': '',
import {
GET_PLACES,
GET_PLACES_SUCCESS,
GET_PLACES_FAILURE
} from '../../actions/getPlaces';
const INITIAL_STATE = {
places: [],
errors: [],
}
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,
}
}
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({