Skip to content

Instantly share code, notes, and snippets.

View vfrz's full-sized avatar
💻
C# Fanboy

Valentin Fritz vfrz

💻
C# Fanboy
View GitHub Profile
@WolfgangSenff
WolfgangSenff / gist:168cb0cbd486c8c9cd507f232165b976
Last active May 31, 2024 01:55
Godot 4.0 Migration/Upgrade guide
## For a beginner-friendly version of the following (more advanced users likely will get better use of the below,
## if you're just starting out...), see this new gist:
## https://gist.github.com/WolfgangSenff/0a9c1d800db42a9a9441b2d0288ed0fd
This document represents the beginning of an upgrade or migration document for GDScript 2.0 and Godot 4.0. I'm focusing on 2D
at the moment as I'm upgrading a 2D game, but will hopefully have more to add for 3D afterward.
## If you want more content like this, please help fund my cat's medical bills at https://ko-fi.com/kyleszklenski - thank you very much! On to the migration guide.
@davidfowl
davidfowl / MinimalAPIs.md
Last active May 18, 2024 18:28
Minimal APIs at a glance
@sebtoun
sebtoun / UniformPoissonDiskSampler.cs
Created March 10, 2018 09:03
Poisson Disk Sampler
// Adapted from java source by Herman Tulleken
// http://www.luma.co.za/labs/2008/02/27/poisson-disk-sampling/
// The algorithm is from the "Fast Poisson Disk Sampling in Arbitrary Dimensions" paper by Robert Bridson
// http://www.cs.ubc.ca/~rbridson/docs/bridson-siggraph07-poissondisk.pdf
using System;
using System.Collections.Generic;
using UnityEngine;
using Random = System.Random;
@steven2358
steven2358 / ffmpeg.md
Last active May 27, 2024 19:15
FFmpeg cheat sheet
@mombrea
mombrea / DbInitializer.cs
Last active April 5, 2023 21:55
EF Core 1.0 and ASP.NET Core Identity Seed Data
using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
using System.Linq;
namespace My.App.Data
{
public class DbInitializer : IDbInitializer
{
private readonly ApplicationDbContext _context;
private readonly UserManager<ApplicationUser> _userManager;
@JonCole
JonCole / RedisKeyspaceNotificationsExample.cs
Last active December 22, 2023 00:27
Redis Keyspace Notification Example
using System;
namespace StackExchange.Redis
{
static class RedisKeyspaceNotifications
{
/// <summary>
/// NOTE: For this sample to work, you need to go to the Azure Portal and configure keyspace notifications with "Kxge$" to
/// 1) turn on expiration notifications (x),
/// 2) general command notices (g) and
@sheastrickland
sheastrickland / gotcha.md
Created August 2, 2015 11:26
BlockingCollection with Parallel.ForEach with a Partitioner

Lesson Learnt, Streaming Producer / Consumer issue using:

BlockingCollection<T> and Parallel.ForEach(_blockingCollection.GetConsumingEnumerable

Beware default Partitioner algo, which is chunking and buffering.

The GetConsumingPartitioner heading covers it, and also the first comment from Stephen Toub totally nails it. We implemented similar to what commenter Hernan pointed out. Stephen Toub Blog

My absolute saviour, NoBuffering in:

@DanDiplo
DanDiplo / JS-LINQ.js
Last active May 20, 2024 10:30
JavaScript equivalents of some common C# LINQ methods. To help me remember!
// JS array equivalents to C# LINQ methods - by Dan B.
// First: This version using older JavaScript notation for universal browser support (scroll down for ES6 version):
// Here's a simple array of "person" objects
var people = [
{ name: "John", age: 20 },
{ name: "Mary", age: 35 },
{ name: "Arthur", age: 78 },
{ name: "Mike", age: 27 },
@digitalshadow
digitalshadow / OpenSimplexNoise.cs
Last active May 1, 2024 04:32
OpenSimplex Noise Refactored for C#
/* OpenSimplex Noise in C#
* Ported from https://gist.github.com/KdotJPG/b1270127455a94ac5d19
* and heavily refactored to improve performance. */
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
namespace NoiseTest
var mediaJSON = { "categories" : [ { "name" : "Movies",
"videos" : [
{ "description" : "Big Buck Bunny tells the story of a giant rabbit with a heart bigger than himself. When one sunny day three rodents rudely harass him, something snaps... and the rabbit ain't no bunny anymore! In the typical cartoon tradition he prepares the nasty rodents a comical revenge.\n\nLicensed under the Creative Commons Attribution license\nhttp://www.bigbuckbunny.org",
"sources" : [ "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4" ],
"subtitle" : "By Blender Foundation",
"thumb" : "images/BigBuckBunny.jpg",
"title" : "Big Buck Bunny"
},
{ "description" : "The first Blender Open Movie from 2006",
"sources" : [ "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ElephantsDream.mp4" ],