Skip to content

Instantly share code, notes, and snippets.

View JosephineAkello's full-sized avatar
🎯
Focusing

Maureen Josephine JosephineAkello

🎯
Focusing
View GitHub Profile
@JosephineAkello
JosephineAkello / breakpoints
Last active January 6, 2020 13:48
How to add breakpoints to a dart code in vscode from imported library
"dart.debugExternalLibraries": true,
"dart.debugSdkLibraries": true,
The first will allow debugging of pub packages; while the second will allow debugging of Flutter sdk.
@JosephineAkello
JosephineAkello / validator.txt
Last active January 15, 2020 15:37
Checking for a valid string and floating point using a regex
public class MyUtilities{
public boolean isDigit(String s)
{
if(s.matches("((-|\\+)?[0-9]+(\\.[0-9]+)?)+")){
return true;
}
else {
@JosephineAkello
JosephineAkello / patchingColumns
Created January 28, 2020 09:07
This is a Python script that enables patching of different IDs from different columns in the db, into one column using the available endpoint.
import json
import requests
from providerProgramContracts.helpers import open_csv
def patch_ids():
my_token = 'enter your token here'
count = 0
flush() -> method in java used to flush streams, by clearing the
stream of any element that maybe or maybe not inside the stream
@JosephineAkello
JosephineAkello / gradlew.txt
Last active March 23, 2020 08:48
gradlew error
If you get this error when running gradlew clean build command
./gradlew: No such file or directory
probably your project doesnt have the gradlew wrapper.
To generate one run this.
gradle wrapper
@JosephineAkello
JosephineAkello / gitstasheslist
Last active May 3, 2020 17:24
Getting a list of previous git stashes
To recover previous git stashes, follow these commands to bring back work in different branches
$git stash list - shows git stashes lists
$git stash pop stash{0} - to reference a specific stash in the list to get the list of previous stashes
$git stash show - inspects the current stash list
@JosephineAkello
JosephineAkello / sumofarrays
Created July 9, 2020 15:09
Finding sum of Arrays in Java 8 and Java 7
Java 7
import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;
public class Solution {
@JosephineAkello
JosephineAkello / Sort a HashMap
Created July 9, 2020 20:09
Snippet to sort a hashmap
Sort By Key
List<Employees> employee = new ArrayList<>(map.keySet());
Collections.sort(employee);
Output -> [Anne, George, John, Mooh]
Sort by Value
List<Employee> employeeId = new ArrayList<>(map.values();
@JosephineAkello
JosephineAkello / stringreverse
Created July 10, 2020 07:17
Reverse a string in Java
import java.util.Scanner;
public class Solution {
public static void main(String[] args) {
/* Read input */
Scanner scan = new Scanner(System.in);
String str = scan.nextLine();
scan.close();
@JosephineAkello
JosephineAkello / mpesa.dart
Last active February 6, 2021 01:07
Mpesa method
import 'package:flutter/material.dart';
import 'package:mpesa_flutter_plugin/mpesa_flutter_plugin.dart';
void main() {
MpesaFlutterPlugin.setConsumerKey("Your Consumer Key from the safarocom portal, its random eg.'8joAntLHTIT28Pup....' ");
MpesaFlutterPlugin.setConsumerSecret("Your Consumer Secret from the safarocom portal, its random eg. 'kjiUWoPT4...' ");
runApp(MyApp());
}