Skip to content

Instantly share code, notes, and snippets.

View robertlong's full-sized avatar

Robert Long robertlong

View GitHub Profile
import { Component, System, MeshEntity, ImageEntity, InteractableComponent } from "hubs";
import { Vector3, MeshBasicMaterial, BoxBufferGeometry } from "three";
class RotateComponent extends Component {
static schema = {
axis: { type: Vector3, default: new Vector3(0, 1, 0) },
speed: { type: Number, default: 0.5 }
};
}
@robertlong
robertlong / SlideDeck.gltf
Last active September 5, 2019 01:29
Hubs Pager Scripting
{
"scene": 0,
"scenes": [
{
"name": "My Presentation",
"nodes": [0, 1, 2],
"extensions": {
"MOZ_hubs_components": {
"pager": {}
}
const ctx = new AudioContext();
function createMediaStream() {
const mediaStream = new MediaStream();
const source = ctx.createMediaStreamSource(mediaStream);
source.connect(ctx.destination);
setTimeout(() => {
@robertlong
robertlong / json2ts.js
Created March 20, 2017 19:43
JSON Schema to Typescript with External References
#!/usr/bin/env node
const path = require('path');
const fs = require('fs');
const RefParser = require('json-schema-ref-parser');
const Generator = require('json-schema-to-typescript');
const schemaPath = process.argv[2];
const outputPath = process.argv[3];
@robertlong
robertlong / gist:4236932
Created December 7, 2012 22:12
Timezone Abbreviation
//Find the client's local timezone abbreviation.
//Works in most Timezones/Browsers, falls back to GMT offset if unavailable.
function getTimezoneAbbr (){
var m = new Date().toString().match(/\(([^)]+)\)$/);
if (m) return m[1];
return ((d = (new Date().getTimezoneOffset() / 60) * -1) > 0) ? "GMT +" + d : "GMT " + d
}