Skip to content

Instantly share code, notes, and snippets.

View apgapg's full-sized avatar
😉
Still not born...

Ayush P Gupta apgapg

😉
Still not born...
View GitHub Profile
@gitaarik
gitaarik / git_submodules.md
Last active July 31, 2024 22:45
Git Submodules basic explanation

Git Submodules basic explanation

Why submodules?

In Git you can add a submodule to a repository. This is basically a repository embedded in your main repository. This can be very useful. A couple of usecases of submodules:

  • Separate big codebases into multiple repositories.
@jamsesso
jamsesso / routing.js
Created August 30, 2014 20:24
Versioned API routing example
var express = require('express');
var http = require('http');
var app = express();
// Simple user controller implementation.
var users = [
{ username: 'jamsesso', age: 20, gender: 'M' },
{ username: 'bettycrocker', age: 20, gender: 'F' }
];
#!/bin/bash
# Logout current GitHub credentials and remove global user.name, user.email
echo -e "host=github.com\nprotocol=https\n" | git credential-osxkeychain erase
git config --unset-all --global user.name
git config --unset-all --global user.email
@dcasati
dcasati / export-kubeconfig-from-aks
Created February 6, 2018 15:30
Export KUBECONFIG from AKS
az aks get-credentials --resource-group k8s-demo-ss --name k8s-demo-cluster-ss --file kubeconfig-ss
@jeroen-meijer
jeroen-meijer / firebase_storage_image.dart
Created May 13, 2018 00:34
A Flutter widget that handles and shows an image downloaded from a Firebase Storage document.
import 'package:firebase_storage/firebase_storage.dart';
import 'package:flutter/material.dart';
import 'package:meta/meta.dart';
enum ImageDownloadState { Idle, GettingURL, Downloading, Done, Error }
class FirebaseStorageImage extends StatefulWidget {
/// The reference of the image that has to be loaded.
final StorageReference reference;
/// The widget that will be displayed when loading if no [placeholderImage] is set.
@ra9r
ra9r / proguard-rules.pro
Created July 4, 2019 20:32
Proguard Properties for Flutter and Firebase #flutter #firebase #android
## Flutter wrapper
-keep class io.flutter.app.** { *; }
-keep class io.flutter.plugin.** { *; }
-keep class io.flutter.util.** { *; }
-keep class io.flutter.view.** { *; }
-keep class io.flutter.** { *; }
-keep class io.flutter.plugins.** { *; }
# Basic ProGuard rules for Firebase Android SDK 2.0.0+
-keep class com.firebase.** { *; }
@apgapg
apgapg / date_utils.dart
Last active November 10, 2021 16:03
Get correct ISO DateTime String with offset in Flutter: https://dartpad.dev/84d855e41c0134a34ff8b2cf034ad249
import 'package:intl/intl.dart';
import 'package:meta/meta.dart';
void main() {
print(DateUtils.formatISOTime(DateTime.now()));
print(DateUtils.getCurrentISOTimeString());
}
class DateUtils {
@apgapg
apgapg / logging_interceptor.dart
Created April 9, 2020 05:37
Logging interceptor for dio, flutter
import 'dart:async';
import 'package:dio/dio.dart';
import 'package:flutter/cupertino.dart';
/// [LoggingInterceptor] is used to print logs during network requests.
/// It's better to add [LoggingInterceptor] to the tail of the interceptor queue,
/// otherwise the changes made in the interceptor behind A will not be printed out.
/// This is because the execution of interceptors is in the order of addition.
class LoggingInterceptor extends Interceptor {
@apgapg
apgapg / main.yml
Created April 20, 2020 10:01
Github Action for Flutter Build, Test, Release and Upload app
# This is a basic workflow to help you get started with Actions
name: Test, Build, Release Demo app to Azure Storgae
# 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 ]
@apgapg
apgapg / my_stream_builder.dart
Created April 20, 2020 14:16
Wrapper of StreamBuilder for managing error and loading on its own. Fully customisable
import 'package:flutter/material.dart';
import 'package:workozy_app/widgets/helper/stream_error_widget.dart';
import 'package:workozy_app/widgets/helper/stream_loading_widget.dart';
typedef OnData<T> = Widget Function(T data);
typedef OnError = Widget Function(dynamic e);
typedef OnLoading = Widget Function();
class MyStreamBuilder<T> extends StatelessWidget {
MyStreamBuilder({