Skip to content

Instantly share code, notes, and snippets.

View belachkar's full-sized avatar
💻
Freelance

Ali Belachkar belachkar

💻
Freelance
View GitHub Profile
@belachkar
belachkar / MySQL.MD
Created September 10, 2019 15:58
MySQL Code Sheet

MySQL code sheet

Show Users

SELECT User, Host FROM mysql.user;

Create User

@belachkar
belachkar / How To Use Markdown.md
Last active October 28, 2019 21:09
كيفية تضمين الكود بالطريقة الصحيحة في المواضيع و التعليقات

كيفية تضمين الكود بالطريقة الصحيحة في المواضيع و التعليقات

لكي تسهل قرائة الكود و الاجابة عبر نسخه عوض لصق الصور
يكتب الكود على الشكل التالي :

```<Programming language>
Your code
```

Java

Eslint config

Additional Packages for eslint react compatibility

babel-eslint v.8 required for estlint v.4 and above.

Name Version
babel-eslint ^8
eslint-plugin-react *
@belachkar
belachkar / Count_down_sh.md
Created February 16, 2020 18:28
bash count down code

Bash Count Down

#!/bin/bash

echo
echo "==> Count down will start in 3 seconds"
echo
for sec in {1..6}
 do printf "\r %01d" $((7 - ${sec}))

Auth0 Rules

Set roles to a new user

function (user, context, callback) {

  const count = context.stats && context.stats.loginsCount ?
        context.stats.loginsCount :	0;
 

Reseting PG Database on Heroku

  1. Restart: heroku restart
  2. Reset the DB: heroku pg:reset DATABASE (no need to change the DATABASE)
  3. Migration: It depends on the framework.
    • heroku run rake db:migrate Or,
    • heroku run flask db upgrade depending the framework

On one line:

Angular material flex-layout

List

<div class="container"
     fxLayout="column"
     fxLayoutGap="10px">

  <mat-list fxFlex>
 

Angular Testing Directive - Injection Dependecy

Fixing error: "arguments not provided"

Files

  • highlight.directive.ts
  • highlight.directive.spec.ts
  • menu.component.html

Angular Protractor e2e testing: Make the browser waiting

Files

  • app.e2e-spec.ts
  • app.po.ts

Code example

app.e2e-spec.ts