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 React from 'react'; | |
import ListItem from './ListItem'; | |
import './App.css'; |
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 ListItem: React.FC<{ | |
text: string | |
handleOnChange: ChangeEventHandler | |
selected: boolean | |
}> = ({ text, handleOnChange, selected }) => { | |
return ( | |
<Container> | |
<CheckBox | |
type="checkbox" | |
checked={selected} |
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 CheckBox = styled.input` | |
margin: 6px 10px 5.8px 3px; | |
border-radius: 2px; | |
border: solid 1px #c6c4d2; | |
width: 5%; | |
float: left; | |
background: ${(porps) => (porps.checked ? '#482474' : '#fbfcff')}; | |
` | |
const Container = styled.div` | |
margin-bottom: 0px !important; |
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
def train_MLP(): | |
le = preprocessing.LabelEncoder() | |
le.fit(dataset['Cause']) | |
dataset['Cause'] = le.transform(dataset['Cause']) | |
le.fit(dataset['Severity']) | |
dataset['Severity'] = le.transform(dataset['Severity']) | |
print(le.classes_) | |
X = dataset[['Cause', 'Weekday', 'Year', 'Month', 'Point of accident']] |
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
def train_random_forest(): | |
le = preprocessing.LabelEncoder() | |
le.fit(dataset['Cause']) | |
dataset['Cause'] = le.transform(dataset['Cause']) | |
le.fit(dataset['Severity']) | |
dataset['Severity'] = le.transform(dataset['Severity']) | |
print(le.classes_) | |
X = dataset[['Cause', 'Weekday', 'Year', 'Month', 'Point of accident']] |
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 Car { | |
var wheel: Int = 0 | |
init(wheels: Int) { | |
self.wheel = wheels | |
} | |
} | |
let myCar = Car(wheels: 4) | |
print(CFGetAllocator(myCar)) |
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 Car { | |
var wheels: Int = 0 | |
init(wheels: Int) { | |
self.wheels = wheels | |
} | |
} | |
let myCar = Car(wheels: 4) | |
print(CFGetRetainCount(myCar)) |
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 body: some View { | |
VStack { | |
Text(self.isAnimating ? "Spining\n..." : sectorFromAngle(angle : newAngle)) | |
.multilineTextAlignment(.center) | |
Image("Arrow") | |
.resizable() | |
.scaledToFit() | |
.frame(width: 25, height: 25, alignment: .center) | |
Image("roulette") | |
.resizable() |
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
func getAngle(angle: Double) -> Double { | |
let deg = 360 - angle.truncatingRemainder(dividingBy: 360) | |
return deg | |
} |
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
func sectorFromAngle(angle: Double) -> String { | |
var i = 0 | |
var sector: Sector = Sector(number: -1, color: .empty) | |
while sector == Sector(number: -1, color: .empty) && i < sectors.count { | |
let start: Double = halfSector * Double((i*2 + 1)) - halfSector | |
let end: Double = halfSector * Double((i*2 + 3)) | |
if(angle >= start && angle < end) { | |
sector = sectors[i] |