Skip to content

Instantly share code, notes, and snippets.

View Sp4Rx's full-sized avatar
👾
GG!!

Suvajit Sarkar Sp4Rx

👾
GG!!
View GitHub Profile
@Sp4Rx
Sp4Rx / BackgroundService.java
Created September 25, 2016 09:22
ServiceDemo 0.1
package com.example.suvajit.servicedemopersistant;
import android.app.Service;
import android.content.Intent;
import android.os.IBinder;
import android.support.annotation.Nullable;
import android.widget.Toast;
public class BackgroundService extends Service {
@Nullable
@Sp4Rx
Sp4Rx / BackgroundService.java
Created September 25, 2016 09:37
ServiceDemo 0.2
package com.example.suvajit.servicedemo;
import android.app.Service;
import android.content.Intent;
import android.os.IBinder;
import android.support.annotation.Nullable;
import android.widget.Toast;
public class BackgroundService extends Service {
@Nullable
@Sp4Rx
Sp4Rx / BackgroundService.java
Last active October 20, 2016 11:16
ServiceDemo 0.3
package com.example.suvajit.servicedemo;
import android.app.Service;
import android.content.Intent;
import android.os.IBinder;
import android.support.annotation.Nullable;
import android.widget.Toast;
public class BackgroundService extends Service {
@Nullable
@Sp4Rx
Sp4Rx / TilingDrawable.java
Created June 22, 2017 08:47 — forked from mswolters/TilingDrawable.java
TilingDrawable
public class TilingDrawable extends android.support.v7.graphics.drawable.DrawableWrapper {
private boolean callbackEnabled = true;
public TilingDrawable(Drawable drawable) {
super(drawable);
}
@Override
public void draw(Canvas canvas) {
@Sp4Rx
Sp4Rx / ImageFilePath.java
Last active December 7, 2017 11:44
Get real image path from uri
import android.content.ContentUris;
import android.content.Context;
import android.database.Cursor;
import android.net.Uri;
import android.os.Build;
import android.os.Environment;
import android.provider.DocumentsContract;
import android.provider.MediaStore;
@Sp4Rx
Sp4Rx / JsonKey.dart
Created May 20, 2020 12:45
Just to check what dart returns if there is no key
void main() {
var data = {'key': 'value'};
try {
var value = data['wrongKey'];
print(value);
value = data['key'];
print(value);
print('---------------');
//This is just to simulate an error
@Sp4Rx
Sp4Rx / weird_dart_mixin.dart
Created June 28, 2020 00:24
Weird Dart Mixin
void main() {
Foo foo = Foo();
print(foo.fromA);
print(foo.fromB);
print("=====================");
Foo1 foo1 = Foo1();
print(foo1.fromC);
print(foo1.fromD);
@Sp4Rx
Sp4Rx / main.dart
Last active March 30, 2021 12:26
Benchmarking for to test -- operator x ~/ y is more efficient than (x / y).toInt().
import 'dart:typed_data';
void main() {
const t = 99999999999999999999.0; //A big number
const step = 18871268712.0; //Random number
const max = 999999;
//Initialise time for calculating benchmark.
var initialTime = DateTime.now().millisecondsSinceEpoch;
for (int i = 0; i < max; i++) {
@Sp4Rx
Sp4Rx / main.dart
Created September 27, 2022 21:31
Sticky bottom sheet
import 'package:flutter/material.dart';
const Color darkBlue = Color.fromARGB(255, 18, 32, 47);
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
@Sp4Rx
Sp4Rx / AndroidManifest.xml
Created December 28, 2022 03:48
Tranzact manifiest
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.letstranzact.app">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="com.google.android.gms.permission.AD_ID" />
<application
android:name="com.letstranzact.tranzact.MainApplication"
android:icon="@mipmap/ic_launcher"