Skip to content

Instantly share code, notes, and snippets.

View Hebrahimzadeh's full-sized avatar
🎯
Focusing

Hossein Ebrahimzadeh Hebrahimzadeh

🎯
Focusing
View GitHub Profile
@font-face {
font-family: 'vazir-font';
font-weight: 300;
font-style: normal;
src: url('https://cdn.rawgit.com/rastikerdar/vazir-font/v19.0.0/dist/Vazir.woff') format('woff');
font-display: swap;
}
#board {
padding: 0 15px;
}
@media print{
*{
font-family: IRANSans, "Noto Sans Arabic" !important;
-webkit-print-color-adjust: exact;
}
.postmeta-primary:nth-child(2), .meta_categories{
display:block !important;
}
#sidebar-primary, .sue-panel-content.sue-content-wrap, .su-box.su-box-style-default,nav.ubermenu, #main .clearfix .links, .navigation.clearfix,.reply, .wpulike, #respond form{
display:none !important
@Hebrahimzadeh
Hebrahimzadeh / html5-validation-message.js
Created May 18, 2020 13:35 — forked from edysegura/html5-validation-message.js
How to prevent the browser from showing default HTML5 validation error message bubble?
document.addEventListener('invalid', (function(){
return function(e) {
//prevent the browser from showing default error bubble / hint
e.preventDefault();
// optionally fire off some custom validation handler
// myValidation();
};
})(), true);
@Hebrahimzadeh
Hebrahimzadeh / Laravel-Container.md
Created August 4, 2021 11:11
Laravel's Dependency Injection Container in Depth

Laravel's Dependency Injection Container in Depth

Translations: Korean (by Yongwoo Lee)

Laravel has a powerful Inversion of Control (IoC) / Dependency Injection (DI) Container. Unfortunately the official documentation doesn't cover all of the available functionality, so I decided to experiment with it and document it for myself. The following is based on Laravel 5.4.26 - other versions may vary.

Introduction to Dependency Injection

I won't attempt to explain the principles behind DI / IoC here - if you're not familiar with them you might want to read What is Dependency Injection? by Fabien Potencier (creator of the Symfony framework).

stackoverflow (hdorio)

Fast answer:

sed ':a;N;$!ba;s/\n/ /g' file
  1. :a create a label 'a'
  2. N append the next line to the pattern space
  3. $! if not the last line, ba branch (go to) label 'a'
  4. s substitute, /\n/ regex for new line, / / by a space, /g global match (as many times as it can)
@Hebrahimzadeh
Hebrahimzadeh / Create_Laravel_Pipeline.txt
Last active December 7, 2021 17:13 — forked from omaryoussef/Create_Laravel_Pipeline.txt
Creates a Filebeat pipeline to ingest Laravel Monolog/log lines.
PUT _ingest/pipeline/laravel
{
"description": "Parses Laravel log files.",
"processors": [
{
"rename": {
"field": "message",
"target_field": "event.original"
}
},
@Hebrahimzadeh
Hebrahimzadeh / multiple_ssh_setting.md
Created December 8, 2021 09:49 — forked from jexchan/multiple_ssh_setting.md
Multiple SSH keys for different github accounts

Multiple SSH Keys settings for different github account

create different public key

create different ssh key according the article Mac Set-Up Git

$ ssh-keygen -t rsa -C "your_email@youremail.com"
@Hebrahimzadeh
Hebrahimzadeh / ffmpeg wav to mp3 and versa
Last active December 19, 2021 10:37 — forked from dominicthomas/ffmpeg wav -> mp3
Convert a wav to a 320k mp3 using ffmpeg and versa
# wav to mp3
ffmpeg -i inputfile.wav -ab 320k outputfile.mp3
# mp3 to wav batch
for i in *.mp3; do ffmpeg -i "$i" -acodec pcm_u8 -ar 22050 "${i%.*}.wav"; done
@Hebrahimzadeh
Hebrahimzadeh / check_and_extract.groovy
Created February 9, 2022 09:04 — forked from kdabir/check_and_extract.groovy
finding regex matches in text in groovy
def m = "1234 abc" =~ /^(\d+)/
def n = "abc 1234" =~ /^(\d+)/
println (m.find()?m.group():"not matched")
println (n.find()?n.group():"not matched")
@Hebrahimzadeh
Hebrahimzadeh / pr.md
Created February 17, 2022 15:22 — forked from piscisaureus/pr.md
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this: