Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@ChiiAyano
ChiiAyano / MainPage.xaml
Created August 2, 2017 14:21
AccessViolationException で死ぬコード
<Page
x:Class="App11.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:App11"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
@ChiiAyano
ChiiAyano / gist:04c5057206390931b12c
Created December 23, 2014 12:05
これじゃダメだわな
public static IEnumerable<HogeCategory> CreateDummyCategories()
{
var result = Enumerable.Range(0, 5)
.Select(s => new HogeItemCategory
{
Name = string.Format("Dummy {0:00}", s),
Items = Enumerable.Range(1, 10)
.Select(t => new HogeItem
{
ID = (10 * s) + t,
private async static void DelayTest()
{
for (int i = 0; i < 1000; i += 10)
{
Console.WriteLine("Delay Start! Delay Time: " + i);
var delay1Time = DateTime.Now;
await Task.Delay(i);
Console.WriteLine("OK Time: " + (DateTime.Now - delay1Time).TotalMilliseconds);
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Net;
namespace ConsoleApplication3
{
class Program
public async Task<HttpResponseMessage> SendAsync(IDictionary<string, object> parameter, AsyncOAuth.AccessToken accessToken, string footer)
{
var client = new HttpClient();
var boundary = DateTime.Now.ToString("MMddHHmmss") + new Random().Next().ToString();
var content = new MultipartFormDataContent(boundary);
foreach (var item in parameter)
{
if (item.Value is string)
{
content.Add(new StringContent(item.Value as string), "\"" + this.MessageKeyName + "\"");
protected async Task<IEnumerable<byte>> CreateMultipartFormData(IDictionary<string, object> parameter, string boundary)
{
var dataBytes = new List<byte>();
foreach (var p in parameter)
{
dataBytes.AddRange(Encoding.UTF8.GetBytes("--" + boundary + "\r\n"));
if (p.Value is Stream)
{
@ChiiAyano
ChiiAyano / sony2013_1.cs
Created February 6, 2012 14:21
SONY "GO FOR IT" Q.1
// License: BSD
using System;
namespace LifeClock
{
class Program
{
static void Main(string[] args)
{
int n = 80;