Skip to content

Instantly share code, notes, and snippets.

var api = 'https://api.giphy.com/v1/gifs/search?';
var apiKey = '&api_key=dc6zaTOxFJmzC';
var query = '&q=rainbow';
function setup() {
noCanvas();
var url = api + apiKey + query;
loadJSON(url, gotData);
}
@didacus
didacus / script.js
Created August 21, 2020 12:17
UI Picker Spark AR
const NativeUI = require('NativeUI');
const Textures = require('Textures');
const Patches = require('Patches');
Promise.all([
Textures.findFirst('icon_1'),
Textures.findFirst('icon_2'),
Textures.findFirst('icon_3'),
]).then(onReady);
@didacus
didacus / useWindowSize.js
Created January 29, 2021 16:12
React hook to capture window size (Debounced).
import { useState, useEffect } from "react"
// Debounce function
function debounce(func, wait, immediate) {
var timeout
return function () {
var context = this,
args = arguments
var later = function () {
timeout = null
@didacus
didacus / launch.json
Created February 27, 2021 12:09
Chrome debug VSCODE
{
"version": "0.2.0",
"configurations": [
{
"name": "Chrome",
"type": "chrome",
"request": "launch",
"url": "http://localhost:3000",
"webRoot": "${workspaceRoot}/src"
}
@didacus
didacus / SpawnableManager.cs
Created November 8, 2021 14:35
SpawnableManager AR
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.XR.ARFoundation;
public class SpawnableManager : MonoBehaviour
{
[SerializeField]
@didacus
didacus / CameraController.cs
Created November 14, 2021 09:30
Unity - Camera controller to follow player
using UnityEngine;
using System.Collections;
public class CameraController : MonoBehaviour {
public GameObject player; //Public variable to store a reference to the player game object
private Vector3 offset; //Private variable to store the offset distance between the player and camera
@didacus
didacus / Character.Controller.cs
Created November 14, 2021 09:40
Unity - Controller for character movement
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Example : MonoBehaviour
{
private CharacterController controller;
private Vector3 playerVelocity;
private bool groundedPlayer;
private float playerSpeed = 2.0f;
@didacus
didacus / PlayerHealthManager.cs
Created November 14, 2021 14:28
Unity - Basic script to manage player health
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlayerHealthManager : MonoBehaviour
{
public int startingHealth;
private int currentHealth;
public float flashLength;
private float flashCounter;
@didacus
didacus / BulletController.cs
Created November 14, 2021 15:05
Unity - Basic bullet controller against enemies
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class BulletController : MonoBehaviour
{
public float speed;
public float lifeTime;
public int damageToGive;
@didacus
didacus / EnemyController.cs
Created November 14, 2021 15:11
Unity - Enemy controller that follows player.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class EnemyController : MonoBehaviour
{
private Rigidbody RB;
public float moveSpeed;
public PlayerController thePlayer;