Skip to content

Instantly share code, notes, and snippets.

View mahmoud-eskandari's full-sized avatar
🪲
What the bug? WTB?

Mahmoud Eskandari mahmoud-eskandari

🪲
What the bug? WTB?
View GitHub Profile
@ayebrian
ayebrian / vmware.md
Last active November 3, 2024 18:16
VMware ESXi 8 / vCenter 8 / Workstation 17 license key 2024
@farskid
farskid / index.js
Last active April 15, 2021 10:20
Conventional subscription API for DOM events. Subscriber returns an unsubscribe callback that once called, will detach the event handler.
// ...args: [event, handler, capture]
function onEvent(element, ...args) {
element.addEventListener(...args);
return () => {
element.removeEventListener(...args);
}
}
const form = $('#form');
const detachSubmit = onEvent(form, 'submit', submitForm});
function respHandler() {
data = JSON.parse(this.responseText)
price = data.data.webengage.price
cells = document.getElementsByClassName('post-fields-item')
last = cells[cells.length - 1]
clone = last.cloneNode(true)
clone.getElementsByTagName('span')[0].innerText = 'قیمت'
clone.getElementsByTagName('div')[0].innerText = Number(price).toLocaleString()
last.parentElement.appendChild(clone)
}
@davecheney
davecheney / go1.0-vs-go1.11.txt
Created October 7, 2018 11:13
test/bench/go1 benchmark results
name old time/op new time/op delta
BinaryTree17 5.44s ± 2% 3.27s ± 2% -39.90% (p=0.000 n=20+19)
Fannkuch11 4.95s ± 2% 2.68s ± 2% -45.87% (p=0.000 n=20+20)
FmtFprintfEmpty 142ns ± 2% 49ns ± 3% -65.39% (p=0.000 n=20+18)
FmtFprintfFloat 765ns ± 2% 260ns ± 2% -66.02% (p=0.000 n=20+20)
FmtFprintfInt 341ns ± 2% 95ns ± 2% -72.08% (p=0.000 n=19+20)
FmtFprintfIntInt 554ns ± 2% 150ns ± 1% -72.95% (p=0.000 n=20+19)
FmtFprintfPrefixedInt 497ns ± 3% 178ns ± 3% -64.12% (p=0.000 n=20+20)
FmtFprintfString 466ns ± 2% 86ns ± 3% -81.54% (p=0.000 n=20+20)
FmtManyArgs 2.23µs ± 2% 0.59µs ± 1% -73.46% (p=0.000 n=20+17)
@walm
walm / main.go
Last active October 1, 2024 23:41
Simple Golang DNS Server
package main
import (
"fmt"
"log"
"strconv"
"github.com/miekg/dns"
)
@wojteklu
wojteklu / clean_code.md
Last active November 4, 2024 06:15
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules