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 static class ObjectExtensions | |
{ | |
public static IEnumerable<T> ToMaybe<T>(this T obj) | |
{ | |
return Equals(obj,null) ? Enumerable.Empty<T>() : new[] {obj}; | |
} | |
} |
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
#!/bin/sh | |
baseurl=http://mygitlaburl | |
usermail=adminuser@mymailserver | |
userpass=adminpassword | |
repo_access=2 #0=denied 1=read 2=read&write | |
project_access=2 #0=deined 1=read 2=report 3=admin | |
# login | |
curl -s -I -c cookies.txt -d "utf8=✓&user[email]=$usermail&user[password]=$userpass&commit=Sign+in" $baseurl/users/sign_in |
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
/* Initialize bus. In this case via Autofac */ | |
builder.RegisterModule(new RabbitModule | |
{ | |
HostName = "localhost", | |
UserName = "user", | |
Password = string.Empty, | |
Exchanges = { | |
new Exchange("exchange1"){Durable=true;}, | |
new Exchange("exchange2"){Durable=true;} | |
} |
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
static class ObjectDiff | |
{ | |
static IEnumerable<Member> GetMembers(object obj) | |
{ | |
foreach(var propertyInfo in obj.GetType().GetProperties().Where(p => p.CanRead)) | |
{ | |
var info = propertyInfo; | |
yield return new Member | |
{ | |
Name = info.Name, |
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 JsonWithHtmlMediaTypeFormatter : JsonMediaTypeFormatter | |
{ | |
public JsonWithHtmlMediaTypeFormatter() | |
{ | |
SupportedMediaTypes.Add(new MediaTypeHeaderValue("text/html")); | |
} | |
public override void SetDefaultContentHeaders(Type type, HttpContentHeaders headers, string mediaType) | |
{ | |
base.SetDefaultContentHeaders(type, headers, mediaType); |
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
Kudu.SiteManagement/SiteManager.cs | 31 ++++++++++++++++++------------- | |
1 file changed, 18 insertions(+), 13 deletions(-) | |
diff --git a/Kudu.SiteManagement/SiteManager.cs b/Kudu.SiteManagement/SiteManager.cs | |
index 43a6012..87b466d 100644 | |
--- a/Kudu.SiteManagement/SiteManager.cs | |
+++ b/Kudu.SiteManagement/SiteManager.cs | |
@@ -6,12 +6,15 @@ | |
using System.Net.NetworkInformation; | |
using System.Threading; |
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 OutOfMemoryTest | |
{ | |
public void Run() | |
{ | |
// client version 1.2.2127 | |
using(var store = new DocumentStore | |
{ | |
Url = "http://TestRaven:8080", | |
DefaultDatabase = "Test", | |
}) |
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
(function() { | |
"use strict"; | |
// constructor function - but R# Name dose not match rule 'Local Variable'. Suggested name is app. | |
var App = function() { | |
// ... | |
}; | |
ko.applyBindings(new App()); | |
})(); |
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
class Mutable { | |
} | |
[Immutable] | |
public class ImmutableB | |
{ | |
public readonly A = new ImmutableA(); | |
} |
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 data = []; | |
exampleFeeds.forEach(function(feedFile) { | |
fs.createReadStream(feedFile) | |
.pipe(new FeedParser()) | |
.on('meta', function(meta) { | |
data.push(meta); | |
if(data.length===exampleFeeds.length){ | |
console.log('done '+data.length); | |
// do something | |
} |
OlderNewer