Skip to content

Instantly share code, notes, and snippets.

@tany3
tany3 / gist:2d032cbbbd9db04b976d
Created May 15, 2014 08:23
重複処理 IEnumerableをそのまま使い回さない - Possible multiple enumeration of IEnumerable

IEnumerableをそのまま使うと、使う度に毎回変換される。遅延実行。 http://confluence.jetbrains.com/display/ReSharper/Possible+multiple+enumeration+of+IEnumerable

Assuming that GetNames() returns an IEnumerable, we are, effectively, doing extra work by enumerating this collection twice in the two foreach statements. If GetNames() results in a database query, you end up doing that query twice, while both times getting the same data.

ということで、特に複数回使う場合など適宜ToList()やToArray()しておく。

参考:LINQ クエリの概要 (C#) http://msdn.microsoft.com/ja-jp/library/bb397906.aspx

@Ashwinning
Ashwinning / Singletons.md
Last active March 31, 2020 15:18
A copy of the post on Singletons in Unity/C# as it appeared on UnityPatterns.com

Singletons

Original post by David Laskey on UnityPatterns

As you develop in Unity, you’ll often find that it’s handy to have just single instances of certain objects. For example, let’s say we have a single GameObject, “MusicManager”, that’s in charge of our music. It might look like this:

using UnityEngine;
 
@azu
azu / js.md
Last active December 28, 2021 07:19
JavaScriptのレベル別書籍のまとめ

前提: 完成していて、比較的支持を集めていて、JavaScriptを中心にした書籍 (DOM APIよりは言語を中心とした内容)

追記: JavaScriptの入門書 #jsprimerを書いている

最初からES2015で学ぶことを前提にした初心者〜中級者向けのJavaScript本がなかったので書いてる。 ES2015でJavaScriptという言語のコア部分は大きく変わったので、それを前提とした内容にする予定。

@philippschmitt
philippschmitt / DropboxPaperMarkdownDownloader.md
Last active May 9, 2022 19:50
Dropbox Paper Markdown (.md) Download Bookmarklet

Dropbox Paper Markdown (.md) Download Bookmarklet

I made this bookmarklet to download individual DB Paper documents in Markdown format, which is currently unsupported in Paper.

The interface only supports downloading individual documents in MSWord (.docx) format. While the global download option supports Markdown (.md) files, it doesn't work properly. I frequently find documents missing in the global dump.

Update, 04.06.16: Dropbox finally added the option to select Markdown as download format for individual docs. Which renders my bookmarklet useless, but is great!

Install & Use

@voluntas
voluntas / react.rst
Last active May 25, 2022 11:57
React コトハジメ

React コトハジメ

日時

2017-01-02

@voluntas

バージョン

2.1.0

URL

https://voluntas.githu.io/

突っ込みは Twitter @voluntas まで。

@GOROman
GOROman / EyeJitter.cs
Last active November 25, 2022 12:17
Unityで微細眼球運動っぽい何か
using UnityEngine;
using System.Collections;
public class EyeJitter : MonoBehaviour {
float timer = 0.0f;
Quaternion rot;
public float changeTime = 0.4f; // 変更する時間最小値
@hail2u
hail2u / csslint-rules.md
Last active April 29, 2023 14:59
CSSLintのRulesの超訳

訳注

これは超訳です。

CSSLintは「なんでこんなルールなんだ…」とイラっとすることが多いですけど、それぞれにそれなりに理由があります。まぁ勿論無視するべきなルールとかもあります。例えば見出し要素の再定義禁止とかはHTML5に対するCSSなら無理な話です。そんなわけでどんな理由なのかを簡単に訳しました。無視するかどうかは自分で決めましょう!

この訳はCSSLintと同じライセンスで提供されます。

Possible Errors

@cvrebert
cvrebert / css_regression_testing.md
Last active May 9, 2023 12:13
Survey of screenshot-based CSS testing tools

Currently considering https://github.com/webdriverio/webdrivercss


Core Goals:

  • Can test in up-to-date versions of all major browsers
  • Can test on up-to-date versions of all major OSes
  • Can test in IE9 (because Bootstrap v4 will support IE9+)
  • Don't want to have to setup/maintain our own cluster of VMs running all the necessary OSes (and all the versions of Windows)
  • Workflow for management of reference/baseline/norm screenshots
@LearnCocos2D
LearnCocos2D / gist:77f0ced228292676689f
Last active February 12, 2024 20:47
Overview of Entity Component System (ECS) variations with pseudo-code

For background and further references see: Entity Component Systems on Wikipedia

ECS by Scott Bilas (GDC 2002)

Entity->Components->Update
  • entity = class: no logic + no data OR at most small set of frequently used data (ie position)
  • component = class: logic + data
foreach entity in allEntities do
    foreach component in entity.components do