Skip to content

Instantly share code, notes, and snippets.

View msert29's full-sized avatar

Murat Sert msert29

  • Consultant
  • Bristol, UK
View GitHub Profile
const styles = StyleSheet.create({
container: {
flex: 1,
display: "flex",
flexDirection: "column",
justifyContent: "center",
alignItems: "center",
maxHeight: 400
},
inputStyle : {
@msert29
msert29 / validator.js
Last active September 3, 2019 09:22
A simple validation method to validate given user inputs for address
export default class Delivery extends Component {
state = {
streetName: undefined,
postcode: undefined,
city: undefined
};
constructor(props) {
super(props);
@msert29
msert29 / address.js
Last active July 4, 2018 10:36
address.js
<TextInput
placeholder="Address"
maxLength={50}
onChangeText={streetName => this.setState({ streetName })}
/>
<TextInput
placeholder="City"
maxLength={58}
addItem(product){
// Get current list of products
let products = this.state.products
let idx = this.state.products.indexOf(product)
// Update the total price by quantity * price of the added product
let totalPrice = this.state.totalPrice + (product.price * product.quantity)
if (this.state.products.indexOf(product) !== -1) {
products[idx].quantity += 1;
} else {
addItem(product){
// Get current list of products
let products = this.state.products
let idx = this.state.products.indexOf(product)
// Update the total price by quantity * price of the added product
let totalPrice = this.state.totalPrice + (product.price * product.quantity)
if (this.state.products.indexOf(product) !== -1) {
products[idx].quantity += 1;
} else {
@msert29
msert29 / sequence_check.py
Created September 14, 2016 10:40
hotjar challange
l = [0,1,2,4] # can change the list
def check_seq(liste):
liste = iter(liste)
if (1 in liste): #Check if first sequence item is in list and start iterating when we have a match
if liste.__next__() == 2: # check next item
if liste.__next__() == 4: # check next item
return True # sequence found
else:
return False