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
// Bootstrap 4 dropdowns on hover | |
$('body').on('mouseenter', '.dropdown-on-hover', function (e) { | |
_d = $(e.target).closest('.dropdown>a'); | |
_d.dropdown('toggle'); | |
}); | |
$('body').on('mouseleave', '.dropdown-on-hover', function (e) { | |
var _d = $(e.target).prev('a'); | |
console.log(_d); | |
_d.dropdown('toggle'); | |
}); |
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.Globalization; | |
using System.Net; | |
using System.Net.Sockets; | |
using System.Text; | |
using System.Threading.Tasks; | |
namespace Socks | |
{ | |
public static class Socks5 |
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 static class DataFrameUtils | |
{ | |
public static void PrettyPrint(this DataFrame df) | |
{ | |
var sb = new StringBuilder(); | |
int width = GetLongestValueLength(df) + 4; | |
for (int i = 0; i < df.Columns.Count; i++) | |
{ |
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 Microsoft.Data.Analysis; | |
namespace TryingOutDataFrame | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ |
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
const axios = require("axios"); | |
const cheerio = require('cheerio'); | |
const covidmarocUrl = 'http://www.covidmaroc.ma/Pages/AccueilAR.aspx'; | |
const chromeUserAgent = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36'; | |
const moroccoPopulation = 36.79; | |
function cleanText(text) { | |
return text.replace(/\u200B/g, '').trim(); | |
} |
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 propertyGetter = DynamicExpressions.GetPropertyGetter<Product>(propertySentByUser); | |
// ^ can be cached or even compiled to a Func<Product, object> | |
var query = _dbContext.Products.AsQueryable().OrderBy(propertyGetter); | |
// Or OrderByDesceding |
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<Product> ApplyOrderBy(IQueryable<Product> query, string property) | |
{ | |
switch (property) | |
{ | |
case "Name": | |
return query.OrderBy(p => p.Name); | |
case "Quantity": | |
return query.OrderBy(p => p.Quantity); | |
case "Price": | |
return query.OrderBy(p => p.Price); |
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 query = _dbContext.Products.AsQueryable(); | |
query = ApplyOrderBy(query, propertySentByUser); |
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<Product> ApplyFilter(IQueryable<Product> query, string property, object value) | |
{ | |
switch (property) | |
{ | |
case "Name": | |
return query.Where(p => p.Name.Contains(value.ToString())); | |
case "Quantity": | |
return query.Where(p => p.Quantity >= value); | |
case "Price": | |
return query.Where(p => p.Price >= value); |
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 predicate = DynamicExpressions.GetPredicate<Product>(propertySentByUser, operatorSentByUser, valueSentByUser); | |
// ^ can also be cached or compiled and used anywhere | |
var products = _dbContext.Products.AsQueryable().Where(predicate).ToList(); | |
// ^ or FirstByDefault, Any, etc... |
OlderNewer