Skip to content

Instantly share code, notes, and snippets.

@attolee
attolee / deep-copy-object.cs
Last active April 13, 2021 03:57
C# deep copy object
// the idea from http://www.agiledeveloper.com/articles/cloning072002.htm
using System;
namespace ConsoleApp1
{
class Program
{
public class Person : ICloneable
{
using UnityEngine;
public static class VectorExtensions
{
/// <summary>
/// 将坐标点移动四分之一个圆
/// </summary>
/// <param name="pivot">原点</param>
/// <param name="before">移动前的坐标点</param>
/// <returns>移动后的坐标点</returns>
@attolee
attolee / del-merged-branch-remotely.txt
Last active July 10, 2018 12:02
delete all merged branches remotely
git branch -r --merged | egrep -v "(^\*|master|dev)" | sed s/origin\\/// | xargs -I{} git push origin --delete {}
@attolee
attolee / unity-gameobject-traveller.cs
Last active October 8, 2021 13:31
traverse unity gameobject's hierarchy by recursion
/*
* https://en.wikipedia.org/wiki/Tree_(data_structure)
*/
private static List<GameObject> Traverse(GameObject parent, Type type)
{
List<GameObject> children = new List<GameObject>();
foreach (Transform node in parent.transform)
children.Add(node.gameObject);