Skip to content

Instantly share code, notes, and snippets.

View udawtr's full-sized avatar

Wataru Uda udawtr

View GitHub Profile
@0liver
0liver / GoogleAnalyticsApi.cs
Last active February 12, 2025 17:32
C# wrapper around the Google Analytics Measurement Protocol API
/* based on the docs at: https://developers.google.com/analytics/devguides/collection/protocol/v1/devguide */
/*
* LICENSE: MIT
* AUTOHR: [email protected]
*/
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
@serge1
serge1 / create_zip.bat
Created April 15, 2013 16:45
Create ZIP files without specialized tools/utilities on Windows
cscript zip.vbs zip_file.zip file1.ext file2.ext file3.ext
@potix2
potix2 / gist:2291165
Created April 3, 2012 11:30
ASP.NET MVC3のController内でSessionが更新されていることをテストするためのコード(Moq使用)
//SEE: http://stackoverflow.com/questions/2916348/using-moq-to-set-indexers-in-c-sharp
[TestMethod]
public void IndexTest()
{
var mockHttpContext = new Mock<HttpContextBase>();
var mockSession = new Mock<HttpSessionStateBase>();
mockHttpContext.Setup(context => context.Session).Returns(mockSession.Object);
AppHttpContext.Current = () => mockHttpContext.Object;
var controller = new HomeController();
@ivasilov
ivasilov / C deserialization.cs
Created October 26, 2011 22:08
XML serialization
public Person Deserialize(string file)
{
XmlSerializer serializer = new XmlSerializer(typeof(Person));
Stream reader = new FileStream("myXmFile.xml", FileMode.Open);
Person temp=(Person)serializer.Deserialize(reader);
reader.Close();
return temp;
}