This file contains hidden or 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
| C:\Users\prabir\AppData\Local\GitHub\PortableGit_8810fd5c2c79c73adcc73fd0825f3b32fdb816e7\bin\sh.exe --login -i | |
| C:\Users\Prabir\ConEmuPack\ConEmu64.exe,0 |
This file contains hidden or 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 CassetteBundleConfiguration : IConfiguration<BundleCollection> | |
| { | |
| private readonly string rootPath; | |
| public CassetteBundleConfiguration() | |
| { | |
| this.rootPath = HostingEnvironment.MapPath("~/"); | |
| //this.rootPath = rootPathProvider.GetRootPath(); | |
| } |
This file contains hidden or 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
| [Fact] | |
| public void AdditionTest() { | |
| // given | |
| int a = 1; | |
| int b = 2; | |
| // when | |
| var result = Math.Add(a, b); | |
| // then |
This file contains hidden or 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 httphelper -pre | |
| // install-package simplejson | |
| #define SIMPLE_JSON_DYNAMIC | |
| public static object Get(string url) | |
| { | |
| var httpHelper = new HttpHelper(url); | |
| using (var stream = httpHelper.OpenRead()) |
This file contains hidden or 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 SampleModule : NancyModule { | |
| public SampleModule() { | |
| Post["/"] = x => { | |
| var person = this.Bind<Person>(); | |
| this.Validate(person); | |
| if(!this.ModelValidationResult.IsValid) | |
| return 400; | |
| return 200; | |
| } | |
| } |
This file contains hidden or 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
| // advanced | |
| public class FacebookSubscriptionModule : NancyModule { | |
| public FacebookSubscriptionModule() { | |
| Get["/"] = | |
| _ => Response.AsFacebookGetSubscriptionResponse("app_secret", "verify_token"); | |
| Post["/"] = x => { | |
| _ => Response.AsFacebookPostSubscriptionResponse("app_secret", x => { | |
| }); |
This file contains hidden or 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 object DoSomething(string jsonString) { | |
| var json = DeserializeJson(jsonString); | |
| var dict = json as IDictionary<string, object>; | |
| if(dict == nul) { | |
| // use another serializer to normalize the json | |
| // and set dict. | |
| } else { | |
| // DeserializeJson worked so do nothing. | |
| } |
This file contains hidden or 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 ConsoleApplication4 | |
| { | |
| using System; | |
| using System.Collections.Generic; | |
| using ConsoleApplication4.Reflection; | |
| using Newtonsoft.Json; | |
| class Program | |
| { |
This file contains hidden or 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
| Get["/{rss?html}"] = x => { | |
| var articles = new List<Article>(); | |
| return Negotiate | |
| .WithModel(articles) | |
| .WithMediaRangeModel("application/xml", articles).WithView("articles/rss/xml/index") | |
| .WithMediaRangeModel("application/javascript", articles).WithView("articles/rss/jsonp/index") | |
| .WithMediaRangeModel("application/json", articles).WithView("articles/rss/json/index") | |
| .WithMediaRangeModel("text/html", articles).WithView("articles/article"); |
This file contains hidden or 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 FB = require('fb') | |
| Step = require('step'); | |
| function fbnodify (res) { | |
| if(!res || res.error) throw new Error(JSON.stringify(res)); | |
| this(null, res); | |
| } | |
| function fbnodifybatch (res) { | |
| if(!res || res.error) throw new Error(JSON.stringify(res)); |