Skip to content

Instantly share code, notes, and snippets.

View kekyo's full-sized avatar
📡
I'm looking for a job

Kouji Matsui kekyo

📡
I'm looking for a job
View GitHub Profile
@darkfall
darkfall / gist:1656050
Created January 22, 2012 07:15
A simple class that converts a image to a icon in c# without losing image color data, unlike System.Drawing.Icon; ico with png data requires Windows Vista or above
class PngIconConverter
{
/* input image with width = height is suggested to get the best result */
/* png support in icon was introduced in Windows Vista */
public static bool Convert(System.IO.Stream input_stream, System.IO.Stream output_stream, int size, bool keep_aspect_ratio = false)
{
System.Drawing.Bitmap input_bit = (System.Drawing.Bitmap)System.Drawing.Bitmap.FromStream(input_stream);
if (input_bit != null)
{
int width, height;
@theconektd
theconektd / github.css
Created April 30, 2012 02:11
Github Markdown CSS - for Markdown Editor Preview
body {
font-family: Helvetica, arial, sans-serif;
font-size: 14px;
line-height: 1.6;
padding-top: 10px;
padding-bottom: 10px;
background-color: white;
padding: 30px; }
body > *:first-child {
@kiyokura
kiyokura / GetLatestTfsSource.cs
Created September 4, 2012 02:08
TFSのAPIを使って、ソースコードの最新をローカルに取得するサンプ
// TFSのAPIを使って、ソースコードの最新をローカルに取得するサンプル
// 参考:
// MSDN
// http://msdn.microsoft.com/ja-jp/library/microsoft.teamfoundation.versioncontrol.client.workspace%28v=vs.100%29.aspx
// StacK Overflow
// http://stackoverflow.com/questions/8341419/get-latest-using-tfs-api
// http://stackoverflow.com/questions/1827651/how-do-you-get-the-latest-version-of-source-code-using-the-team-foundation-serve
using System;
@pocketberserker
pocketberserker / AsyncInCSharpAndFSharp.ja.rst
Last active October 6, 2022 02:53
Async in C# and F#: Asynchronous gotchas in C# (Japanese translation)

C# と F# の Async: C# の非同期の落とし穴

原文:Async in C# and F#: Asynchronous gotchas in C#
原文著者:Tomas Petricek (@tomaspetricek)
翻訳者:@pocketberserker

2月に、私は毎年恒例のMVPサミット ── Microsoft が MVP のために主催するイベント ── に出席しました。私はボストンとニューヨークを訪問する機会を利用して、二つの F# に関する講演と Channel9 lecture about type providers の収録を行いました。他のすべての活動(しばしばパブで他の F#er を議論に巻き込んだり、朝まで長い睡眠)にもかかわらず、私はいくつかの講演に参加し果せました。

@mmozeiko
mmozeiko / win32_crt_float.cpp
Last active April 28, 2025 19:10
Visual C/C++ CRT functionality
extern "C"
{
int _fltused;
#ifdef _M_IX86 // following functions are needed only for 32-bit architecture
__declspec(naked) void _ftol2()
{
__asm
{
public static class ExpressionCombiner
{
public static Expression<Func<T, bool>> OrElse<T>(
params Expression<Func<T, bool>>[] expressions)
{
return OrElse(expressions.AsEnumerable());
}
public static Expression<Func<T, bool>> OrElse<T>(
this IEnumerable<Expression<Func<T, bool>>> expressions)
@vivmishra
vivmishra / dotnet-461-System.Transactions.cs
Created October 23, 2015 18:09
Sample for System.Transactions updates in .NET 4.6.1
using System;
using System.Transactions;
namespace YourNamespaceGoesHere
{
public class NonMSDTCPromoterEnlistment : IPromotableSinglePhaseNotification
{
Guid promoterType;
Guid distributedTxId;
Transaction enlistedTransaction;

.NET Coreコードリーディングことはじめ

このエントリはWindows & Microsoft技術 基礎 Advent Calendar 2015の6日目です。

.NETのトラブルシュートをしたり、実装に興味があったり、日々の仕事に疲れた心への癒やしとして、.NETの実装を見たいことがあると思います。このエントリでは、そういった方向けに簡単なガイドを提供します。

前提と対象

.NETの実装は色々あるのですが、この記事では.NET 5向けの実装についての話をします。それ以前のMicrosoft実装については、クラスライブラリ部分のみリファレンスソースとして公開されているので、そちらを参照すると良いでしょう(ランタイムそのもののソースコードは公開されていません)。ライセンスもMITライセンスなので安心です。ただし、クライアント側(Windows FormsやWPF)のコードはgithubには公開されておらず、Microsoftのサイトで公開されており、そのライセンスはMicrosoft Reference Source Licenseとなっていますので、デバッグや相互運用性の向上を目的としない使用には注意が必要です。XamarinやUnityで使っているMonoについては、素直にMonoのソースツリーを見ればいいでしょう。ただし、クラスライブラリはMITライセンスですが、ランタイムはLGPLなので、人によっては注意が必要かもしれません。

@ufcpp
ufcpp / 謎.cs
Last active August 24, 2016 06:58
どこかでこんな風になってる感じがする
using System;
using System.Threading.Tasks;
class Program
{
static void Main()
{
Console.WriteLine("begin");
// なんかどこかで誰かがこんな Post してる気配がなくもない
@CodaFi
CodaFi / AlgorithmW.swift
Last active March 3, 2025 20:39
A Swift Playground containing Martin Grabmüller's "Algorithm W Step-by-Step"
/// Playground - noun: a place where people can play
/// I am the very model of a modern Judgement General
//: # Algorithm W
//: In this playground we develop a complete implementation of the classic
//: algorithm W for Hindley-Milner polymorphic type inference in Swift.
//: ## Introduction