Skip to content

Instantly share code, notes, and snippets.

View neuecc's full-sized avatar

Yoshifumi Kawai neuecc

View GitHub Profile
public class MonoBehaviourSynchronizationContext : SynchronizationContext
{
object gate = new object();
Queue<KeyValuePair<SendOrPostCallback, object>> actionQueue = new Queue<KeyValuePair<SendOrPostCallback, object>>();
public MonoBehaviourSynchronizationContext(MonoBehaviour monoBehaviour)
{
monoBehaviour.StartCoroutine(Run());
}
using System;
using System.Net.Http;
using System.Reactive.Linq;
using System.Reactive.Threading.Tasks;
class Program
{
static void Main(string[] args)
{
new HttpClient().GetStringAsync("http://twitter.com/statuses/user_timeline.json")
@neuecc
neuecc / join.md
Last active August 29, 2015 14:05
join
@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
@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 / 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 / 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>();
}
@neuecc
neuecc / webconfig.xml
Last active August 29, 2015 14:15
なんちゃってうぇぶこん(これでいいのかは知らん)
<?xml version="1.0"?>
<!-- OWIN向けウェブコンいんちきテンプレセット -->
<configuration>
<configSections>
<section name="glimpse" type="Glimpse.Core.Configuration.Section, Glimpse.Core"/>
</configSections>
<appSettings>
<!-- なんかあれば -->