Skip to content

Instantly share code, notes, and snippets.

View shalaby's full-sized avatar

Muhammad Shalaby shalaby

  • Egypt
View GitHub Profile
@shalaby
shalaby / jwt-payload-parse.dart
Created September 12, 2020 13:26 — forked from hjJunior/jwt-payload-parse.dart
Get payload of JWT token in Dart language
import 'dart:convert';
Map<String, dynamic> parseJwt(String token) {
final parts = token.split('.');
if (parts.length != 3) {
throw Exception('invalid token');
}
final payload = _decodeBase64(parts[1]);
final payloadMap = json.decode(payload);
@shalaby
shalaby / Javascript OO Cheat Sheet
Created August 29, 2020 20:08 — forked from cklanac/Javascript OO Cheat Sheet
Javascript OO Cheat Sheet
/***********************************************************************************************************************
***********************************************************************************************************************
* CONTENTS:
* Native Object
* Object Literal
* Basic Object
* Psuedo-Class
* Self Executing/Invoking Structure
* Lazy Function
* Module Pattern
@shalaby
shalaby / vanilla-js-cheatsheet.md
Created August 29, 2020 11:45 — forked from thegitfather/vanilla-js-cheatsheet.md
Vanilla JavaScript Quick Reference / Cheatsheet
@shalaby
shalaby / main.dart
Created July 14, 2020 00:04 — forked from vincevargadev/main.dart
switching theme without any library.
void main() {
runApp(_SwitchingThemeApp());
}
/// Properties that help me keep track of the example being run.
bool _useMaterial = false;
class _SwitchingThemeApp extends StatefulWidget {
@override
_SwitchingThemeAppState createState() => _SwitchingThemeAppState();
@shalaby
shalaby / singleton.dart
Created June 22, 2020 23:34 — forked from theburningmonk/singleton.dart
Using Dart's factory constructor feature to implement the singleton pattern
class MyClass {
static final MyClass _singleton = new MyClass._internal();
factory MyClass() {
return _singleton;
}
MyClass._internal() {
... // initialization logic here
}
@shalaby
shalaby / deploy.yml
Created June 17, 2020 14:14 — forked from apgapg/deploy.yml
Github Workflow for Building, Releasing Flutter web app to Github Pages and Firebase Hosting
# This is a basic workflow to help you get started with Actions
name: Build, Release app to Github Pages and Firebase Hosting
# name: Test, Build and Release apk
# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the master branch
on:
push:
branches:
- master

MongoDB Cheat Sheet

Show All Databases

show dbs

Show Current Database

@shalaby
shalaby / date-formats.ts
Created May 28, 2020 21:28 — forked from wottpal/date-formats.ts
Custom DateFormats & DateAdapter for Angular Material MatDatepicker using Day.js
import { Platform } from '@angular/cdk/platform';
import { NativeDateAdapter } from '@angular/material';
import * as dayjs from 'dayjs';
import 'dayjs/locale/de';
import * as customParseFormat from 'dayjs/plugin/customParseFormat';
import * as localizedFormat from 'dayjs/plugin/localizedFormat';
/**
* Custom Date-Formats and Adapter (using https://github.com/iamkun/dayjs)
@shalaby
shalaby / color.dart
Created May 22, 2020 14:20 — forked from erluxman/color.dart
Colorfilters in dart
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
void main() {
runApp(App());
}
class App extends StatelessWidget {
@override
Widget build(BuildContext context) {
@shalaby
shalaby / gist:b3b24d1be19c67f458561bf58822857f
Created May 12, 2020 16:01 — forked from iainsproat/gist:8378720
Git: stash work in progress and move it to a new branch
  • make changes
  • git stash save
  • git checkout -b xxx
  • git stash pop

where xxx is the new branch name