This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private async static Task<object> HttpAsync() | |
{ | |
Stream input = new MemoryStream(Encoding.UTF8.GetBytes("message=hello")); | |
var httpHelper = new HttpHelper("https://api.example.com"); | |
var httpWebRequest = httpHelper.HttpWebRequest; | |
httpWebRequest.Method = "POST"; | |
if (input != null) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ProgressBar | |
{ | |
private int _lastOutputLength; | |
private readonly int _maximumWidth; | |
public ProgressBar(int maximumWidth) | |
{ | |
_maximumWidth = maximumWidth; | |
Show(" [ "); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<configuration> | |
<system.webServer> | |
<rewrite> | |
<rules> | |
<!-- Stage A: | |
A(enabled) B(enabled,negate) | |
Stage B: | |
A(enabled,negate) B(enabled) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <returns>returns null is doesn't have enough permission</returns> | |
public string[] HasPermissions(string accessToken, string[] permissions) | |
{ | |
try | |
{ | |
var fb = new FacebookClient(accessToken); | |
var remoteResult = ((IDictionary<string, object>)fb.Get("me/permissions")); | |
if (remoteResult != null && remoteResult.ContainsKey("data")) | |
{ | |
var data = remoteResult["data"] as IList<object>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var n = require('./Build/nJake/nJake'), | |
path = require('path'), | |
root = path.normalize(path.join(__dirname, '/')); | |
n.options.msbuild.version = 'net40'; | |
msbuild_config = 'Release'; | |
var version = { full: '5.2.0.0' }; | |
namespace('build', function () { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static string UrlDecode(string s) | |
{ | |
#if WINDOWS_PHONE | |
return System.Net.HttpUtility.UrlDecode(s); | |
#elif SILVERLIGHT | |
return System.Windows.Browser.HttpUtility.UrlDecode(s); | |
#else | |
// Since HttpUtility.UrlDecode doesn't exist in Client Framework | |
// get it from Mono. | |
// Thank god, mono libraries are licensed under MIT. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// install-package FluentHttp.Core | |
// install-package SimpleJson | |
// add as conditional symbol | |
// FLUENTHTTP_CORE_TPL;FLUENTHTTP_CORE_UTILS;FLUENTHTTP_HTTPBASIC_AUTHENTICATION;SIMPLE_JSON_DYNAMIC;SIMPLE_JSON_REFLECTIONEMIT | |
namespace ConsoleApplication1 | |
{ | |
using System; | |
using System.IO; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Target Name="Build" DependsOnTargets="CreateOutputDir"> | |
38 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cmd /C "WebpiCmd\WebpiCmd.exe /Install /AcceptEula /SuppressReboot /Products:WindowsInstaller31" | |
cmd /C "WebpiCmd\WebpiCmd.exe /Install /AcceptEula /SuppressReboot /Products:WindowsInstaller45" | |
# .NET | |
cmd /C "WebpiCmd\WebpiCmd.exe /Install /AcceptEula /SuppressReboot /Products:netframework2" | |
cmd /C "WebpiCmd\WebpiCmd.exe /Install /AcceptEula /SuppressReboot /Products:NETFramework35" | |
cmd /C "WebpiCmd\WebpiCmd.exe /Install /AcceptEula /SuppressReboot /Products:NETFramework4" | |
# IIS | |
cmd /C "WebpiCmd\WebpiCmd.exe /Install /AcceptEula /SuppressReboot /Products:IIS7" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace TaskIterationExtensions | |
{ | |
using System; | |
using System.Collections.Generic; | |
using System.Threading.Tasks; | |
/// <remarks> | |
// http://blogs.msdn.com/b/pfxteam/archive/2009/06/30/9809774.aspx | |
/// </remarks> | |
static class TaskIterationExtensions |