Skip to content

Instantly share code, notes, and snippets.

View eyalcohen4's full-sized avatar

Eyal Cohen eyalcohen4

View GitHub Profile
public double calcPerimeter() {
double peri = 0;
if (head.getNext() == null) {
return peri;
} else if (head.getNext().getNext() == null) {
return head.getPoint().distance(head.getNext().getPoint());
}
PointNode iterable = head;
public static int numPaths (int[][] mat, int x1, int y1, int x2, int y2) {
return numPaths(mat, x1, y1, x2, y2, 0);
}
private static int numPaths(int[][] mat, int x1, int y1, int x2, int y2, int counter) {
int tmp;
if (x1 < 0 || x2 < 0 || y1 < 0 || y2 < 0) {
return 0;
} else if (x1 >= mat.length || x2 >= mat.length || y1 >= mat.length || y2 >= mat.length) {
@eyalcohen4
eyalcohen4 / React native aliases
Created December 6, 2017 11:45
Terminal aliases for react-native cli
# Paste it in your .zshrc / .bashrc
alias rnand="react-native run-android"
alias rnios="react-native run-ios"
alias rnloga="react-native log-android"
alias rnlogi="react-native log-ios"
alias rns="react-native start"
$ npm install -g create-react-native-app
import React from 'react';
import { StyleSheet, Text, View } from 'react-native';
import { Video } from 'react-native';
@eyalcohen4
eyalcohen4 / react-native-video-step-2.js
Last active December 16, 2017 12:20
Add dimensions
import React from 'react';
import { StyleSheet, Text, View, Dimensions } from 'react-native';
import { Video } from 'expo';
export default class App extends React.Component {
render() {
const { width } = Dimensions.get('window');
return (
<View style={styles.container}>
<Text style={{ textAlign: 'center' }}> React Native Video </Text>
<Video
source={{ uri: 'http://d23dyxeqlo5psv.cloudfront.net/big_buck_bunny.mp4' }}
shouldPlay
import { MaterialIcons, Octicons } from '@expo/vector-icons';
export default class App extends React.Component {
state = {
mute: false,
fullScreen: false,
shouldPlay: false,
}
render() {
render() {
const { width } = Dimensions.get('window');
return (
<View style={styles.container}>
<View>
<Text style={{ textAlign: 'center' }}> React Native Video </Text>
<Video
source={{ uri: 'http://d23dyxeqlo5psv.cloudfront.net/big_buck_bunny.mp4' }}
shouldPlay
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#fff',
alignItems: 'center',
justifyContent: 'center',
},
controlBar: {
position: 'absolute',
bottom: 0,