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

@dergachev
dergachev / GIF-Screencast-OSX.md
Last active May 2, 2024 05:55
OS X Screencast to animated GIF

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

@hail2u
hail2u / csslint-rules.md
Last active April 29, 2023 14:59
CSSLintのRulesの超訳

訳注

これは超訳です。

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

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

Possible Errors