Skip to content

Instantly share code, notes, and snippets.

View ramazankanbur's full-sized avatar
🏠
Working from home

Ramazan ramazankanbur

🏠
Working from home
View GitHub Profile
public class HomeController : Controller
{
[MobileRedirect]
public IActionResult Index()
{
return View();
}
public IActionResult OnlyDesktop()
{
[Area("Mobile")]
[DesktopRedirect]
public class HomeController : Controller
{
public IActionResult Index()
{
return View();
}
}
using Microsoft.AspNetCore.Mvc.Filters;
using Wangkanai.Detection.Services;
namespace Mobile_Redirection_Subfolder
{
public class MobileRedirectAttribute : ActionFilterAttribute
{
public override void OnActionExecuting(ActionExecutingContext filterContext)
{
var path = filterContext.HttpContext.Request.Path.ToString();
using Microsoft.AspNetCore.Mvc.Filters;
using Wangkanai.Detection.Services;
namespace Mobile_Redirection_Subfolder
{
public class DesktopRedirectAttribute : ActionFilterAttribute
{
public override void OnActionExecuting(ActionExecutingContext filterContext)
{
var path = filterContext.HttpContext.Request.Path.ToString();
public class Startup
{
public Startup(IConfiguration configuration)
{
Configuration = configuration;
}
public IConfiguration Configuration { get; }
// This method gets called by the runtime. Use this method to add services to the container.
var symKey = Symbol();
var obj = {
[symKey]: 'symbol val',
a: 'val1',
b: 'val2',
};
console.log(obj);
//{ a: 'val1', b: 'val2', [Symbol()]: 'symbol val' }
//ES5
var PersonES5 = function(name) {
this.name = name;
this.walk();
};
PersonES5.prototype.walk = function () {
return 'pata pata';
};
//ES5
// lib/math.js
LibMath = {};
LibMath.sum = function (x, y) {
return x + y;
};
LibMath.pi = 3.141593;
// someApp.js
var math = LibMath;
//ES5
var obj = { a: 1 };
var list = [1];
var a = obj.a;
var b = obj.b === undefined ? 2 : obj.b;
var x = list[0];
var y = list[1] === undefined ? 2 : list[1];
console.log(a, b, x, y);
//output
//1 2 1 2
var obj = function fn1() {
return { x: 'val1', y: 12, z: 'val2' };
};
//ES5
var resES5 = obj();
var x = resES5.x;
var y = resES5.y;
var z = resES5.z;
console.log(x, y, z);
//output