Skip to content

Instantly share code, notes, and snippets.

function DownloadArrayOfFiles(files, path)
{
return new Promise((resolve, reject) =>{
Promise.allSettled(
files.map(filename => API.get(filename, {responseType: "stream"}))
)
.then(responses => {
let writer;
for(var response in responses)
{
@jasonmarziani
jasonmarziani / axios.js
Created March 17, 2021 19:20 — forked from matthewsuan/axios.js
Axios request queue-like that limits number of requests at any given time
import axios from 'axios'
const MAX_REQUESTS_COUNT = 5
const INTERVAL_MS = 10
let PENDING_REQUESTS = 0
// create new axios instance
const api = axios.create({})
/**
@jasonmarziani
jasonmarziani / ShuffleArray.cs
Created May 10, 2019 17:49 — forked from cosmicmonster/ShuffleArray.cs
Unity3D / C# code to shuffle and array using the Fisher-Yates Shuffle.
using UnityEngine;
using System.Collections;
public class ShuffleArray : MonoBehaviour {
// Public so you can fill the array in the inspector
public int[] scenarios;
@jasonmarziani
jasonmarziani / .gitattributes
Created May 7, 2019 16:07 — forked from nemotoo/.gitattributes
.gitattributes for Unity3D with git-lfs
## Unity ##
*.cs diff=csharp text
*.cginc text
*.shader text
*.mat merge=unityyamlmerge eol=lf
*.anim merge=unityyamlmerge eol=lf
*.unity merge=unityyamlmerge eol=lf
*.prefab merge=unityyamlmerge eol=lf
@jasonmarziani
jasonmarziani / PortaitCameraBridgeViewBase.java
Created February 8, 2019 04:19
boost performance for opencv camera
// Around line 435, replace the block with this code
if (bmpValid && mCacheBitmap != null) {
Canvas canvas = getHolder().lockCanvas();
if (canvas != null)
{
canvas.rotate(90f, canvas.getWidth()/2, canvas.getHeight()/2);
canvas.drawColor(0, android.graphics.PorterDuff.Mode.CLEAR);
//Log.d(TAG, String.format("scale: %f, canvas width x height: %d x %d, bitmap width x height:%d x %d ", mScale, canvas.getWidth(), canvas.getHeight(), mCacheBitmap.getWidth(), mCacheBitmap.getHeight()));
@jasonmarziani
jasonmarziani / CameraShakeController
Created December 12, 2013 21:41
Camera Shake for Unity3D in C#. Built and testing in Unity 4.2 + 4.3
using UnityEngine;
using System.Collections;
public class CameraShakeController : MonoBehaviour {
public Camera theCamera;
public float magnitude = 5.0f;
public float duration = 2.0f;
public Vector3 direction;