Skip to content

Instantly share code, notes, and snippets.

@vades
vades / html-base-template.md
Last active May 21, 2019 06:28
Base HTML5 Boilerplate

Basic HTML5 Template

Basic HTML5 Template is a starting point for your website.

<!DOCTYPE html>
<html lang="en">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
 
@vades
vades / angular-set-element-attribute.md
Last active May 21, 2019 06:26
Set attribute in Angular template

Set attribute in Angular template

Angular documentation says:

Attribute binding syntax resembles property binding. Instead of an element property between brackets, start with the prefix attr, followed by a dot (.) and the name of the attribute.

 <div [attr.id]="data.id"></div>

Source

@vades
vades / laravel-clear-log.md
Last active May 21, 2019 06:25
Clear Laravel log files with CLI

Clear Laravel log files

To clear Laravel log files run the following command:

rm storage/logs/laravel-*.log

Source

@vades
vades / laravel-removing-stack-traces.md
Last active June 11, 2021 19:11
Removing the error stack traces from logging in Laravel

Removing the error stack traces from logging in Laravel

By default errors in Laravel are logged with the error stack traces. If you want to turn off these annoying stack traces perform the following:

  1. Open
app/Exceptions/Handler.php`
  1. Add
 use Illuminate\Support\Facades\Log;`
@vades
vades / laravel-markdown.md
Last active May 22, 2019 08:13
Laravel Markdown

Using Markdown in Laravel

An easy to use Laravel package for handling and rendering Markdown language.

Requirements

  • PHP version: 7.1 - 7.3.
  • Laravel version: 5.5 - 5.8.

Installation

  1. Composer:
composer require graham-campbell/markdown
@vades
vades / laravel-auto-refresh.md
Last active November 11, 2024 17:41
Auto refresh after changes with Laravel Mix

Laravel auto refresh after changes

To achieve this you can use Laravel Mix

  1. Ensure that Node.js and NPM are installed: run node -v and npm -v.
  2. Install Laravel Mix npm install.
  3. Open webpack.mix.js and add mix.browserSync('127.0.0.1:8000');.
  4. Run php artisan serve.
  5. And the npm run watch.

Sources

@vades
vades / angular-constructor-onInit-difference.md
Last active May 21, 2019 06:16
Difference between Constructor and ngOnInit in Angular app

Difference between Constructor and ngOnInit

Constructor

is a default method runs by deafult when component is being constructed.

ngOnInit

is component's life cycle hook which runs first after constructor when component is being initialized.

Source

Difference between Constructor and ngOnInit

@vades
vades / laravel-logging.md
Last active May 21, 2019 06:14
Laravel logging

Laravel logging

Laravel provides logging services that allow you to log errors, messages, events and uses Monolog, a powerful popular PHP logging library for all its logging needs.

Configuration

config/logging.php 

Log levels

  • emergency,
  • alert,
@vades
vades / angular-timeout.md
Last active May 21, 2019 06:13
Using timeout in Angular App

Using timeout in Angular App

You have to use ArrowFunction ()=>

export class YourComponent implements OnInit {

  ngOnInit() {
   setTimeout(()=> {
 console.log('Running timeout');
@vades
vades / font_awesome-icon-sizes.md
Last active May 21, 2019 06:11
Font Awsome: sizing icons

Sizing Font Awesome icons

Basic sizing

<i class="fas fa-igloo fa-xs"></i>
<i class="fas fa-igloo fa-sm"></i>
<i class="fas fa-igloo fa-lg"></i>
<i class="fas fa-igloo fa-2x"></i>
<i class="fas fa-igloo fa-3x"></i>
<i class="fas fa-igloo fa-5x"></i>