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 LinkedInController : Controller | |
{ | |
public RedirectResult Profile() | |
{ | |
var redirectUrl = "http://mydomain/linkedin/profilereturn/"; | |
var url = GetAuthorizationUrl(redirectUrl); | |
return Redirect(url.ToString()); | |
} | |
public ActionResult ProfileReturn(string code, string state) |
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
DECLARE @sql NVARCHAR(max), @selects NVARCHAR(max) | |
SET @sql = 'SELECT '; | |
SET @selects = ''; | |
SELECT @selects = COALESCE(@selects + ', ', '') + ' (SELECT COUNT(DISTINCT O.OrderID) | |
FROM Orders O | |
WHERE O.CustomerID = C.CustomerID | |
AND O.OrderDate BETWEEN ''' + convert(NVARCHAR(MAX), [start_date], 102) + | |
''' AND ''' + convert(NVARCHAR(MAX), [end_date], 102) + ''' ) AS [' + [date_text] + ']' + CHAR(13) | |
FROM #dates ; |
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 MongoDatabase Connect(string connectionString) | |
{ | |
if (string.IsNullOrWhiteSpace(connectionString)) | |
throw new System.ArgumentNullException("invalid connection string"); | |
var mongoConnStr = MongoUrl.Create(connectionString); | |
MongoClient client = new MongoClient(mongoConnStr); | |
MongoServer server = client.GetServer(); | |
if (server.State == MongoServerState.Disconnected) |
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 PagedCollection<TEntity> Read<TEntity>(string collectionName, | |
IMongoQuery query, IMongoSortBy sortBy, IMongoFields fields, | |
int page, int pageSize) | |
{ | |
var connectionString = "....."; | |
MongoDatabase db = Connect(connectionString); | |
MongoCollection coll = db.GetCollection<TEntity>(collectionName); | |
MongoCursor<TEntity> foundItems = (null == query) ? coll.FindAllAs<TEntity>() : coll.FindAs<TEntity>(query); | |
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 filename = "config.json"; | |
var providerName = "json"; | |
var configName = "myConfig"; | |
dynamic config = Config.Load(providerName, configName, filename); |
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
myApp.directive('callbackDirective', function () { | |
return { | |
scope: { | |
callback: '&' | |
}, | |
restrict: 'E', | |
templateUrl: 'my-template.html' | |
controller: ['$scope', function ($scope) { | |
$scope.foo = function () { | |
if ($scope.callback) { |
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
myApp.directive('callbackDirective', function () { | |
return { | |
scope: { | |
callback: '&' | |
}, | |
restrict: 'E', | |
templateUrl: 'my-template.html' | |
controller: ['$scope', function ($scope) { | |
$scope.foo = function (bar) { | |
if ($scope.callback) { |
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 interface IMyInterface | |
{ | |
// blah | |
} | |
public class MyClass | |
{ | |
public IEnumerable<IMyInterface> TheItems { get; set; } | |
} |
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 myClassInstance = new MyClass(); | |
// blah | |
string jsonData = JsonConvert.SerializeObject(myClassInstance, Formatting.Indented, new JsonSerializerSettings | |
{ | |
TypeNameHandling = TypeNameHandling.Objects, | |
TypeNameAssemblyFormat = System.Runtime.Serialization.Formatters.FormatterAssemblyStyle.Simple | |
}); |
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 myClassInstaceDeserialized = JsonConvert.DeserializeObject<MyClass>(jsonData, new JsonSerializerSettings | |
{ | |
TypeNameHandling = TypeNameHandling.Objects | |
}); |
OlderNewer