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
| <script type="text/x-dot-template" id="my-dot-template"> | |
| <p>Hello {{=it.Name}}!</p> | |
| <p>I see that you are from {{=it.City}} and you wear a {{=it.ShoeSize}} size shoe.</p> | |
| </script> |
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
| program HelloWorld(output); | |
| begin | |
| WriteLn('Hello world!') | |
| end. |
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
| <script language="JScript" runat="server" src="/Scripts/json2.js"></script> | |
| <% | |
| dim url | |
| url = "http://yoururl/jsonendpoint" | |
| Set HttpReq = Server.CreateObject("MSXML2.ServerXMLHTTP") | |
| HttpReq.open "POST", url, false | |
| HttpReq.setRequestHeader "Content-Type", "application/x-www-form-urlencoded" | |
| HttpReq.Send("Foo=bar") | |
| 'use json2 via jscript to parse the response |
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
| <% | |
| dim url | |
| url = "http://yoururl/jsonendpoint" | |
| Set HttpReq = Server.CreateObject("MSXML2.ServerXMLHTTP") | |
| HttpReq.open "POST", url, false | |
| HttpReq.setRequestHeader "Content-Type", "application/x-www-form-urlencoded" | |
| HttpReq.Send("Foo=bar") | |
| %> |
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
| using System; | |
| using System.Net; | |
| using System.Web.Mvc; | |
| using Mvc.Jsonp; | |
| namespace My.Controllers | |
| { | |
| [AuthFilter] | |
| public class SomeController : JsonpControllerBase | |
| { |
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
| $(document).ready(function() { | |
| $.ajax({ | |
| type: "GET", | |
| url: "http://exampleapi.com/jsonp", | |
| dataType: 'jsonp', | |
| crossDomain: true // forcing a cross domain request for demonstration, you can omit this | |
| }) | |
| .done(function(content) { | |
| console.log(content); | |
| }); |
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
| $(document).ready(function() { | |
| $.ajax({ | |
| type: "GET", | |
| url: "http://www.google.com", | |
| dataType: 'json', | |
| crossDomain: true // forcing a cross domain request for demonstration, you can omit this | |
| }) | |
| .done(function(content) { | |
| console.log(content); | |
| }); |
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
| Establish context = () => | |
| { | |
| }; | |
| Because of = () => | |
| { | |
| }; |
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
| // while I'm not actually relying on | |
| // PostSharp or any of my real service classes anywhere in my unit tests | |
| // I still need a service class to stand in and receive errors | |
| // that I can test assertions against | |
| public class FakeService : ServiceBase | |
| { | |
| public List<string> Errors { get; private set; } | |
| public FakeService() | |
| { | |
| Errors = new List<string>(); |
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
| [Serializable] | |
| [MulticastAttributeUsage(MulticastTargets.Method, TargetMemberAttributes = MulticastAttributes.Public)] | |
| public class ServiceErrorInterceptor : MethodInterceptionAspect | |
| { | |
| [NonSerialized] | |
| ServiceErrorConcern _concern; | |
| public static bool On = true; | |
| public override bool CompileTimeValidate(MethodBase method) |