git branch --merged | grep -v "\*" | grep -v master | xargs -n 1 git branch -D
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
export default function App() { | |
const [localData, setLocalData] = useState<Data>({ | |
text: 'This is a basic example with text' | |
}); | |
return ( | |
<View style={styles.container}> | |
<Text>Open up App.tsx to start working on your app!</Text> | |
{localData.text && ( | |
<Text>{localData.text}</Text> |
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
interface Data { | |
text?: string; | |
} |
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, { useState } from 'react'; | |
import { StatusBar } from 'expo-status-bar'; | |
import { StyleSheet, Text, View } from 'react-native'; |
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<title>Document</title> | |
</head> | |
<body> | |
<canvas id="game" width="512" height="512"></canvas> |
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 canvas = document.getElementById('game'); | |
const context = canvas.getContext('2d'); | |
const polygons = []; | |
const polygonsColors = [ 'red', 'blue', 'green', 'pink', 'purple', 'cyan' ]; | |
polygons.push(createPolygon([ | |
{ x: 50, y: 50 }, | |
{ x: 100, y: 50 }, | |
{ x: 100, y: 150 }, | |
{ x: 50, y: 150 }, |
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
polygon.testWith = function (otherPolygon) { | |
// get all edges | |
const edges = []; | |
for (let i = 0; i < polygon.edges.length; i++) { | |
edges.push(polygon.edges[i]); | |
} | |
for (let i = 0; i < otherPolygon.edges.length; i++) { | |
edges.push(otherPolygon.edges[i]); | |
} | |
// build all axis and project |
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
polygon.projectInAxis = function(x, y) { | |
let min = 10000000000; | |
let max = -10000000000; | |
for (let i = 0; i < polygon.vertices.length; i++) { | |
let px = polygon.vertices[i].x; | |
let py = polygon.vertices[i].y; | |
var projection = (px * x + py * y) / (Math.sqrt(x * x + y * y)); | |
if (projection > max) { | |
max = projection; | |
} |
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
polygon.render = function(context, color) { | |
context.strokeStyle = color; | |
context.beginPath(); | |
context.moveTo( | |
polygon.vertices[0].x, | |
polygon.vertices[0].y | |
); | |
for (let i = 1; i < polygon.vertices.length; i++) { | |
context.lineTo( | |
polygon.vertices[i].x, |
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
polygon.offset = function(dx, dy) { | |
for (let i = 0; i < polygon.vertices.length; i++) { | |
polygon.vertices[i] = { | |
x: polygon.vertices[i].x + dx, | |
y: polygon.vertices[i].y + dy, | |
}; | |
} | |
}; |
NewerOlder