Skip to content

Instantly share code, notes, and snippets.

View Taosif7's full-sized avatar
🎯
Focusing

Taosif Jamal Taosif7

🎯
Focusing
View GitHub Profile
@Taosif7
Taosif7 / flcp.sh
Last active October 8, 2023 10:02
A Bash Script to Copy flutter generated build outputs in a proper format
#!/bin/bash
# Check if pubspec.yaml file exists
if [ ! -f "pubspec.yaml" ]; then
echo "⚠️ Please run command in a Flutter project"
exit 1
fi
# Get the value of "name: value"
projectName=$(awk '/name:/ {print $2}' pubspec.yaml)
@Taosif7
Taosif7 / SampleCode.dart
Created October 16, 2022 09:09
TempFile
import 'dart:convert';
import 'package:http/http.dart' as http;
void main() async {
var empResponse = await getEmployeeById(256);
if(empResponse.employee != null){
print("EMPLOYEE NAME: "+empResponse.employee.name);
}else{
print("EMPLOYEE DOES NOT EXIST");
}
@Taosif7
Taosif7 / resume.json
Last active August 31, 2022 04:44
Taosif Jamal Resume
{
"basics": {
"name": "Taosif Jamal",
"label": "Software Engineer",
"image": "",
"email": "Taosif.7@gmail.com",
"phone": "(91) 9638804660",
"summary": "A summary of John Doe…",
"location": {
"address": "6th Block, Kormangala",
@Taosif7
Taosif7 / ListValueNotifier.dart
Last active August 21, 2022 18:17
A List implementation, that notifies on every change
import 'dart:math';
import 'package:flutter/foundation.dart';
class ListValueNotifier<T> extends ChangeNotifier implements ValueListenable<Iterable<T>>, List<T> {
ListValueNotifier(this._value);
List<T> _value;
@override
@Taosif7
Taosif7 / git-diff-zip.bat
Last active February 7, 2022 08:42
A batch script that zips the changed files from provided commit with folder stucture
@echo off
setlocal EnableDelayedExpansion
REM ## Remove diff file if exists
if exist diff-filelist.txt del /f diff-filelist.txt
REM ## set output file name
set "outputFileName=%2"
IF "%~2" == "" ( SET "outputFileName=output.zip" )
@Taosif7
Taosif7 / RoundToPrecisionMultiple.php
Created November 6, 2021 18:41
A functon to round a float number to particular float multiple.
/**
* Function to round a number to a precision multiple
*
* @param float $number original number
* @param float $pointMultiple the point multiple to which it needs to be rounded
* @param bool $roundDown whether to round up or down
* @param int $precision precision for rounding
* @return float rounded float number
*/
function roundToPrecisionMultiple(float $number,
@Taosif7
Taosif7 / transpose_list.dart
Created August 27, 2021 22:27
Transpose a 2D rectangle Dart list
List<List<R>> transposeList<R>(List<List<R>> input) {
List<List<R>> output = [];
// Check for rectangle matrix
if (input.any((element) => element.length != input[0].length)) {
throw FormatException('Not a rectangle Matrix');
}
for (int i = 0; i < input[0].length; i++) {
output.add(List<R>.generate(input.length, (idx) => null));
@Taosif7
Taosif7 / GeoHash.dart
Last active February 10, 2022 09:42
Dart Geohash Implementation
String chars = "0123456789bcdefghjkmnpqrstuvwxyz";
const BITS_PER_BASE32_CHAR = 5;
main() {
LatLng location = LatLng(22.5678, 72.1234);
String geohash = encode(location, 8);
print("Original: " + location.toString());
print("GeoHash: " + geohash);
print("Decoded: " + decodeGeoCode(geohash).toString());
}
@Taosif7
Taosif7 / InfiniteCounter.java
Created September 23, 2020 09:06
A Timer That runs infinitely and calls its listeners on definite intervals
import android.os.CountDownTimer;
import java.util.Arrays;
public class InfiniteCounter extends CountDownTimer {
private static final int MAX_LISTENERS = 100;
private static InfiniteCounter timer;
private static InfiniteCounterListener[] listenerList = new InfiniteCounterListener[MAX_LISTENERS];