Skip to content

Instantly share code, notes, and snippets.

View bretmorris's full-sized avatar

Bret Morris bretmorris

  • Use All Five
  • Los Angeles, CA
  • X @4bret
View GitHub Profile
import { useRouter } from 'next/router'
import { useState, useEffect } from 'react'
const Page = () => {
const router = useRouter()
const [results, setResults] = useState(false)
const [query, setQuery] = useState()
// react to query parameter changes
useEffect(() => {
@bretmorris
bretmorris / example.js
Last active March 31, 2021 20:18
using use-query to get calendar events by search query and updating URL query params
import { useState } from 'react'
import { useQuery } from 'lib/use-query'
const CalendarListing = () => {
const [loading, setLoading] = useState(true)
const [queryParams, setQueryParams] = useState({})
const [events, setEvents] = useState([])
const getEvents = async () => {
const urlParams = new URLSearchParams(window.location.search)
const params = {
const path = require('path')
module.exports = {
// Point at your stories
stories: ['../components/**/*.stories.js'],
addons: [
'@storybook/addon-links',
'@storybook/addon-essentials',
// Handle SCSS modules
{
import textBalancer from 'text-balancer';
textBalancer.intialize();
<div class="balance-text">
this is a long<br data-owner="balance-text"><strong>headline with
<br data-owner="balance-text">lots</strong> of <a href="https://google.com">lorem copy</a>
</div>
<script>
AFRAME.registerComponent("trigger-listener", {
init: function () {
var el = this.el;
el.addEventListener("triggerdown", function (evt) {
document.getElementById("ball").emit("throw");
});
},
});
</script>
<script>
AFRAME.registerComponent("trigger-listener", {
init: function () {
var el = this.el;
el.addEventListener("triggerdown", function (evt) {
document.getElementById("ball").emit("throw");
});
},
});
</script>
<a-sphere
animation="property: position; to: 0 0.9144 0; dur: 375;"
id="ball"
radius="0.0365"
color="white"
position="0 2.34 -18.4404">
</a-sphere>
<a-entity
id="secondaryHand"
oculus-touch-controls="hand: left">
</a-entity>
<a-entity
id="primaryHand"
oculus-touch-controls="hand: right">
</a-entity>
<a-sphere
radius="0.0365"
color="white"
position="0 2.34 -18.4404">
</a-sphere>