This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function bench(cb, arg, label) { | |
console.time(label) | |
cb(arg) | |
console.timeEnd(label) | |
} | |
function createArray(length) { | |
return Array.from({ length }, (_, i) => i) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// What: Render a Vue component in React | |
// How: Returns a wrapped Vue component which can be rendered as a React component | |
// When to use this? Almost certainly, never | |
// Example usage: https://codesandbox.io/s/usevuecomponentexample-tmmln | |
import Vue from 'vue' | |
import React, { useRef, useEffect, useCallback } from 'react' | |
const getWrappedVueComponent = component => props => { | |
const container = useRef() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Vue from 'vue' | |
import React, { useRef, useEffect, useCallback } from 'react' | |
const getWrappedVueComponent = component => props => { | |
const container = useRef() | |
const instance = useRef() | |
useEffect(() => { | |
instance.current = new Vue({ ...component, el: container.current }) | |
}, []) | |
useEffect(() => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(async()=>{ | |
let blob = await new Promise(resolve=>document.querySelector('canvas').toBlob(resolve)) | |
let url = URL.createObjectURL(blob) | |
window.open(url) | |
let a = document.createElement('a') | |
a.href = url | |
a.download = '' | |
a.click() | |
})() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { Component } from 'react' | |
import { Platform, StyleSheet, Text, View } from 'react-native' | |
import { ARKit } from 'react-native-arkit' | |
export default class App extends Component<Props> { | |
render() { | |
return ( | |
<View style={{ flex: 1 }}> | |
<ARKit | |
style={{ flex: 1 }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// @flow | |
import { ARKit } from 'react-native-arkit' | |
import { branch, compose, lifecycle, renderComponent } from 'recompose' | |
import { unzip } from 'react-native-zip-archive' | |
import RNFetchBlob from 'react-native-fetch-blob' | |
import React from 'react' | |
const getModelPath = modelId => ( | |
`${RNFetchBlob.fs.dirs.CacheDir}/models/${modelId}/` | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { exec } = require('child_process') | |
const { promisify } = require('util') | |
const { furniture, storage, utils } = require('3dio') | |
const { save, forEachFileInDirectory } from './file' | |
const run = promisify(exec) | |
async function getColladaFiles({ query, directory }) { | |
const redChairs = await furniture.search(query) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// @flow | |
import { ARKit } from 'react-native-arkit' | |
import { Text, View } from 'react-native' | |
import { compose, lifecycle, onlyUpdateForKeys } from 'recompose' | |
import { unzip } from 'react-native-zip-archive' | |
import RNFetchBlob from 'react-native-fetch-blob' | |
import React from 'react' | |
import type { Point3D } from '../../../types' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function(e){ | |
var n | |
var a = [] | |
var walk = document.createTreeWalker(e, NodeFilter.SHOW_TEXT, null, false) | |
while (n = walk.nextNode()){ | |
a.push(n) | |
return a | |
} | |
})(document.body).forEach(x => { |