Skip to content

Instantly share code, notes, and snippets.

View belachkar's full-sized avatar
💻
Freelance

Ali Belachkar belachkar

💻
Freelance
View GitHub Profile

GPG commands and tips

GPG extend signature time

gpg --edit-key <ID>
gpg> expire
...
gpg> save

Android permissions

Request permissions

public ContactAddressMapper(Activity activity) {
    mActivity = activity;

    // Checks whether the build SDK version is greater than that
 // of Android M; if it is then ask for permission to read

Android how to use static inner AsyncTask class

S1

To prevent leaks in memory, you can make the inner class static.

The problem with that, though, is that you no longer have access to the Activity's UI views or member variables.

You can pass in a reference to the Context but then you run the same risk of a memory leak. (Android can't garbage collect the Activity after it closes if the AsyncTask class has a strong reference to it.)

MySQL Common Errors Fixations

Errors

2054 - The server requested authentication method unknown to the client

SQLSTATE[HY000] [2054] The server requested authentication method unknown to the client:

ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password';

GRUNT Configuration Example

Packages used

  • grunt
  • grunt-browser-sync
  • grunt-contrib-clean
  • grunt-contrib-concat
  • grunt-contrib-copy
  • grunt-contrib-cssmin

Gulp Configuration

Packages used

  • gulp
  • gulp-clean-css
  • gulp-htmlmin
  • gulp-imagemin
  • gulp-rev
  • gulp-sass
@belachkar
belachkar / Flutter_costum_theme.md
Last active November 26, 2020 21:46
An example of Flutter Theme customization

Flutter custom theme

An example of Flutter Theme customization

colors.dart:

import 'package:flutter/material.dart';

// Pink

Flutter Fonts customization

An example of fonts customization in Flutter

pubspec.yaml:

name: Shrine
description: Learn how to use Material for structure and layout.

Flutter Backdrop Implemantation

backdrop.dart:

import 'package:flutter/material.dart';
import 'package:meta/meta.dart';
import 'model/product.dart';

class Backdrop extends StatefulWidget {