Skip to content

Instantly share code, notes, and snippets.

View yoeven's full-sized avatar
🍁

Yoeven D Khemlani yoeven

🍁
View GitHub Profile
const endPoint = "https://api.jigsawstack.com/v1/ai/scrape";
const run = async (url: string, prompts: string[]) => {
const resp = await fetch(endPoint, {
method: "POST",
headers: {
"Content-Type": "application/json",
"x-api-key": "KEY",
},
body: JSON.stringify({
@yoeven
yoeven / fly.toml
Last active September 4, 2023 10:55
Hasura fly.io toml file
#https://fly.io/docs/reference/configuration/
app = "hasura"
primary_region = "sjc" #https://fly.io/docs/reference/regions/
[build]
image = "hasura/graphql-engine:v2.15.2" #update version accordingly
#https://hasura.io/docs/latest/deployment/updating-graphql-engine/
#https://hasura.io/docs/latest/policies/versioning
@yoeven
yoeven / JSON_to_URLEncoded.ts
Last active July 5, 2023 07:19 — forked from lastguest/JSON_to_URLEncoded.js
Convert JavaScript object to x-www-form-urlencoded format
const JSONtoURLEncoded = (element: any, key?: string, _list?: any[]) => {
let list = _list || [];
if (typeof element == "object") {
for (let idx in element) JSONtoURLEncoded(element[idx], key ? key + "[" + idx + "]" : idx, list);
} else {
list.push(key + "=" + encodeURIComponent(element));
}
return list.join("&");
};
@yoeven
yoeven / requestWithoutResp.ts
Last active April 24, 2023 14:22
Fetch without a response (JS)
//https://www.sensedeep.com/blog/posts/stories/lambda-fast-http.html
export const fetchWithoutResp = async (
url: string,
body?: string | Buffer,
headers: {
[key: string]: string;
} = {},
method: "POST" | "GET" = "POST"
) => {
const router = url.includes("http://") ? http : https;
@yoeven
yoeven / SimpleCameraShake.cs
Created October 17, 2018 06:57
A simple camera shake that just shakes the camera from its current rotation and resets it back to its original location. Forked from http://wiki.unity3d.com/index.php/Camera_Shake
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class SimpleCameraShake : MonoBehaviour
{
public static SimpleCameraShake Instance;
float shakeAmount;
float shakeDuration;
@yoeven
yoeven / postJSON.cs
Created October 1, 2018 07:31 — forked from manuerumx/postJSON.cs
Unity 3D example POST JSON Data to a Server with http Auth
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class goLevel : MonoBehaviour {
//With the @ before the string, we can split a long string in many lines without getting errors
private string json = @"{
'hello':'world',
'foo':'bar',
'count':25
@yoeven
yoeven / IconTypes.json
Created March 13, 2018 11:13
All popular and common file extensions categories by icons in JSON format.
{
"ExtensionReference":"https://www.computerhope.com/issues/ch001789.htm",
"IconsReference":"https://react.semantic-ui.com/elements/icon",
"Extensions": [
{
"Ext": [
"txt",
"md",
"tex",
"doc",
/*
* The following code is based of this thread: https://answers.unity.com/questions/798510/flat-shading.html
*
* This function flat shades any mesh.
*
*/
using UnityEngine;
@yoeven
yoeven / AutoWeld.cs
Last active January 30, 2018 15:47
A function to remove vertices that share the same position which is calculated by the distance between the two vertices and then compared to a threshold. Code is based of this thread: https://answers.unity.com/questions/228841/dynamically-combine-verticies-that-share-the-same.html
/*
* The following code is based of this thread: https://answers.unity.com/questions/228841/dynamically-combine-verticies-that-share-the-same.html
*
* This function gets rid of shared vertices that fall within the same threshold distance.
*
*/
using System.Collections;