Skip to content

Instantly share code, notes, and snippets.

🏠
Working from home

Ody Mbegbu odytrice

🏠
Working from home
Block or report user

Report or block odytrice

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@odytrice
odytrice / map.cs
Created Jun 7, 2014
Simple Auto Mapper
View map.cs
public static class Extensions{
public void Assign(this object destination, object source)
{
if (source != null)
{
var destProperties = destination.GetType().GetProperties();
foreach (var sourceProperty in source.GetType().GetProperties())
{
foreach (var destProperty in destProperties)
{
@odytrice
odytrice / LinqBatch.cs
Created Sep 17, 2015
Batch Processing Operator for IQueryable and IEnumerables
View LinqBatch.cs
using System.Collections.Generic;
namespace System.Linq
{
public static class Extensions
{
#region IQueryable Extensions
public static IEnumerable<IQueryable<T>> Batch<T>(this IQueryable<T> query, int batchSize)
{
int count = query.Count();
View file.ts
/// <reference path="notification.ts" />
/// <reference path="../app.ts" />
module App.Services {
export class FileService {
static $inject = ["_notify", "$rootScope", "$q"];
scope: ng.IRootScopeService;
notify: NotifyService;
@odytrice
odytrice / IDataRepository.cs
Last active Dec 19, 2015
Interface for the DataRepository
View IDataRepository.cs
/// <summary>
/// An Abstraction for a Generic DataAccess Repoository
/// </summary>
public interface IDataRepository
{
/// <summary>
/// Get all Elements of Type T
/// </summary>
/// <typeparam name="T">Entity Type</typeparam>
/// <returns>DbSet of Entities</returns>
View ValueTask.cs
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.Collections.Generic;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Threading.Tasks;
@odytrice
odytrice / directives.html
Last active Mar 27, 2016
Javascript Paging Library using AngularJS and Lazy
View directives.html
<!-- STEP 1: Add This Script Markup to your Page.. This is the Template for the Pager -->
<!-- Pager Markup -->
<script id="od-pager.html" type="text/ng-template">
<ul class="pagination" ng-show="links().length > 1">
<li><a ng-click="prev()">&laquo;</a></li>
<li ng-class="{active:isCurrentPage(item)}" ng-repeat="item in links()"><a ng-click="goto(item)">{{item + 1}}</a></li>
<li><a ng-click="next()">&raquo;</a></li>
</ul>
</script>
@odytrice
odytrice / Curry.cs
Created May 12, 2016
Curry Function in C#
View Curry.cs
public static partial class Prelude
{
/// <summary>
/// Curry the function 'f' provided.
/// You can then partially apply by calling:
///
/// var curried = curry(f);
/// var r = curried(a)(b)
///
/// </summary>
View NinjectWeb.fs
namespace Ninject.Web
open Ninject.Modules
open Pocket.Core
open System
open System.Reflection
open System.Web.Mvc
open Ninject
open Microsoft.FSharp.Core.Operators
@odytrice
odytrice / directives.ts
Created Aug 2, 2016
Angular Typescript Directives and Utilities
View directives.ts
module App.Directives {
var Directive = function (): ng.IDirective {
return {
restrict: "A",
scope: {
location: "@navigate"
},
link: function (scope: any, el, attrs) {
el.click(function () {
document.location.href = scope.location;
@odytrice
odytrice / angular-paging.ts
Last active Aug 3, 2016
Angular Typescript Directives and Utilities
View angular-paging.ts
module App {
export class PagedList<T>{
private page: number;
private list: IList<T>;
private items: T[];
private itemsPerPage: number;
private numOfPages: number;
private count: number;
constructor(list: IList<T>, itemsPerPage = 10) {
You can’t perform that action at this time.