Skip to content

Instantly share code, notes, and snippets.

import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { SubhubsComponent } from './subhubs.component';
import { ApolloTestingController, ApolloTestingModule } from 'apollo-angular/testing';
import { SharedModule } from '../shared/app.shared.module';
import { SubhubsRoutingModule } from './subhubs-routing.module';
import { RouterModule } from '@angular/router';
// import { Observable } from 'apollo-link';
import { By } from '@angular/platform-browser';
@warrickct
warrickct / Networking.cs
Created January 6, 2019 21:33
Code Used for UDP Broadcasted Multiplayer used in River Gear VR
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Net;
using System.Net.Sockets;
using System.Runtime.Serialization.Formatters.Binary;
using System.Text;
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System.Linq;
public class SplineMaker2 : MonoBehaviour
{
//Use the transforms of GameObjects in 3d space as your points or define array with desired points
public List<Transform> controlPoints = new List<Transform>();
@warrickct
warrickct / MeshRecreate.cs
Created April 26, 2018 04:03
Testing MeshData extraction and Mesh Procedural Generation locally.
public class ThreadNet : MonoBehaviour {
void Start() {
//Testing is mesh is recreatable in unity:
// FOR MAKING SUBMODEL LOCALLY
GameObject localGenModel = new GameObject();
Mesh localGenMesh = new Mesh
{
//tangents = tangents,
vertices = vertices,
@warrickct
warrickct / Chart.js
Created April 16, 2018 22:35
Draw d3 bar chart in React using react-faux-dom
import React, { Component } from 'react';
import * as d3 from 'd3';
import ReactFauxDOM from 'react-faux-dom';
class Chart extends React.Component {
constructor(props){
super();
this.state = {
@warrickct
warrickct / TimeAdder.py
Last active March 14, 2018 23:57
Simple script to add time in hours:mins format iteratively to get total hours.
totalHours = 0
totalMins = 0
while 1==1:
addTime = input("enter time: ")
addTime = addTime.split(':')
addHours = int(addTime[0])
addMinutes = int(addTime[1])
totalMins += addMinutes
function round(x, dp) {
var factor = Math.pow(10, dp);
var tmp = x * factor;
tmp = Math.round(tmp);
return tmp / factor;
}
function checkFragment(f, species, site) {
var ampIndex = f.indexOf("&");
var ltIndex = f.indexOf("<");
@warrickct
warrickct / ModelSerializer
Last active January 25, 2018 01:35
Using a gameobject, creates a network transmittable ModelWireData object containing vertices, uvs, triangles and transform data.
using System;
using System.Collections.Generic;
using UnityEngine;
[Serializable]
public class ModelWireData
{
float xPos, yPos, zPos, xRot, yRot, zRot, xSca, ySca, zSca;
List<Vertex> verticesWiredata = new List<Vertex>();
@warrickct
warrickct / ViveControllerBeam
Created January 17, 2018 23:07
Projects a laser from a Vive controller straight forward.
Quaternion or = controller.transform.rot;
Vector3 start = transform.TransformPoint(controller.transform.pos);
Vector3 end = start + ((or * Vector3.forward) * 5000.0f);
laser.enabled = true;
laser.SetPosition(0, start);
laser.SetPosition(1, end);