Skip to content

Instantly share code, notes, and snippets.

View joaofx's full-sized avatar
😁

Joao Carlos Clementoni joaofx

😁
View GitHub Profile
using System;
using System.Collections.Generic;
using FubuCore.Reflection;
using FubuMVC.Core.UI.Configuration;
using HtmlTags;
using MyProject.Core.Infrastructure.Extensions;
namespace MyProject.Core.Infrastructure.Fubu.HtmlConventions
{
public class EnumRadioButtonListEditor : ElementBuilder
@MrDys
MrDys / gist:3512455
Created August 29, 2012 13:26
Link directly to an open modal window in Bootstrap
/* 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() {
@raygt
raygt / gist:3138501
Created July 18, 2012 19:59
Selenium 2 Webdriver Iterating Table
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"));
@roryf
roryf / IndexlessEnumerableModelBinder.cs
Created March 29, 2012 16:09
An ASP.NET MVC ModelBinder for binding form values of the form name[].property rather than name[index].property. Assumes form values are POSTed in markup order, unsure if this is always true.
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;
@SamSaffron
SamSaffron / gist:1599013
Created January 12, 2012 05:59
dapper.rainbow
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
@amcclosky
amcclosky / raw_sql_util.rb
Created January 9, 2012 21:32
Simple Rails lib for executing raw SQL
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
@roryf
roryf / Flash.cs
Created July 27, 2011 15:19
Flash message implementation for ASP.NET MVC
public class Flash : DynamicObject
{
private readonly TempDataDictionary _store;
private const string KeyPrefix = "Flash";
public Flash(TempDataDictionary store)
{
_store = store;
}