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
class UberQueue<T> | |
{ | |
private IAsyncQueue<T>[] _queues; | |
private Task<T>[] _tasks; | |
public UberQueue(IAsyncQueue<T>[] queues) | |
{ | |
_queues = queues; | |
} |
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
/// <binding ProjectOpened='watch' /> | |
module.exports = function (grunt) { | |
grunt.initConfig({ | |
bower: { | |
install: { | |
options: { | |
targetDir: "lib", | |
layout: "byComponent", | |
cleanTargetDir: false | |
} |
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
using System; | |
using System.Net.Http; | |
using System.Threading.Tasks; | |
using System.Web.Http; | |
using Http = System.Net.WebRequestMethods.Http; | |
namespace PhilsVersion | |
{ | |
public class ProxyController : ApiController | |
{ |
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 class ObjectQueryExtensions | |
{ | |
public static ObjectQuery<T> FullTextSearch<T, TProperty>(this ObjectQuery<T> query, Expression<Func<T, TProperty>> propertyExpression, string searchText) | |
{ | |
var path = string.Join(".", propertyExpression.ToString().Split('.').Skip(1)); | |
return query.Where(string.Format("CONTAINS(it.{0}, @search_text)", path), new ObjectParameter("search_text", searchText)); | |
} | |
} |
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 MvcHtmlString EditorForInherited<TModel, TProperty>(this HtmlHelper<TModel> htmlHelper, Expression<Func<TModel, TProperty>> expression) | |
{ | |
if (htmlHelper.ViewContext.ViewData.Model == null) | |
return htmlHelper.EditorFor(expression); | |
var modelType = htmlHelper.ViewContext.ViewData.Model.GetType(); | |
if (modelType == typeof(TModel)) | |
return htmlHelper.EditorFor(expression); |
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 IQueryable<T> OrderBy<T>(this IQueryable<T> source, string sortExpression) | |
{ | |
if (source == null) | |
throw new ArgumentNullException("source", "source is null."); | |
if (string.IsNullOrEmpty(sortExpression)) | |
throw new ArgumentException("sortExpression is null or empty.", "sortExpression"); | |
var parts = sortExpression.Split(' '); |
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 createEvent = function() { | |
var _handlers = []; | |
return function() { | |
if (arguments.length === 1 && typeof arguments[0] === 'function') { | |
_handlers.push(arguments[0]); | |
return; | |
} | |
for (var i = 0; i < _handlers.length; ++i) { |
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 Encoding GetFileEncoding(string path) | |
{ | |
if (path == null) | |
throw new ArgumentNullException("path"); | |
var encodings = Encoding.GetEncodings() | |
.Select(e => e.GetEncoding()) | |
.Select(e => new { Encoding = e, Preamble = e.GetPreamble() }) | |
.Where(e => e.Preamble.Any()) | |
.ToArray(); |
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 createProperty = function(getSet) { | |
var _value; | |
var autoImplement = { | |
get: function() { return _value; }, | |
set: function(value) { _value = value; return _value; } | |
}; | |
getSet = getSet || autoImplement; | |
var get = getSet.get || function() { throw new Error('No get method defined for this property.'); }, |
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
// This code is provided "as-is" without warranty of any kind, either expressed or implied. | |
public static class AsyncExtensions | |
{ | |
public static async Task<IEnumerable<T>> AsAsync<T>(this IQueryable<T> source) | |
where T : EntityObject | |
{ | |
var query = (ObjectQuery<T>)source; | |
var cmd = new SqlCommand(); |
NewerOlder