Skip to content

Instantly share code, notes, and snippets.

View nportelli's full-sized avatar

Nick Portelli nportelli

View GitHub Profile
@jermdavis
jermdavis / BasePipelineTypes.cs
Last active December 20, 2021 16:08
An example of strongly typed data pipelines, with some trivial examples
using System;
namespace StronglyTypedPipelines
{
/// <summary>
/// Base type for individual pipeline steps.
/// Descendants of this type map an input value to an output value.
/// The input and output types can differ.
/// </summary>
@rnagle
rnagle / ChartView.js
Created March 7, 2014 19:17
ChartView.js
/**
* Original author: David Eads (https://github.com/eads)
*
* Wrap D3 charting components in a simple Backbone view interface
*
* Provides a redrawing path, data sync, and fallback for non-d3 browsers.
*
* Views that extend ChartView should implement their own "draw" function and go to work.
*
* var collection = new Backbone.Collection([ ["Maria", 33], ["Heather", 29] ]);
@gregoryyoung
gregoryyoung / gist:7690486
Created November 28, 2013 11:31
updated to support actions to funcs
namespace crap
{
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
public class PartialAppPlayground
@mjeaton
mjeaton / ThroatPunchList.md
Last active August 13, 2024 20:46
Jerk faces who need to receive throat punches

On October 30, 2023, the Throat Punch List turned 10! In honor of that occasion, I'm putting some old favorites back on the list!

  1. Chad Green
  2. Jeff Fritz
  3. Anyone that uses ask as a noun or that says stuff like "solutioning a problem"
  4. Jim Holmes
  5. Darby
  6. Strauss
  7. JB
@alexbeletsky
alexbeletsky / Feedback.js
Created December 18, 2012 19:07
Backbone.View done with TDD
var Feedback = Backbone.Model.extend({
url: '/feedback',
validate: function (attrs) {
var errors = [];
if (!attrs.email || attrs.email === '') {
errors.push({name: 'email', message: 'Please fill email field.'});
}
@ferventcoder
ferventcoder / 1_UserRepositoryLinqService.cs
Last active October 6, 2015 13:17
RepositoryPattern with Linq Query Services
namespace SomeProject.Infrastructure.App.Services
{
/// <summary>
/// Houses the queries against users in the database
/// </summary>
public class UserRepositoryService : BaseRepositoryService<User>, IUserRepositoryService
{
private readonly IDateTimeService _dateTimeService;
/// <summary>
@mscorlib
mscorlib / IQueryableExtensions.cs
Created May 25, 2012 05:51 — forked from leniency/IQueryableExtensions.cs
Modifications to allow CamelCase.NestedProperties
/// <summary>
/// Provides projection mapping from an IQueryable sourceto a target type.
///
/// This allows from strongly-typed mapping and querying only necessary fields from the database.
/// It takes the place of Domain -> ViewModel mapping as it allows the ViewModel to stay as
/// IQueryable. AutoMapper works on in-memory objects and will pull all full records to perform
/// a collection mapping. Use AutoMapper for Input -> Domain scenarios, but not DAL.
///
/// Reference: http://devtrends.co.uk/blog/stop-using-automapper-in-your-data-access-code
/// </summary>
@ferventcoder
ferventcoder / EnumerationExtensions.cs
Created April 4, 2012 19:04
MVC Html DropDownListHelper
public static class EnumerationExtensions
{
public static IEnumerable<SelectListItem> GetEnumerationItems(this Enum enumeration)
{
var listItems = Enum
.GetValues(enumeration.GetType())
.OfType<Enum>()
.Select(e =>
new SelectListItem()
{
@leniency
leniency / IQueryableExtensions.cs
Created August 1, 2011 22:31
Modifications to allow CamelCase.NestedProperties
/// <summary>
/// Provides projection mapping from an IQueryable sourceto a target type.
///
/// This allows from strongly-typed mapping and querying only necessary fields from the database.
/// It takes the place of Domain -> ViewModel mapping as it allows the ViewModel to stay as
/// IQueryable. AutoMapper works on in-memory objects and will pull all full records to perform
/// a collection mapping. Use AutoMapper for Input -> Domain scenarios, but not DAL.
///
/// Reference: http://devtrends.co.uk/blog/stop-using-automapper-in-your-data-access-code
/// </summary>