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 {Plugin} from 'vite'; | |
import fs from 'fs'; | |
const index = fs.readFileSync(__dirname + '/index.html', 'utf-8'); | |
const fileUrls: Plugin = { | |
name: 'pass-through-file-urls', | |
configureServer: server => { | |
server.middlewares.use(async (req, res, next) => { | |
if (req.url?.match(/.*\/files\/.*$/)) { |
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 { useState, useEffect, useRef } from 'react'; | |
type State<T> = { | |
data?: T; | |
error?: any; | |
}; | |
export default function useAsync<T>( | |
getData: () => Promise<T>, | |
deps: readonly any[], |
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
interface Serialized { | |
a: string, | |
b: string, | |
c: string | string[], | |
} | |
interface Deserialized { | |
field: number, //parsed from a | |
otherField: string, // parsed from b | |
yetAnotherField: string[] // parsed from c |
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 { useState, useEffect } from 'react'; | |
type State<T> = { | |
data?: T; | |
error?: T; | |
}; | |
export default function useAsync<T>( | |
getData: () => Promise<T>, | |
deps: readonly any[], |
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 [J grad] = nnCostFunction(nn_params, ... | |
input_layer_size, ... | |
hidden_layer_size, ... | |
num_labels, ... | |
X, y, lambda) | |
%NNCOSTFUNCTION Implements the neural network cost function for a two layer | |
%neural network which performs classification | |
% [J grad] = NNCOSTFUNCTON(nn_params, hidden_layer_size, num_labels, ... | |
% X, y, lambda) computes the cost and gradient of the neural network. The | |
% parameters for the neural network are "unrolled" into the vector |
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
let blacklists = ["https://mail.google.com/*","https://www.duolingo.com/*","https://trello.com/*","http://null-null-null.github.io/*","file:///*"] |
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
watch: { | |
number: { | |
handler: function (newValue, oldValue) { | |
// do your update here | |
}, | |
immediate: true | |
} |
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 ResizeSensor from require('css-element-queries/src/ResizeSensor') | |
export default { | |
// this will run in addition to any mounted() hook on the component | |
// using the mixin | |
mounted () { | |
this.$resizeSensor = new ResizeSensor(this.$el, () => { | |
// per the docs (https://vuejs.org/v2/api/#Vue-set), | |
// this lets you add a reactive data property that wasn't specified in the component's | |
// data() { } hook |
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 Ember from 'ember'; | |
export default Ember.Controller.extend({ | |
appName: 'Ember Twiddle', | |
queryParams: [{ | |
testParam: { | |
replace: true | |
} | |
}], | |
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
var playerToEntrance = PortalEntrance.position - PlayerCamera.transform.position; | |
Debug.Log(playerToEntrance); | |
var renderCenter = originalPosition - playerToEntrance; | |
var leftEyeOffset = InputTracking.GetLocalPosition((VRNode)0); | |
var leftEyeRotation = InputTracking.GetLocalRotation((VRNode)0); | |
var rightEyeOffset = InputTracking.GetLocalPosition((VRNode)1); | |
var rightEyeRotation = InputTracking.GetLocalRotation((VRNode)1); |
NewerOlder