Skip to content

Instantly share code, notes, and snippets.

View Hebrahimzadeh's full-sized avatar
🎯
Focusing

Hossein Ebrahimzadeh Hebrahimzadeh

🎯
Focusing
View GitHub Profile

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 / 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).

@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);
@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
@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;
}