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 arr = [1,2,3,2]; | |
const swap = (i, j) => { | |
const temp = arr[i]; | |
arr[i] = arr[j]; | |
arr[j] = temp; | |
} | |
const print = () => { | |
console.log(arr); |
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, { Component } from "react"; | |
import { Dimensions, View, Easing, StyleSheet, Animated, ART, PanResponder } from "react-native"; | |
const { Path, Surface, Shape } = ART; | |
const { width : WIDTH } = Dimensions.get("window"); | |
const RADIUS = 10; | |
const HEIGHT_OF_TABBAR = 64; | |
const arc = height => { | |
const w = WIDTH - 2 * RADIUS; | |
const h = height - 2 * RADIUS; | |
const r = (w ** 2 + 4 * h ** 2) / (8 * h); |
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 { StyleSheet, View } from 'react-native'; | |
import { ART } from "react-native"; | |
const { Surface, Shape, Path } = ART; | |
const POINTS_SPACING = 40; | |
const path = (values, height) => { | |
const d = new Path(); | |
for (var i = 0; i < values.length; i++) { |
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 { StyleSheet, Text, View, Image } from 'react-native'; | |
export default class App extends React.Component { | |
render() { | |
return ( | |
<View style={styles.container}> | |
<View style={{height:100}}/> | |
<View style={styles.trackingContainer}> | |
<TrackingItem stageName="Payment" left={false}/> |
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 { ART, TouchableOpacity, Text } from 'react-native'; | |
/** | |
* | |
* Example usage below | |
* | |
export default class CheckboxDemo extends React.Component { | |
state = { | |
checked : true |
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
<style> | |
#container { | |
height: 500px; | |
} | |
#container div:nth-child(1) { | |
background-color: red; | |
} | |
#container div:nth-child(2) { | |
background-color: blue; | |
} |
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 goLeft = function(containerId) { | |
const container = document.getElementById(containerId); | |
const scrollLeft = container.scrollLeft; | |
const containerWidth = container.getBoundingClientRect().width | |
const childWidths = Array.prototype.map.call(container.children, (child => child.getBoundingClientRect().width)) | |
const accumulatedWidths = childWidths.map((width, index, arr) => arr.slice(0, index + 1).reduce((x, y) => x+y, 0)); | |
const childrenPastLeftEdge = accumulatedWidths.filter(width => width >= scrollLeft); | |
const newScrollLeft = Math.max(0, childrenPastLeftEdge.shift() - containerWidth); | |
scrollHorizontallyBy(container, newScrollLeft - container.scrollLeft, 300); |
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 tests = [ | |
[[4, 4, 2, 4],[8, 2, 4, 0]], | |
[[4, 0, 0, 4],[8, 0, 0, 0]], | |
[[2, 4, 4, 0],[2, 8, 0, 0]], | |
[[4, 4, 4, 4],[8, 8, 0, 0]], | |
[[4, 4, 4, 0],[8, 4, 0, 0]], | |
[[4, 4, 0, 4],[8, 4, 0, 0]], | |
[[2, 4, 0, 4],[2, 8, 0, 0]], | |
[[2, 4, 8, 4],[2, 4, 8, 4]], | |
[[2, 4, 8, 16],[2, 4, 8, 16]], |
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
<head> | |
<script src="https://unpkg.com/[email protected]/umd/react.production.min.js" crossorigin></script> | |
<script src="https://unpkg.com/[email protected]/umd/react-dom.production.min.js" crossorigin></script> | |
<script src="https://unpkg.com/[email protected]/babel.min.js" crossorigin></script> | |
<style> | |
span.gone { | |
color : transparent; | |
transition: color 0.3s; | |
-webkit-transition: color 0.3s; | |
} |
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, { Component } from "react"; | |
import { Text, View } from "react-native"; | |
class HelloWorldComponent extends Component { | |
render() { | |
return <View style={{ | |
flexDirection:"row", | |
backgroundColor : 'green', | |
justifyContent: 'space-around' | |
}}> |