Skip to content

Instantly share code, notes, and snippets.

View neuecc's full-sized avatar

Yoshifumi Kawai neuecc

View GitHub Profile
@neuecc
neuecc / Zip.ps1
Last active August 29, 2015 14:05
Zip.ps1
# emptyの時にnull返しちゃうけど要素の型取れないしshoganai
# enumeratorをDisposeしない(ちゃんとしよふ)
$first = @(1, 2,3)
$second = @(5, 6,7, 10)
$e1 = $first.GetEnumerator()
$e2 = $second.GetEnumerator()
$list = $null
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections.ObjectModel;
using System.Collections.Specialized;
using UniRx;
namespace UniRx
{
@neuecc
neuecc / AspNetSynchtonizationContext.cs
Created September 29, 2014 16:35
AspNetSynchtonizationContext.cs
async Task Hoge()
{
Debug.WriteLine(System.Web.HttpContext.Current == null); // false
await Task.Delay(TimeSpan.FromMilliseconds(100)).ConfigureAwait(false); // キャプチャしない
Debug.WriteLine(System.Web.HttpContext.Current == null); // true
}
public async Task<ActionResult> Index()
@neuecc
neuecc / concept.txt
Last active August 29, 2015 14:10
LINQ to BigQuery's concept
LINQ to BigQuery's concept and mention of following tree.
https://github.com/neuecc/LINQ-to-BigQuery
https://twitter.com/headinthebox/status/539169524999012354
IQueryable isn't necessary for LINQ to translate SQL.
I need all BigQuery's sql can write LINQ to BigQuery.
All specialized sql can execute, all function can execute(include window function).
(BigQuery's SQL different with standard Sql https://developers.google.com/bigquery/query-reference
I must support Multiple FROM, WITHIN, JOIN EACH, GROUP EACH BY, FLATTEN, IGNORECASE, etc)
@neuecc
neuecc / AddDataMemberWithOrderCodeRefactoringProvider.cs
Created December 7, 2014 14:36
AddDataMemberWithOrderCodeRefactoringProvider
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CodeActions;
using Microsoft.CodeAnalysis.CodeRefactorings;
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using System.Collections.Generic;
using System.Composition;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
@neuecc
neuecc / AsynchronousLINQ.cs
Created December 9, 2014 10:07
AsynchronousLINQ
static IObservable<string> ReadLineAsObservable(string fileName)
{
return Observable.Create<string>(async observer =>
{
try
{
using (var sr = new StreamReader(fileName))
{
string s;
while ((s = await sr.ReadLineAsync().ConfigureAwait(false)) != null)
@neuecc
neuecc / KillWPF.cs
Last active August 29, 2015 14:11
殺害コード.cs
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
async void MyVoidAsync1()
{
await Task.Delay(TimeSpan.FromSeconds(1)).ConfigureAwait(false);
MyVoidAsync2();
@neuecc
neuecc / 答え合わせ.cs
Last active July 23, 2017 14:28
async void is 危険
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
public void button_Click(object sender, EventArgs e)
{
MyVoidAsync1();
@neuecc
neuecc / Parallel.StringBuilder.cs
Created December 23, 2014 17:14
Parallel.StringBuilder
using System.Linq;
using System.Text;
using System.Threading.Tasks;
class Program
{
static void Main(string[] args)
{
var result = new StringBuilder();
Parallel.ForEach(Enumerable.Range(1, 1000000), () => new StringBuilder(), (x, option, sb) =>
@neuecc
neuecc / antiaot.cs
Created January 15, 2015 17:51
antiaot.cs
// https://github.com/neuecc/UniRx/blob/992c84b0aa5be67323817db7d443bc62c7b49524/Assets/UniRx/Scripts/Observable.Concatenate.cs#L331
var queues = new Queue<T>[length];
for (int i = 0; i < length; i++)
{
queues[i] = new Queue<T>();
}