Skip to content

Instantly share code, notes, and snippets.

@pocc
pocc / permanently_delete_all.js
Last active December 29, 2023 03:41
Bookmarklet to permanently delete all notion pages that have already been deleted.
javascript:(function(){
// Author: Ross Jacobs
// Purpose: Use as a browser bookmarklet to bulk delete notion pages in trash
// License: Apache 2.0
async function getSpaceId() {
resp = await fetch("https://www.notion.so/api/v3/loadUserContent", {"credentials":"include","headers":{"accept":"*/*","cache-control":"no-cache","content-type":"application/json","pragma":"no-cache","sec-fetch-mode":"cors","sec-fetch-site":"same-origin"},"referrerPolicy":"same-origin","body":"{}","method":"POST","mode":"cors"});
json = await resp.json();
spaceId = Object.keys(json.recordMap.space)[0];
return spaceId;
}
@gamerxl
gamerxl / ue4-json-parsing.cpp
Last active January 13, 2024 11:49
How to parse a json response (e.g. a json array) in ue4 c++ context.
/**
* Include the PrivateDependencyModuleNames entries below in your project build target configuration:
* PrivateDependencyModuleNames.AddRange(new string[] { "Json", "JsonUtilities" });
*/
#include "Runtime/Online/HTTP/Public/Http.h"
#include "Serialization/JsonSerializer.h"
FHttpResponsePtr Response;
@vildninja
vildninja / RemoveMissingScriptsRecursively.cs
Created March 25, 2019 10:06
Remove missing MonoBehaviour script components in Unity 2019.1 including visiting prefafab assets.
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
using UnityEditor;
public static class FindMissingScriptsRecursively
{
[MenuItem("Auto/Remove Missing Scripts Recursively Visit Prefabs")]
private static void FindAndRemoveMissingInSelected()
{
// EditorUtility.CollectDeepHierarchy does not include inactive children
@djcsdy
djcsdy / Unity with source control.md
Last active March 26, 2024 20:04
Unity with source control

In the Unity editor:

  1. Edit -> Project Settings -> Editor
  2. In the inspector panel, set:
  3. Version Control -> Mode: Visible Meta Files
  4. Asset Serialization -> Mode: Force Text

“Visible Meta Files” causes Unity to place .meta files next to each of your assets. It’s important to check these files into version control because they contain the settings associated with those assets that you set in the Unity editor.

“Asset Serialization: Force Text” causes Unity to write its .meta and other files in a more-or-less human-readable text format, which makes it a lot easier to understand what has changed when you look at version control logs. Also it’s feasible to merge these text files by hand, whereas it’s not really possible to do that with Unity’s default binary file format.

@define-private-public
define-private-public / HttpServer.cs
Last active April 9, 2024 08:38
A Simple HTTP server in C#
// Filename: HttpServer.cs
// Author: Benjamin N. Summerton <define-private-public>
// License: Unlicense (http://unlicense.org/)
using System;
using System.IO;
using System.Text;
using System.Net;
using System.Threading.Tasks;
@nemotoo
nemotoo / .gitattributes
Last active May 2, 2024 18:33
.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
@DashW
DashW / ScreenRecorder.cs
Last active May 6, 2024 10:27
ScreenRecorder - High Performance Unity Video Capture Script
using UnityEngine;
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Threading;
class BitmapEncoder
{
public static void WriteBitmap(Stream stream, int width, int height, byte[] imageData)