Skip to content

Instantly share code, notes, and snippets.

View StillLearnin's full-sized avatar

Melvin Ray Herr StillLearnin

  • Pennsylvania, USA
View GitHub Profile
using AutoMapper;
using System;
using System.Collections.Generic;
namespace AutoMapper_Repro
{
class Program
{
static void Main(string[] args)
{
@StillLearnin
StillLearnin / gist:051f15aeceb84d86a0ae977564e1c19a
Created April 19, 2018 23:49 — forked from neoGeneva/gist:1878868
An OrderBy extension method for IQueryable that takes string
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(' ');
@StillLearnin
StillLearnin / Report_stateful.js
Created July 15, 2016 19:23
React Component as ES6 class with state.
import React from 'react';
import bindAll from 'lodash/bindAll';
class Report extends React.Component {
constructor() {
super();
this.state = {};
bindAll(this, 'click');
}
@StillLearnin
StillLearnin / Report.js
Created July 15, 2016 19:22
React Component (no state)
import React from 'react';
var styles = require('./index.css');
//selective destructuring allows us to access
//children without using this.props.children
function Report ({ children }) {
return <div className={styles.report}>
{children}
</div>;
}
@StillLearnin
StillLearnin / XamarinINotifyPropertyChanged.cs
Created May 25, 2016 21:21
INotifyPropertyChanged that works with Xamarin
public class INotifyImplementation : INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;
public virtual void OnPropertyChanged([CallerMemberName]string propertyName = null)
{
this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
}
@StillLearnin
StillLearnin / ListFilteredSorted.cs
Last active May 17, 2016 20:03
Wraps ObservableCollection and ListCollectionView into one object for ease of use.
public class ListFilteredSorted<T> : BaseInfo
{
public ListFilteredSorted()
{
Init();
}
public ListFilteredSorted(Predicate<object> filter)
{
FilterMethod = filter;