Skip to content

Instantly share code, notes, and snippets.

View HamedFathi's full-sized avatar
🌎

Hamed Fathi HamedFathi

🌎
View GitHub Profile
@HamedFathi
HamedFathi / index.html
Last active April 23, 2020 08:43
Au2EmotionAttr
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Dumber Gist</title>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1.0, user-scalable=no">
<base href="/">
</head>
<!--
Dumber Gist uses dumber bundler, the default bundle file
@HamedFathi
HamedFathi / ArrayDeconstructionExtensions.cs
Created June 11, 2020 15:36 — forked from waf/ArrayDeconstructionExtensions.cs
Add deconstruction (i.e. destructuring) syntax support for arrays for C# 7
using System;
using System.Linq;
namespace Extensions
{
/// <summary>
/// Allow the up to the first eight elements of an array to take part in C# 7's destructuring syntax.
/// </summary>
/// <example>
/// (int first, _, int middle, _, int[] rest) = new[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
@HamedFathi
HamedFathi / index.html
Last active June 17, 2020 17:27
ripple-au2
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Dumber Gist</title>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1.0, user-scalable=no">
<base href="/">
</head>
<!--
Dumber Gist uses dumber bundler, the default bundle file
const postcss = require('postcss')
module.exports = {
theme: {
extend: {}
},
variants: {
float: ['responsive', 'rtl'],
margin: ['responsive', 'rtl'],
padding: ['responsive', 'rtl'],
@HamedFathi
HamedFathi / index.html
Last active August 15, 2020 04:37
au2-config
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Dumber Gist</title>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1.0, user-scalable=no">
<base href="/">
</head>
<!--
Dumber Gist uses dumber bundler, the default bundle file
function scrollUp(start?: Function, end?: Function) {
const el = (document.documentElement || document.body);
if (start) start();
el.scroll({
top: 0,
left: 0,
behavior: 'smooth'
});
if (end) end();
}
import { injectStyle } from 'styl-injector';
const rippleStyleObj = {
"[data-animation]": { position: "relative", overflow: "hidden" },
".ripple": {
width: "2px",
height: "2px",
position: "absolute",
borderRadius: "50%",
backgroundColor: "rgba(255, 255, 255, 0.5)",
@HamedFathi
HamedFathi / DynamicPermissionManagementEntities.cs
Created April 1, 2021 22:09 — forked from rabbal/DynamicPermissionManagementEntities.cs
Domain Entities for Dynamic Permissions Management
public abstract class Entity
{
public long Id { get; set; }
[SuppressMessage("ReSharper", "BaseObjectGetHashCodeCallInGetHashCode")]
[SuppressMessage("ReSharper", "NonReadonlyMemberInGetHashCode")]
public override int GetHashCode()
{
if (IsTransient())
return base.GetHashCode();
using System;
namespace Dummy
{
class Program
{
private static void Header(string title)
{
Console.WriteLine(new string('=', 79));
Console.WriteLine(title);
@HamedFathi
HamedFathi / ExpressionCombiner
Created November 13, 2021 21:44 — forked from janvanderhaegen/ExpressionCombiner
C# code to combine two lambda expressions
//Shoutout to MBoros on stackoverflow
public static class ExpressionCombiner {
public static Expression<Func<T, bool>> And<T>(this Expression<Func<T, bool>> exp, Expression<Func<T, bool>> newExp)
{
// get the visitor
var visitor = new ParameterUpdateVisitor(newExp.Parameters.First(), exp.Parameters.First());
// replace the parameter in the expression just created
newExp = visitor.Visit(newExp) as Expression<Func<T, bool>>;
// now you can and together the two expressions