Skip to content

Instantly share code, notes, and snippets.

View ngohungphuc's full-sized avatar
🏡
Sài Gòn & Lelystad

Tony Ngo ngohungphuc

🏡
Sài Gòn & Lelystad
View GitHub Profile
github搜索EA7E Single User License
----- BEGIN LICENSE -----
Michael Barnes
Single User License
EA7E-821385
8A353C41 872A0D5C DF9B2950 AFF6F667
C458EA6D 8EA3C286 98D1D650 131A97AB
AA919AEC EF20E143 B361B1E7 4C8B7F04
B085E65E 2F5F5360 8489D422 FB8FC1AA
//for more detail please visit
//https://github.com/Awesome-CMS-Core/Awesome-CMS-Core/blob/master/src/AwesomeCMSCore/AwesomeCMSCore/webpack.config.js
const path = require("path");
const webpack = require("webpack");
const ExtractTextPlugin = require("extract-text-webpack-plugin");
const extractCSS = new ExtractTextPlugin("cmscore.css");
const CompressionPlugin = require("compression-webpack-plugin");
module.exports = {
entry: {
@ngohungphuc
ngohungphuc / DomainTemplateRoute - GetVirtualPath
Created August 1, 2018 04:38 — forked from maartenba/DomainTemplateRoute - GetVirtualPath
ASP.NET MVC 6 / ASP.NET 5 Domain Routing + Tenant Middleware
public string GetVirtualPath(VirtualPathContext context)
{
foreach (var matcherParameter in _matcher.Template.Parameters)
{
context.Values.Remove(matcherParameter.Name); // make sure none of the domain-placeholders are appended as query string parameters
}
return _innerRoute.GetVirtualPath(context);
}
module: {
rules: [{
test: /\.scss$/,
use: [
'style-loader',
MiniCssExtractPlugin.loader,
{
loader: "css-loader",
options: {
minimize: true,
plugins: [
new WebpackShellPlugin({
onBuildStart: ['echo "Starting"'],
onBuildEnd: ['postcss --dir wwwroot/dist wwwroot/dist/*.css']
})
],
npm install --save-dev cssnano webpack-shell-plugin
npm install postcss-cli --global
public abstract class BackgroundService : IHostedService, IDisposable
{
private Task task;
private readonly CancellationTokenSource cancellationTokens = new CancellationTokenSource();
protected abstract Task ExecuteAsync(CancellationToken stoppingToken);
public virtual Task StartAsync(CancellationToken cancellationToken)
{
public class ExampleGuidService : BackgroundService
{
public const string ExampleGuidsKey = "ExampleGuids";
private IMemoryCache memoryCache;
public ExampleGuidService(IMemoryCache memoryCache)
{
this.memoryCache = memoryCache;
}
private IMemoryCache memoryCache;
public HomeController(IMemoryCache memoryCache)
{
this.memoryCache = memoryCache;
}
public IActionResult Index()
{
if (!this.memoryCache.TryGetValue(ExampleGuidService.ExampleGuidsKey, out List<ExampleGuid> cacheEntry))
services.AddMemoryCache();
services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1);
services.AddSingleton<IHostedService, ExampleGuidService>();