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 Flash : DynamicObject | |
{ | |
private readonly TempDataDictionary _store; | |
private const string KeyPrefix = "Flash"; | |
public Flash(TempDataDictionary store) | |
{ | |
_store = store; | |
} |
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
module RawSqlUtil | |
def sql_select(sql, params) | |
# We have to do this weirdness because sanitize_sql_array is a protected method | |
query = ActiveRecord::Base.send(:sanitize_sql_array, [sql].concat(params)) | |
ActiveRecord::Base.connection.select_all(query) | |
end |
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; | |
using System.Text; | |
using System.Data.SqlClient; | |
using Dapper; | |
// to have a play, install Dapper.Rainbow from nuget |
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 IndexlessEnumerableModelBinder<TItemType> : DefaultModelBinder | |
where TItemType : class | |
{ | |
protected override void BindProperty(ControllerContext controllerContext, ModelBindingContext bindingContext, PropertyDescriptor propertyDescriptor) | |
{ | |
if (typeof(IEnumerable<TItemType>).IsAssignableFrom(propertyDescriptor.PropertyType)) | |
{ | |
var nameOfPropertyToBind = propertyDescriptor.Name; | |
var form = controllerContext.HttpContext.Request.Form; |
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
I found example 2 on the web but it was not exactly what i needed. so.. I put together example 1. | |
C# Example 1 | |
public void VerifyTable(string header, string expected) | |
{ | |
IWebElement table = _driverWithJs.FindElement(By.XPath("//div[@id='main']/table")); | |
ReadOnlyCollection<IWebElement> allRows = table.FindElements(By.TagName("tr")); |
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
/* If you've ever had the need to link directly to an open modal window with Bootstrap, here's a quick and easy way to do it: | |
Make sure your modal has an id: | |
<div class="modal" id="myModal" ... > | |
Then stick this bit of Javascript at at the end of your document: | |
*/ | |
$(document).ready(function() { |
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; | |
using System.Text; | |
using System.Text.RegularExpressions; | |
using System.Collections.Concurrent; | |
using System.Linq.Expressions; | |
using System.Collections; | |
namespace ExpressionParser { |
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 ($) { | |
$.fubuvalidation.Processor.findElementsWith(function(context) { | |
var element = $("#" + context.key, context.form); | |
if (element.size() == 0) { | |
return; | |
} | |
context.element = element; | |
}); | |
$.fubuvalidation.Processor.findElementsWith(function(context) { | |
var element = $("[name=" + context.key + "]", context.form); |
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
// If using FubuAthentication, update auth ticket as needed (e.g. account creation or key updated) | |
private readonly IAuthenticationSession _auth; | |
public SomeController(IAuthenticationSession auth) { _auth = auth; } | |
_auth.MarkAuthenticated(user.Email); | |
// If using FubuAuthentication, make route available to anonymous users | |
[NotAuthenticated] | |
public FubuContinuation SomeRoute(SomeRouteInputModel input) | |
{ | |
// Use a continuation to redirect to input-less page |
OlderNewer