Skip to content

Instantly share code, notes, and snippets.

View mhadaily's full-sized avatar
🎯
Let's Flutter

Majid Hajian mhadaily

🎯
Let's Flutter
View GitHub Profile
@MarcinusX
MarcinusX / timesamp_to_local_datetimes_linter.dart
Last active March 6, 2023 09:48
A linter for parsing protobuf's Timestamps to DateTime. The goal is to always include isLocal: true when doing it.
import 'package:analyzer/dart/ast/ast.dart';
import 'package:analyzer/dart/element/type.dart';
import 'package:analyzer/error/error.dart';
import 'package:analyzer/error/listener.dart';
import 'package:analyzer/source/source_range.dart';
import 'package:custom_lint_builder/custom_lint_builder.dart';
class PreferTimestampsToLocalDateTimes extends DartLintRule {
PreferTimestampsToLocalDateTimes() : super(code: _code);
@mhadaily
mhadaily / Update website if there is new servicer worker update found.md
Created November 14, 2020 14:14
Use it in your index.html file in Flutter Web.
function invokeServiceWorkerUpdateFlow() {
  // you have a better UI here, reloading is not a great user experince here.
  const confirmed = confirm('New version of the app is available. Refresh now');
  if (confirmed) {
    window.location.reload();
  }
}
async function handleServiceWorker() {
@richardszalay
richardszalay / web-nfc.d.ts
Created April 8, 2019 10:51
Types for WebNFC as implemented by Chrome
/**
* Types for the version of Web NFC available in Chrome for Android
*
* The spec is similar to, but does not exactly match https://w3c.github.io/web-nfc/releases/20151112/
*/
declare global {
interface Navigator {
nfc: WebNFC
}
@NathanWalker
NathanWalker / animate.directive.ts
Last active January 21, 2019 01:09
NativeScript for Angular animate directive for silky smooth mobile (iOS/Android) animations anytime, anywhere and on anything.
/**
* Add this to your app's SharedModule declarations
*/
import { Directive, ElementRef, Input } from '@angular/core';
// nativescript
import { View } from 'tns-core-modules/ui/core/view';
import { Animation, AnimationDefinition } from 'tns-core-modules/ui/animation';
@NathanWalker
NathanWalker / app.component.ts
Last active December 13, 2017 15:54
NativeScript: Wire up RadSideDrawer from 'nativescript-telerik-ui' with Angular2 taking full advantage of Router
// angular
import {Component} from '@angular/core';
@Component({
moduleId: module.id,
selector: 'app',
template: `
<StackLayout>
<page-router-outlet></page-router-outlet>
</StackLayout>
@btroncone
btroncone / ngrxintro.md
Last active June 26, 2024 08:27
A Comprehensive Introduction to @ngrx/store - Companion to Egghead.io Series

Comprehensive Introduction to @ngrx/store

By: @BTroncone

Also check out my lesson @ngrx/store in 10 minutes on egghead.io!

Update: Non-middleware examples have been updated to ngrx/store v2. More coming soon!

Table of Contents

// webpack is a module bundler
// This means webpack takes modules with dependencies
// and emits static assets representing those modules.
// dependencies can be written in CommonJs
var commonjs = require("./commonjs");
// or in AMD
define(["amd-module", "../file"], function(amdModule, file) {
// while previous constructs are sync
// this is async