This file contains 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 IQueryable<T> FindBy(Expression<Func<T, bool>> predicate, params Expression<Func<T, object>>[] includes) | |
{ | |
var query = GetAll().Where(predicate); | |
return includes.Aggregate(query, (current, includeProperty) => current.Include(includeProperty)); | |
} | |
// Sample usage | |
userRepository.FindBy(x => x.Username == username, x.Roles) |
This file contains 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
#!/usr/bin/php | |
<?php | |
/** | |
* .git/hooks/pre-commit | |
* | |
* This pre-commit hooks will check for PHP error (lint), and make sure the code | |
* is PSR compliant. | |
* | |
* Dependecy: PHP-CS-Fixer (https://github.com/fabpot/PHP-CS-Fixer) | |
* |
This file contains 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.Diagnostics.Contracts; | |
using System.Runtime.CompilerServices; | |
public static class SpanSplitExtensions | |
{ | |
public ref struct Enumerable1<T> where T : IEquatable<T> | |
{ | |
public Enumerable1(ReadOnlySpan<T> span, T separator) | |
{ |
This file contains 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
/** | |
* Easing functions | |
* | |
* https://gist.github.com/gre/1650294 | |
* http://easings.net | |
*/ | |
// no easing, no acceleration | |
export function easeLinear(t){ return t } | |
// accelerating from zero velocity | |
export function easeInQuad(t){ return t*t } |