Skip to content

Instantly share code, notes, and snippets.

View happyharis's full-sized avatar
🎯
Focusing

Haris Samingan happyharis

🎯
Focusing
View GitHub Profile
@happyharis
happyharis / Part2.cs
Last active April 9, 2018 04:19
Player Motor and controller part 2
// PlayerMotor
private Vector3 rotation = Vector3.zero;
// Gets a rotational vector
public void Rotate(Vector3 _rotation){
rotation = _rotation;
}
void FixedUpdate (){
@happyharis
happyharis / Part1.cs
Last active April 9, 2018 04:14
Player Motor and Controller part 1
// PlayerController.cs
using UnityEngine;
[RequireComponent(typeof(PlayerMotor))]
public class PlayerController : MonoBehaviour {
[SerializeField] //will show up on the inspector, however, still having the protection as a private variable
private float speed = 5f;
@happyharis
happyharis / Part3.cs
Created April 9, 2018 05:00
Player motor and controller part 3
// Player Motor
private Vector3 cameraRotation = Vector3.zero;
public void RotateCamera(Vector3 _cameraRotation){
cameraRotation = _cameraRotation;
}
void PerformRotation () {
rb.MoveRotation (rb.rotation * Quaternion.Euler (rotation));
import 'package:flutter/material.dart';
import './pages/landing_page.dart';
void main() {
runApp(Tododo());
}
class Tododo extends StatelessWidget {
@override
Widget build(BuildContext context){
class EditTodoPage extends StatefulWidget{
final Map<String, String> todo;
final String todoID;
EditTodoPage({Key key, this.todo, this.todoID}) : super (key: key);
// Optional parameters, global key,
}
Future _showAlert(data) async{
return showDialog<Null>(
context: context,
barrierDismissible: true,
builder: (BuildContext context) {
return new AlertDialog(
title: new Text('Would you like to make changes?', style: new TextStyle(fontSize: 17.0)),
actions: <Widget>[
new FlatButton(
child: new Text('Edit'),
class EditTodoPageState extends State<EditTodoPage> {
String selectedTodoId;
DocumentReference documentReference = Firestore.instance.collection('todo_list').document();
@override
void initState(){
selectedTodoId = widget.todoID;
documentReference = Firestore.instance.collection('todo_list').document(selectedTodoId);
super.initState();
}
return new StreamBuilder<QuerySnapshot>(
stream: Firestore.instance.collection('todo_list').where('finished', isEqualTo: false).snapshots,
builder: (BuildContext context, AsyncSnapshot<QuerySnapshot> snapshot) {
if (!snapshot.hasData) return new Text('Loading...');
return new ListView(
children: snapshot.data.documents.map((DocumentSnapshot document) {
return new ListTile(
title: new Row(
children: <Widget>[
new Expanded(child: new Text(document['task'])),
import 'package:flutter/material.dart';
import 'package:flutter/gestures.dart';
void main() => runApp(new MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return new MaterialApp(
theme: new ThemeData(
import React from 'react';
import { StyleSheet, Text, View, Button, FlatList, TouchableOpacity } from 'react-native';
// import { FontAwesome } from '@expo/vector-icons';
import { Icon } from 'react-native-elements';
class FinalProject extends React.Component {
constructor(props) {
super(props);
this.state = {