Skip to content

Instantly share code, notes, and snippets.

View Vanlalhriata's full-sized avatar

Vanlal Hriata Vanlalhriata

  • Aizawl, Mizoram, India
View GitHub Profile
@Vanlalhriata
Vanlalhriata / PreviewAudioUtil.cs
Created July 18, 2022 16:38
Generate a timmed and fading audio wav file from an AudioClip in Unity3D
using System.IO;
using System.Linq;
using UnityEngine;
// Generate a preview audio file (.wav) from an AudioClip.
// This uses SavWav forked and modified from darktable:
// https://gist.github.com/Vanlalhriata/dc5b703cca6f2e885557e1c2f54c376a
public static class PreviewAudioUtil
{
private const string PREVIEW_AUDIO_FILENAME = "Preview";
@Vanlalhriata
Vanlalhriata / SavWav.cs
Last active July 18, 2022 16:25 — forked from darktable/SavWav.cs
Unity3D: script to save an AudioClip as a .wav file.
// Copyright (c) 2012 Calvin Rien
// http://the.darktable.com
//
// This software is provided 'as-is', without any express or implied warranty. In
// no event will the authors be held liable for any damages arising from the use
// of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it freely,
// subject to the following restrictions:

Privacy Policy

Vanlal Hriata built the AR Secret Switches POC app as a Free app. This SERVICE is provided by Vanlal Hriata at no cost and is intended for use as is.

This page is used to inform visitors regarding my policies with the collection, use, and disclosure of Personal Information if anyone decided to use my Service.

If you choose to use my Service, then you agree to the collection and use of information in relation to this policy. The Personal Information that I collect is used for providing and improving the Service. I will not use or share your information with anyone except as described in this Privacy Policy.

The terms used in this Privacy Policy have the same meanings as in our Terms and Conditions, which is accessible at AR Secret Switches POC unless otherwise defined in this Privacy Policy.

@Vanlalhriata
Vanlalhriata / bukhumwe-privacy-policy.md
Created May 1, 2021 11:17
Privacy policy for Bukhumwe

Privacy Policy

Vanlal Hriata built the Bukhumwe app as a Free app. This SERVICE is provided by Vanlal Hriata at no cost and is intended for use as is.

This page is used to inform visitors regarding my policies with the collection, use, and disclosure of Personal Information if anyone decided to use my Service.

If you choose to use my Service, then you agree to the collection and use of information in relation to this policy. The Personal Information that I collect is used for providing and improving the Service. I will not use or share your information with anyone except as described in this Privacy Policy.

The terms used in this Privacy Policy have the same meanings as in our Terms and Conditions, which is accessible at Bukhumwe unless otherwise defined in this Privacy Policy.

@Vanlalhriata
Vanlalhriata / objectToFormData.js
Created June 25, 2020 03:06
Convert JavaScript object to FormData. Modified from [this answer](https://stackoverflow.com/a/49388446/2530736) on StackOveflow
objectToFormData(obj, rootName, ignoreList) {
var formData = new FormData();
function appendFormData(data, root) {
if (!ignore(root)) {
root = root || '';
if (data instanceof File) {
formData.append(root, data);
} else if (Array.isArray(data)) {
for (var i = 0; i < data.length; i++) {
@Vanlalhriata
Vanlalhriata / BackgroundParallax.cs
Created June 27, 2019 09:48
Parallax sprites. Infinite horizontal scrolling. Moving camera. Unity.
using UnityEngine;
// Move background as the camera moves, the amount (moveFactor) depending on how far ([0,inf)) it is from the player.
// The sprite is repeated to the left and right to accomodate infinite horizontal scrolling. Infinite scrolling is achieved
// by moving the 3-sprite set by steps of the sprite width whenever the camera crosses the center of the left or right sprite.
// Since each instance of this component may have a different moveFactor, the absolute position at which this crossing of the
// left or right sprite's center also differs, and is therefore a calculated value (stepThreshold). For example, stepThreshold
// is sprite width when Distance is 0, since the background is stationary. For Distance of 1, stepThreshold is infinity since
// the background moves with the camera and thus the camera is always at the center of the sprite set, never crossing the left or right centers.
@Vanlalhriata
Vanlalhriata / GameHost.cs
Created August 23, 2016 14:39
Host Unity game in WPF
using System;
using System.Diagnostics;
using System.Runtime.InteropServices;
using System.Windows;
using System.Windows.Interop;
namespace KinectRun.Host.Controls
{
// GameHost is a FrameworkElement and can be added to controls like so:
// var gameHost = new GameHost(container.ActualWidth, container.ActualHeight);
public static class ServiceLocator
{
public static Dictionary<Type, object> serviceContainer = null;
public static void AddService<T>(T serviceInstance)
{
if (null == serviceContainer)
serviceContainer = new Dictionary<Type, object>();
try
@Vanlalhriata
Vanlalhriata / Messenger.js
Created September 2, 2015 13:44
Send messages between a root HTML window and one level of nested iframes
// Send messeges between a root window and its iframes.
// This works for only one level of iframes - because that was what I needed
// NOTE: jQuery is required
'use strict';
(function(root){
@Vanlalhriata
Vanlalhriata / README.md
Last active August 29, 2015 14:24 — forked from balint42/README.md

JS function for parsing SVG paths

Parse an svg path object and generate an Array of path commands. Each command is an Array of the form [command, arg1, arg2, ...] NOTE: parsing is done via pathSegList which is faster and more reliable than parsing the path string directly, but might not work in old browsers.