Skip to content

Instantly share code, notes, and snippets.

🎯
Focusing

Josh Beckwith positlabs

🎯
Focusing
Block or report user

Report or block positlabs

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@positlabs
positlabs / screen-plane.js
Created Jun 20, 2019
Spark AR script to resize plane to match screen size
View screen-plane.js
/*
Resize plane to match screen size
*/
const Scene = require('Scene')
const camera = Scene.root.find('Camera')
const plane = Scene.root.find('plane0')
plane.width = camera.focalPlane.width
plane.height = camera.focalPlane.height
View renderer-client.js
/*
The client lib for the generator will override some browser methods in order to
generate video or gifs of the page that it runs on. This guarantees that frames
won't be dropped, and the framerate will be consistent.
Global method overrides
- setTimeout
- setInterval
- requestAnimationFrame
Set currentTime of videos
*/
@positlabs
positlabs / backup-github.sh
Last active Jan 7, 2019 — forked from rodw/backup-github.sh
A simple script to backup an organization's GitHub repositories, wikis and issues.
View backup-github.sh
#!/bin/bash
# A simple script to backup an organization's GitHub repositories.
# NOTE: if you have more than 100 repositories, you'll need to step thru the list of repos
# returned by GitHub one page at a time, as described at https://gist.github.com/darktim/5582423
GHBU_BACKUP_DIR=${GHBU_BACKUP_DIR-"github-backups"} # where to place the backup files
GHBU_ORG=${GHBU_ORG-"<REPLACE_ME>"} # the GitHub organization whose repos will be backed up
# (if you're backing up a user's repos instead, this should be your GitHub username)
GHBU_UNAME=${GHBU_UNAME-"<REPLACE_ME>"} # the username of a GitHub account (to use with the GitHub API)
@positlabs
positlabs / ShadowShader.shader
Created Jan 20, 2018
Unity shader for rendering shadows onto a transparent surface. Useful for augmented reality.
View ShadowShader.shader
Shader "ShadowShader" {
Properties{
_Color("Main Color", Color) = (1,1,1,1)
_MainTex("Base (RGB)", 2D) = "white" {}
_Cutoff("Cutout", Range(0,1)) = 1.0
}
SubShader{
Pass{
Alphatest Greater[_Cutoff] SetTexture[_MainTex]
@positlabs
positlabs / LazyPromise.js
Last active May 19, 2017
LazyPromise is a cachey promise creator that returns a function. It's good for lazily running things only once.
View LazyPromise.js
/*
LazyPromise is a cachey promise creator that returns a function.
It's good for lazily running things only once.
Promise creation is deferred until the first call.
Construct using same signature as a regular Promise (except it doesn't require `new`).
View inject-scss.js
var fs = require('fs')
fs.writeFileSync(path.join(__dirname, 'public/styles/_inject.scss'), `$CDN: "${CDN}";`, 'utf8')
@positlabs
positlabs / component-template.js
Created Oct 21, 2016
Boilerplate for xtag components
View component-template.js
// http://x-tags.org/docs
const ComponentBase = require('./component-base')
xtag.register('x-boilerplate', {
prototype: ComponentBase.prototype,
lifecycle: {
@positlabs
positlabs / component-base.js
Created Oct 21, 2016
Component base with some convenience methods
View component-base.js
/*
http://x-tags.org/docs
usage:
const ComponentBase = require('./component-base')
xtag.register('x-foo', {
prototype: ComponentBase.prototype,
@positlabs
positlabs / TextSplit.js
Last active Aug 10, 2018
Super simple replacement for GSAP's SplitText. Not as robust, but it's editable.
View TextSplit.js
/**
* splitText - function to split words into html elements based on words and characters
* @param html text to split
* @param options optional parameters
* @example splitText('some text', {
* wordClass: 'word',
* charClass: 'char',
* chars: true,
* })
@positlabs
positlabs / CuePoints.js
Last active Dec 22, 2015
Respond to cuepoints during video playback
View CuePoints.js
/*
// mapping cues to methods
var cuepointMethods = {
"1": function(){},
"2.82": function(){},
"3.31": function(){}
};
// instantiate with <video>, and an array of cuepoint times => [1, 2.82, 3.31]
You can’t perform that action at this time.