This file contains hidden or 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 {Button, Card, Form, Grid, Icon, Input, Message, Popup} from 'semantic-ui-react'; | |
| import CreditCardFormConstants from '../CreditCardFormConstants'; | |
| import ErrorMessage from './ErrorMessage'; | |
| import React, { Component } from 'react'; | |
| const {BUTTON_SUBMIT, CARD, DESCRIPTION, LABELS, PLACEHOLDERS} = CreditCardFormConstants; | |
| const date = new Date(); | |
| const currentMonth = date.getMonth().toString(); | |
| const currentYear = date.getFullYear().toString(); |
This file contains hidden or 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 MinStack = function() { | |
| this.items = []; | |
| this.minValueTracker = []; | |
| }; | |
| MinStack.prototype.push = function(x) { | |
| const minValueTrackerLength = this.minValueTracker.length - 1; | |
| const latestMinValue = this.minValueTracker[minValueTrackerLength]; | |
| this.items.push(x); | |
| if (!this.minValueTracker.length) { |
This file contains hidden or 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
| var MinStack = function() { | |
| this.items = []; | |
| this.auxItems = []; | |
| }; | |
| MinStack.prototype.push = function(x) { | |
| const firstAuxItem = this.auxItems[this.auxItems.length - 1]; | |
| this.items.push(x); | |
| if (!this.auxItems.length) { | |
| this.auxItems.push(x); |
This file contains hidden or 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
| var missingNumber = function(nums) { | |
| let sum = 0; | |
| let expectedSum = nums.length; | |
| for (var i = 0; i < nums.length; i++) { | |
| sum += nums[i]; | |
| expectedSum += i; | |
| } | |
| return expectedSum - sum; | |
| }; |
This file contains hidden or 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
| /** | |
| * @param {number[]} nums | |
| * @return {void} Do not return anything, modify nums in-place instead. | |
| */ | |
| var moveZeroes = function(nums) { | |
| for (var i = nums.length; i >= 0; i--) { | |
| if (nums[i] == 0) { | |
| nums.splice(i, 1); | |
| nums.push(0); |
This file contains hidden or 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 homeList = [ | |
| { | |
| id: '1', | |
| name: 'a', | |
| address: 'aaaaa', | |
| photo: 'A', | |
| description: 'AAA', | |
| }, | |
| { | |
| id: '2', |
This file contains hidden or 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
| class Clock extends React.Component { | |
| constructor(props) { | |
| super(props); | |
| this.state = { | |
| date: new Date(), | |
| } | |
| } | |
| comoponentDidMount() { | |
| this.timerID = setInterval( |
This file contains hidden or 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
| class TodoList extends React.Component { | |
| constructor(props) { | |
| super(props); | |
| this.state = { | |
| todoItems: [ | |
| 'workout', | |
| ], | |
| } | |
| this.handleSubmit= this.handleSubmit.bind(this); | |
| } |
This file contains hidden or 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
| class Clicker extends React.Component { | |
| constructor(props) { | |
| super(props); | |
| this.state = { | |
| counter: 0, | |
| } | |
| this.onMinusClick = this.onMinusClick.bind(this); | |
| this.onResetClick = this.onResetClick.bind(this); | |
| this.onPlusClick = this.onPlusClick.bind(this); | |
| this.onMinusTenClick = this.onMinusTenClick.bind(this); |
This file contains hidden or 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
| /** | |
| * @param {number} n | |
| * @return {string} | |
| **/ | |
| var countAndSay = function(number) { | |
| var string = '1'; | |
| for (var i = 1; i < number; i++) { | |
| var stringToArray = string.split(''); | |
| var counter = 1; |