Skip to content

Instantly share code, notes, and snippets.

View mehran-prs's full-sized avatar
🌴

Mehran Poursadeghi mehran-prs

🌴
View GitHub Profile
@mehran-prs
mehran-prs / README.md
Created December 17, 2017 22:29 — forked from hofmannsven/README.md
My simply Git Cheatsheet
@mehran-prs
mehran-prs / update_indexeddb_data.js
Created December 5, 2019 16:07
Update object in chrome indexed db (can insert as snippet in chrome snippets)
// usage: update dbName,objectStoreName,keyVal and then update data in updateDoc function,finally return doc.
(function () {
let dbName = "db_name";
let dbVersion = 4
let objectStoreName = "object_store_name"
let keyVal = "object_key_val"
// Change doc and return it.
let getUpdatedDoc = function (doc) {
@mehran-prs
mehran-prs / translator.go
Created January 24, 2020 09:07
Go ozzo-validation translator (using ozzo-validatlion v4 and above)
import "github.com/go-ozzo/ozzo-validation/v4"
// Translator is the interface that need to be implemented if we
// need to error translation feature.
type Translator interface {
TranslateStructFieldErr(field string, err validation.Error) (string, error)
TranslateSingleFieldErr(err validation.Error) (string, error)
}
// Translate get a translator that must implemented Translator and
@mehran-prs
mehran-prs / ldoceonline.css
Last active April 21, 2021 08:42
ldoceonline just dictionary style
/* stylish theme, this style should apply on the domain: ldoceonline.com in stylish settings */
/* hide google adds */
iframe,.footer,.quizzes,.share_panel,.topslot-container,
.exercises,.logo_link,.text_welcome,.home_content+.carousel,
#iotd{
display: none!important;
}
.header{
text-align: center;
@mehran-prs
mehran-prs / readme.md
Last active April 13, 2022 18:43
K6 tests
  • Install k6
  • Write following js file (for example):
import http from 'k6/http';
import { sleep } from 'k6';
export const options = {
 thresholds: {
       http_req_duration: ['p(99)<1500'], // 99% of requests must complete below 1.5s
 },
package main
import (
"context"
"errors"
"log"
"time")
var totalInventory int
function FindProxyForURL(url, host) {
return "PRXY https://xrayf.hspace.ir:8888";
}