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 ($) { | |
/** | |
* jQuery extension to parse hash (#) in url, | |
* fill in values of input boxes with the specific ID's, | |
* and automatically update the values on address bar by | |
* monitoring the change/keyup events. | |
*/ | |
$.fn.autohash = function () { | |
// This extension is chainable |
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
// Usage: | |
// [AttributeUsage("Option1", "Option2", "Option3")] | |
// public string MyTestAttribute { get; set; } | |
// | |
// In view: | |
// @Html.DropDownListFor(x => x.MyTestAttribute) | |
// | |
// Result: | |
// Dropdown list with 3 options. |
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 enum ExpressionType | |
{ | |
GreaterThan, | |
Equal, | |
LessThan | |
} |
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 delegate IQueryable<T> QueryMutator<T>(IQueryable<T> item); | |
/// <summary> | |
/// Mutator class | |
/// </summary> | |
/// <typeparam name="TSearch">Predicate expression</typeparam> | |
/// <typeparam name="TQuery">Query expression if TSearch == true</typeparam> | |
public class SearchFieldMutator<TSearch, TQuery> | |
{ | |
public Predicate<TSearch> Condition { get; set; } |
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.Collections.Generic; | |
using System.Linq; | |
namespace EFCache | |
{ | |
public static class CacheExtensions | |
{ | |
private static ICacheProvider _provider; |
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 MyClass | |
{ | |
public void MyMethod() | |
{ | |
var x, y, z = MyReturnMethod(); | |
Console.WriteLine("{0} {1} {2}", x, y, z); | |
// 10 Hello <now> | |
var var1 = MyReturnMethod(); | |
Console.WriteLine(var1); |
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 Program | |
{ | |
static void Main(string[] args) | |
{ | |
var items = new IEnumerable<Item>().... // setup items | |
var test = new ParsingTest(items); | |
var list = test.MyParsingTest("OrderBy(x => x.Name).Skip(2).Take(3)"); | |
} | |
} |
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 AutoAssign() | |
{ | |
public Item GetItem() | |
{ | |
return new Item() { Name = "Hello", Id = 10, DateTime = DateTime.Now }; | |
} | |
public void Assign() | |
{ | |
var id, name = GetItem().Assign(); | |
Console.WriteLine("{0} {1}", id, 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 partial class MainPage : PhoneApplicationPage | |
{ | |
private readonly RotateTransform _rotateTransform; | |
private TranslateTransform _translateTransform; | |
// Constructor | |
public MainPage() | |
{ | |
InitializeComponent(); |
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 links = document.getElementsByTagName('a'); | |
for(var i = 0; i < links.length; i++) { | |
var thisLink = links[i]; | |
if(thisLink.getAttribute('href') == '#') { | |
thisLink.onclick = (function(e){ | |
var origClick = thisLink.onclick; | |
return function(e) { | |
var page_y; | |
window.onscroll = function(){ | |
window.scrollTo(0, page_y); |