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
<!-- You can place this file in Shared/Components/Pager/Default.cshtml --> | |
@model PagedResultBase | |
@{ | |
var urlTemplate = Url.Action() + "?page={0}"; | |
var request = ViewContext.HttpContext.Request; | |
foreach (var key in request.Query.Keys) | |
{ | |
if (key == "page") |
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
protected override void OnModelCreating(ModelBuilder modelBuilder) | |
{ | |
modelBuilder.Entity<Posts>().HasQueryFilter(p => p.IsActive); | |
} | |
// To ignore default filter | |
var posts = db.Posts | |
.IgnoreQueryFilters() | |
.ToList(); |
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
var gulp = require("gulp"), | |
scss = require("gulp-sass"); | |
gulp.task("sass", function () { | |
return gulp.src('Styles/*.scss') | |
.pipe(scss.sync().on('error', scss.logError)) | |
.pipe(gulp.dest('wwwroot/css')); | |
}); | |
gulp.task('watch', function () { |
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
protected void Application_Start() | |
{ | |
var dbConfig = new Migrations.Configuration(); | |
var migrator = new DbMigrator(dbConfig); | |
migrator.Update(); | |
} |
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 Microsoft.Web.Http.Routing; | |
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Net.Http.Headers; | |
using System.Web.Http; | |
using System.Web.Http.Routing; | |
namespace USparkApi | |
{ |
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
First of all, you have to install Visual Studio Command Line Tool by | |
To install Visual Studio Command Line Tool is press | |
⌘ + ^ + p and type "Install 'code' command in PATH" | |
- Restart your shell if you use Mac Terminal or iTerm2 | |
or | |
- Restart your Visual Studio Code if you user Terminal in Visual Studio Code | |
After that, run "code --version" on your shell and see the result. |
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
Model.group(:foo).count(:bar).each_with_object({}) do |(key, value), memo| | |
#if you want to modify key | |
key = "modified_key" | |
memo[key] = value | |
end |
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
def assign_attributes(*arguments) | |
super | |
rescue ActiveRecord::UnknownAttributeError => e # Error that you get from activerecord | |
# do something here! | |
end |