This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"basics": { | |
"name": "Taosif Jamal", | |
"label": "Software Engineer", | |
"image": "", | |
"email": "[email protected]", | |
"phone": "(91) 9638804660", | |
"summary": "A summary of John Doe…", | |
"location": { | |
"address": "6th Block, Kormangala", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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" ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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()); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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]; |