Skip to content

Instantly share code, notes, and snippets.

View tomaspietravallo's full-sized avatar

Tomás Pietravallo tomaspietravallo

View GitHub Profile
@tomaspietravallo
tomaspietravallo / repo-reset.md
Created September 6, 2020 17:11 — forked from heiswayi/repo-reset.md
GitHub - Delete commits history with git commands

First Method

Deleting the .git folder may cause problems in our git repository. If we want to delete all of our commits history, but keep the code in its current state, try this:

# Check out to a temporary branch:
git checkout --orphan TEMP_BRANCH

# Add all the files:
git add -A
const TG = require("TouchGestures");
const Scene = require("Scene");
const R = require("Reactive");
const DMw = require("DeviceMotion").worldTransform;
const CameraInfo = require("CameraInfo");
const Time = require("Time");
/*
Your scene should have a planeTracker and a nullObject as it's child
Everything under the nullObject (called nullPositioner in this case) will be affected and be modified with the plane tracker values
/**
* @param {} x
* @param {*} y
* @param {*} defaultValue
* @returns {Point2DSignal}
*/
function checkAndPack2(x, y, defaultValue){
let values = [x, y];
values.map(x => x || R.val(defaultValue));
return R.pack2(values[0], values[1]);
const LightingEstimation = require("LightingEstimation"); // import the LightingEstimation module
const Patches = require("Patches"); // import the Patches module
// Patches.inputs.setScalar("brightness", theSecondArgument) sends the second argument (the one after the comma) to a 'from script' (number) variable called brightness
// (On patches select the script and create that variable (there's a menu on the right), then drag the script to the patch editor)
// LightingEstimation.frameBrightness gets a 0-1 value representing the frame brightness
Patches.inputs.setScalar('brightness', LightingEstimation.frameBrightness);
@tomaspietravallo
tomaspietravallo / touch-gestures.js
Last active August 8, 2020 17:08
onPan & onLongPress seem to be broken (? or my code is ¯\_(ツ)_/¯
let x, y;
TouchGestures.onLongPress().subscribe((event)=>{
event.location.x.monitor({fireOnInitialValue: true}).subscribe((v)=>{
x = v.newValue;
});
event.location.y.monitor({fireOnInitialValue: true}).subscribe((v)=>{
y = v.newValue;
Diagnostics.log(`Gesture: onLongPress \t| X: ${x}, Y: ${y}`);
});
});
const Scene = require('Scene');
const FaceTracking = require('FaceTracking');
const Diagnostics = require('Diagnostics');
const Reactive = require('Reactive');
Promise.all([
Scene.root.findByPath('**/meshes0/*'),
]).then((result)=>{
let meshes = result[0];