Skip to content

Instantly share code, notes, and snippets.

View HamedFathi's full-sized avatar
🌎

Hamed Fathi HamedFathi

🌎
View GitHub Profile
@archer884
archer884 / ext.rs
Last active October 24, 2021 23:08
"Extension Methods" in Rust
use std::collections::HashSet;
use std::hash::{Hash, Hasher};
use std::collections::hash_state::HashState;
fn main() {
if let Some(content) = {
let args = std::os::args();
if args.len() == 2 {
Some(args[1].to_string())
} else {
@varemenos
varemenos / 1.README.md
Last active October 23, 2024 13:07
Git log in JSON format

Get Git log in JSON format

git log --pretty=format:'{%n  "commit": "%H",%n  "abbreviated_commit": "%h",%n  "tree": "%T",%n  "abbreviated_tree": "%t",%n  "parent": "%P",%n  "abbreviated_parent": "%p",%n  "refs": "%D",%n  "encoding": "%e",%n  "subject": "%s",%n  "sanitized_subject_line": "%f",%n  "body": "%b",%n  "commit_notes": "%N",%n  "verification_flag": "%G?",%n  "signer": "%GS",%n  "signer_key": "%GK",%n  "author": {%n    "name": "%aN",%n    "email": "%aE",%n    "date": "%aD"%n  },%n  "commiter": {%n    "name": "%cN",%n    "email": "%cE",%n    "date": "%cD"%n  }%n},'

The only information that aren't fetched are:

  • %B: raw body (unwrapped subject and body)
  • %GG: raw verification message from GPG for a signed commit
@DmitrySoshnikov
DmitrySoshnikov / LL1-parser-first-follow-sets.js
Last active March 27, 2024 07:24
LL(1) Parser. Parsing table, part 1: First and Follow sets.
/**
* LL(1) parser. Building parsing table, part 1: First and Follow sets.
*
* NOTICE: see full implementation in the Syntax tool, here:
* https://github.com/DmitrySoshnikov/syntax/blob/master/src/sets-generator.js
*
* by Dmitry Soshnikov <[email protected]>
* MIT Style License
*
* An LL(1)-parser is a top-down, fast predictive non-recursive parser,
@SergeyTeplyakov
SergeyTeplyakov / gist:054760dbb1af1b1ab8aa99d048e50293
Created December 9, 2020 18:10
Comments about 'The .NET World - C# Source Generator'
This is a comment about the following blog post: https://hamedfathi.me/the-dotnet-world-csharp-source-generator/
I just skimmed through the post because its quite long tbh, so this is not a review but rather an impression.
When I was blogging I was asking myself some questions:
- Who's my audience?
- What's the goal and the story of the blogpost?
- Is there any redundant infromation that I've added to the post that can be removoed without making the main point less clear? etc.
Even though I think soomeone will love the posts like the one we're talking about (and the content is great, btw), this is not the post I'll be reading carefully.
@davidfowl
davidfowl / MinimalAPIs.md
Last active November 18, 2024 18:55
Minimal APIs at a glance
@brianroadifer
brianroadifer / ngpurge.js
Last active June 29, 2023 04:19
Angular PurgeCSS Script
// orignal author @dylanvdmerwe - https://dev.to/dylanvdmerwe/reduce-angular-style-size-using-purgecss-to-remove-unused-styles-3b2k
const exec = require("child_process").exec;
const fs = require("fs");
const path = require("path");
const chalk = require("chalk");
function removeUnusedCSS() {
var pathPrefix = process.argv.slice(2)[0];
// find the styles css file
const files = getAllFiles(`./${pathPrefix}/`, ".css");
@EllyLoel
EllyLoel / reset.css
Last active October 24, 2024 06:51
CSS Reset
/*
Made by Elly Loel - https://ellyloel.com/
With inspiration from:
- Josh W Comeau - https://courses.joshwcomeau.com/css-for-js/treasure-trove/010-global-styles/
- Andy Bell - https://piccalil.li/blog/a-modern-css-reset/
- Adam Argyle - https://unpkg.com/[email protected]/normalize.min.css / https://codepen.io/argyleink/pen/KKvRORE
Notes:
- `:where()` is used to lower specificity for easy overriding.
*/