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 (var client = new HttpClient()) | |
{ | |
var serializedBody = JsonConvert.SerializeObject(customerRequest); | |
var url = string.Format("{0}/{1}", ConfigurationManager.AppSettings["API_URL"], "customer"); | |
var response = await client.PostAsync(url, new StringContent(serializedBody, Encoding.UTF8, "application/json")); | |
var content = await response.Content.ReadAsStringAsync(); | |
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 controller = new TestController(); | |
var config = new HttpConfiguration(); | |
var request = new HttpRequestMessage(HttpMethod.Get, "http://localhost/api/test"); | |
var route = config.Routes.MapHttpRoute("default", "api/{controller}/{id}"); | |
var routeData = new HttpRouteData(route, new HttpRouteValueDictionary { { "controller", "test" } }); | |
controller.ControllerContext = new HttpControllerContext(config, routeData, request); | |
controller.Request = request; | |
controller.Request.Properties[HttpPropertyKeys.HttpConfigurationKey] = config; |
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 a page over http | |
Invoke-RestMethod -URI https://www.google.com -Method "GET" | |
# Post text content over http | |
Invoke-RestMethod -URI http://mvcsampleapp.apphb.com/Feedback -Body "Email=afsd&FirstName=sdfasdf&Surname=fasdfsd&Text=fasdfsdafsd" -ContentType "text/html" -Method POST | |
# Get a page over http specifying the IE proxey server | |
$Webproxy = (get-itemproperty 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings').ProxyServer | |
Invoke-RestMethod -URI https://www.google.com -Method "GET" -Proxy $Webproxy -UseDefaultCredentials |
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
# Read out proxy settings | |
$Webproxy = (get-itemproperty 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings').ProxyServer | |
# Wrapper method for Invokeing a rest method | |
function Invoke-Request { | |
Param( [string]$Method="GET", [string]$Body, [string]$Url ) | |
if($Method -eq "GET") { | |
return Invoke-RestMethod -Proxy $Webproxy -UseDefaultCredentials -URI $Url -Method "GET" | |
} else { |
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
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" /> | |
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild"> | |
<PropertyGroup> | |
<ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText> | |
</PropertyGroup> | |
<Error Condition="!Exists('$(SolutionDir)\.nuget\NuGet.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\.nuget\NuGet.targets'))" /> | |
</Target> |
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 bloodhound = new Bloodhound({ | |
datumTokenizer: Bloodhound.tokenizers.whitespace, | |
queryTokenizer: Bloodhound.tokenizers.whitespace, | |
remote: | |
{ | |
url: baseUrl + '?q=%QUERY', | |
wildcard: '%QUERY', | |
} | |
}); | |
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
USE AdeventureWorksDb | |
-- Set the datbase into simple mode which will truncate the log and close any connections | |
ALTER DATABASE AdeventureWorksDb | |
SET RECOVERY Simple; | |
GO | |
-- Shrink the file | |
DBCC SHRINKFILE('AdeventureWorksDb_Log') |
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
private IConnectionManager _connectionManager; | |
private ISubscriptionManager _subscriptionManager; | |
[SetUp] | |
public void SetUp() | |
{ | |
_connectionManager = MockRepository.GenerateStub<IConnectionManager>(); | |
_subscriptionManager = MockRepository.GenerateStub<ISubscriptionManager>(); | |
_connectionManager.Stub(x => x.Connections) |
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
'use strict' | |
// An empty JavaScript object | |
var myEmpty = {}; | |
// Create an object using object literals | |
var monkey = { name: "John", age: 23, color: "blue" }; | |
console.log(monkey.name) // John |
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
'use strict' | |
class Monkey { | |
constructor(name, color) { | |
this.color = color; | |
this.name = name; | |
} | |
} | |
var bert = new Monkey("albert", "red"); |