Skip to content

Instantly share code, notes, and snippets.

View jazzbpn's full-sized avatar

bipin jazzbpn

  • Experiment
  • Kathmandu
View GitHub Profile
import 'package:flutter/material.dart';
import 'dart:async';
import 'dart:math';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
// This widget is the root of your application.
@jazzbpn
jazzbpn / index.js
Created May 20, 2020 09:43 — forked from adam-hurwitz/index.js
Coinverse Open App - Cloud Function: Delete User
// The Cloud Functions for Firebase SDK to create Cloud Functions and setup triggers.
const functions = require('firebase-functions');
const firebase_tools = require('firebase-tools');
// The Firebase Admin SDK to access the Firebase Realtime Database.
const admin = require('firebase-admin');
admin.initializeApp();
/**
* Initiate a recursive delete of documents at a given path.
@jazzbpn
jazzbpn / scaling_gesture_detector.dart
Created January 24, 2020 15:57 — forked from klaszlo8207/scaling_gesture_detector.dart
Flutter ScalingGestureDetector for a 3D view (you can pan and zoom in/out)
import 'package:advert_app/utils/logging.dart';
import 'package:flutter/widgets.dart';
import 'package:flutter/gestures.dart';
class ScalingGestureDetector extends StatefulWidget {
final Widget child;
final void Function(Offset initialPoint) onPanStart;
final void Function(Offset initialPoint, Offset delta) onPanUpdate;
final void Function() onPanEnd;
@jazzbpn
jazzbpn / flutter_spanablegrid.dart
Created March 16, 2019 03:48 — forked from aloisdeniel/flutter_spanablegrid.dart
Custom GridView with various cell sizes in Flutter
import 'dart:math' as math;
import 'package:flutter/material.dart';
import 'package:flutter/src/rendering/sliver.dart';
import 'package:flutter/src/rendering/sliver_grid.dart';
class _CoordinateOffset {
final double main, cross;
_CoordinateOffset(this.main, this.cross);
}
@jazzbpn
jazzbpn / ColorUtil
Created June 2, 2018 13:40 — forked from martintreurnicht/ColorUtil
Lighten and darken colors in android
public static int lighten(int color, double fraction) {
int red = Color.red(color);
int green = Color.green(color);
int blue = Color.blue(color);
red = lightenColor(red, fraction);
green = lightenColor(green, fraction);
blue = lightenColor(blue, fraction);
int alpha = Color.alpha(color);
return Color.argb(alpha, red, green, blue);
}
@jazzbpn
jazzbpn / VIPER Android Example.kt
Created February 23, 2018 09:25 — forked from marciogranzotto/VIPER Android Example.kt
This is an example of Android development with VIPER in Kotlin
interface LoginContracts {
interface View {
fun showError(message: String)
}
interface Presenter {
fun onDestroy()
fun onLoginButtonPressed(username: String, password: String)
}
@jazzbpn
jazzbpn / MVP + Interactor example.kt
Created February 23, 2018 09:15 — forked from marciogranzotto/MVP + Interactor example.kt
This is an example of Android development with MVP + Interactor in Kotlin
interface LoginContracts {
interface View {
fun presentHomeScreen(user: User)
fun showError(message: String)
}
interface Presenter {
fun onDestroy()
fun onLoginButtonPressed(username: String, password: String)
}
@jazzbpn
jazzbpn / gist:d66bc9e48d658b98218897bfea3bbcfb
Created April 7, 2016 10:23 — forked from yqritc/gist:ccca77dc42f2364777e1
Equal column spacing for Android RecyclerView GridLayoutManager by using custom ItemDecoration

ItemOffsetDecoration

public class ItemOffsetDecoration extends RecyclerView.ItemDecoration {

    private int mItemOffset;

    public ItemOffsetDecoration(int itemOffset) {
        mItemOffset = itemOffset;
    }
@jazzbpn
jazzbpn / RecyclerViewAdapter.java
Created April 7, 2016 07:05 — forked from slidenerd/RecyclerViewAdapter.java
A single adapter that supports Cursor + an optional header + optional footer
import android.database.Cursor;
import android.support.annotation.Nullable;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.view.ViewGroup;
public abstract class RecyclerCursorAdapter<U, V extends RecyclerView.ViewHolder> extends RecyclerView.Adapter<RecyclerView.ViewHolder> implements OnSwipeListener {
//The number of headers to be displayed by default if child classes want a header
public static final int HEADER_COUNT = 1;
//The number of footers to be displated by default if child classes want a footer