Skip to content

Instantly share code, notes, and snippets.

View develax's full-sized avatar
💭
∑☯

Joe develax

💭
∑☯
View GitHub Profile
@develax
develax / GIT
Last active August 14, 2020 10:45
Lazy man's guide: multiple GitHub HTTPS accounts on Windows
https://dev.to/configcat/lazy-man-s-guide-multiple-github-https-accounts-on-windows-2mad
@Horusiath
Horusiath / Fibers.cs
Created November 24, 2019 22:09
Minimal example of working async method builder
using System;
using System.Runtime.CompilerServices;
using System.Runtime.ExceptionServices;
using System.Threading;
namespace Fibers
{
public struct AsyncFiberMethodBuilder<T>
{
private Fiber<T>? fiber;
@achimmihca
achimmihca / MoveCornersToAnchors.cs
Created November 20, 2019 17:38
Unity3D Editor script that adds some MenuItem to move the corners of a RectTransform to its anchors.
using System.Collections;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
public static class CornersToAnchorsMenuItems
{
// Hotkey: Alt+C
[MenuItem("Tools/Corners to Anchors (RectTransform)/Width and Height and Position &c")]
@achimmihca
achimmihca / AnchorsToCornersMenuItems.cs
Last active May 25, 2024 18:25
Unity3D Editor script that adds MenuItem to move the anchors of a RectTransform to its corners.
using UnityEditor;
using UnityEngine;
public static class AnchorsToCornersMenuItems
{
// Hotkey: Alt+A
[MenuItem("Tools/Anchors to Corners (RectTransform)/Width and Height &a")]
public static void MoveAnchorsToCorners()
{
EditorUtils.GetSelectedComponents<RectTransform>().ForEach(it =>
@JohannesMP
JohannesMP / LICENSE
Last active September 29, 2024 15:28
[Unity3D] A Reliable, user-friendly way to reference SceneAssets by script.
/*******************************************************************************
* Don't Be a Jerk: The Open Source Software License.
* Adapted from: https://github.com/evantahler/Dont-be-a-Jerk
*******************************************************************************
* _I_ am the software author - JohannesMP on Github.
* _You_ are the user of this software. You might be a _we_, and that's OK!
*
* This is free, open source software. I will never charge you to use,
* license, or obtain this software. Doing so would make me a jerk.
*
// Originally inspired by David Walsh (https://davidwalsh.name/javascript-debounce-function)
// Returns a function, that, as long as it continues to be invoked, will not
// be triggered. The function will be called after it stops being called for
// `wait` milliseconds.
const debounce = (func, wait) => {
let timeout;
return function executedFunction(...args) {
const later = () => {
// Originally inspired by David Walsh (https://davidwalsh.name/javascript-debounce-function)
// Returns a function, that, as long as it continues to be invoked, will not
// be triggered. The function will be called after it stops being called for
// `wait` milliseconds.
const debounce = (func, wait) => {
let timeout;
// This is the function that is returned and will be executed many times
// We spread (...args) to capture any number of parameters we want to pass
@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;
@slavafomin
slavafomin / nodejs-custom-es6-errors.md
Last active November 14, 2024 11:23
Custom ES6 errors in Node.js

Here's how you could create custom error classes in Node.js using latest ES6 / ES2015 syntax.

I've tried to make it as lean and unobtrusive as possible.

Defining our own base class for errors

errors/AppError.js

@djcsdy
djcsdy / Unity with source control.md
Last active October 5, 2024 13:46
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.