Skip to content

Instantly share code, notes, and snippets.

@sudodo
sudodo / how_to_get_cleared_stash_on_git
Created December 9, 2011 06:24
git stash clearを元に戻す方法
h1. 変更が消えてしまった!?その対応
せっかく実施したコードへの修正が消えてしまう、これほど開発者をがっかりさせることは無いでしょう。
Gitを使えば、消えてしまったように見える変更を復活できることがあります。
h2. 大原則
復活できる可能性があるのは、「何らかの形でGitに履歴を残してある歴史」だけです。
たとえば、以下のファイルを復活させることはできません。
@uranuno
uranuno / TimeUtils.cs
Last active June 12, 2016 15:54
Time.timeScale = 0にしたときも動く、WaitForSeconds(Unity)
using UnityEngine;
using System.Collections;
public class TimeUtils : MonoBehaviour
{
//TimeScaleに関わらず、指定の秒数まつ
public static IEnumerator WaitForSecondsIgnoreTimeScale(float time)
{
float targetTime = Time.realtimeSinceStartup + time;
while(Time.realtimeSinceStartup < targetTime)
@AArnott
AArnott / StaticFuncWithArgExaminer.cs
Created August 21, 2014 21:21
Creating a static method that accepts a first argument supplied by the delegate.
namespace ILExaminer
{
using System;
static class Program
{
internal static Func<T> AsFunc<T>(this T value)
where T : class
{
return new Func<T>(value.Return);
@stramit
stramit / CustomEvents.cs
Created September 4, 2014 06:16
Sending Custom Events via the EvenSystem
using System;
using System.Collections.Generic;
using UnityEngine.Events;
// interface you implement in your MB to receive events
public interface ICustomHandler : IEventSystemHandler
{
void OnCustomCode(CustomEventData eventData);
}
@tsubaki
tsubaki / SortingLayer.cs
Last active May 20, 2016 06:38
SortingLayerを設定する。ShaderにTransparentとかParticle使っている場合はコレで描画順が制御出来る
/// Set Sorting Layer
/// Copyright (c) 2014 Tatsuhiko Yamamura
/// Released under the MIT license
// / http://opensource.org/licenses/mit-license.php
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
#if UNITY_EDITOR
@tsubaki
tsubaki / UI-Mask.shader
Created October 29, 2015 12:16
トランジション的な感じ
Shader "UI/Mask"
{
Properties
{
[PerRendererData] _MainTex ("Sprite Texture", 2D) = "white" {}
_Color ("Tint", Color) = (1,1,1,1)
_StencilComp ("Stencil Comparison", Float) = 8
_Stencil ("Stencil ID", Float) = 0
_StencilOp ("Stencil Operation", Float) = 0
@Joe4evr
Joe4evr / AudioModule.cs
Last active October 18, 2023 15:32
D.Net 1.0 audio example
using System.Threading.Tasks;
using Discord.Commands;
public class AudioModule : ModuleBase<ICommandContext>
{
// Scroll down further for the AudioService.
// Like, way down
private readonly AudioService _service;
// Remember to add an instance of the AudioService
@roryprimrose
roryprimrose / Function1.cs
Created May 27, 2018 04:43
Azure Functions with ILogger example
namespace FunctionApp1
{
using Autofac;
using Autofac.Core;
using EnsureThat;
using Microsoft.Azure.WebJobs;
using Microsoft.Azure.WebJobs.Description;
using Microsoft.Azure.WebJobs.Host;
using Microsoft.Azure.WebJobs.Host.Config;
@NoelOConnell
NoelOConnell / DataStoreItem.cs
Last active July 27, 2020 21:10
IDataStore using Azure Table Storage for google-api-dotnet-client
public class DataStoreItem: TableEntity
{
public string Value { get; set; }
}
@TakaakiIchijo
TakaakiIchijo / CriWareGameViewMuteButton.cs
Last active January 8, 2024 02:43
Enable the mute button on Game View when uses CRI ADX in Unity
using CriWare;
using UnityEditor;
[InitializeOnLoadAttribute]
public class CriWareGameViewMuteButton
{
private static bool isAudioMute = false;
static CriWareGameViewMuteButton()
{