Skip to content

Instantly share code, notes, and snippets.

View ZahidRasheed's full-sized avatar

Zahid Rasheed ZahidRasheed

View GitHub Profile
import static org.junit.Assert.*;
import static org.hamcrest.CoreMatchers.is;
import static org.mockito.Mockito.*;
import static org.mockito.BDDMockito.*;
import org.hamcrest.BaseMatcher;
import org.hamcrest.Description;
import org.hamcrest.Matcher;

I am a big fat heading.

i.e # I am a big fat heading.

I am underlined heading.

i.e ## I am underlined heading.

Shortcut Description
⌃ + R Run Application.
⌃ + D Debug Application.
⇧ + ⇧ Search Everywhere.
⇧ + ⌘ + A Search for Actions.
⌘ + 1 Switch between project windows.
# Created by https://www.gitignore.io/api/android
### Android ###
# Built application files
*.apk
*.ap_
# Files for the Dalvik VM
*.dex
@ZahidRasheed
ZahidRasheed / FCM.php
Created November 23, 2016 00:12
Send android push notifcation
<?php
// Server key from Google API's Console https://console.firebase.google.com/project/high-street-auctions/settings/cloudmessaging
define( 'SERVER_KEY', 'YOUR-API-ACCESS-KEY-GOES-HERE' );
$registrationIds = array('','','');
$payLoad = array
(
'message' => 'here is a message.',
public final class StringUtils {
public static String getRandomName() {
List<String> names = new ArrayList<>(Arrays.asList("Durante Waldo",
"Iolyn Szilveszter",
"Ibragim Landebert",
"Kenelm Konrad",
"Adam Ercanbald"));
return names.get(new Random().nextInt(names.size()));
}
public final class JodaTimeUtils {
public static String formatStringToHoursAndMinutes(String timestamp, Locale locale) {
DateTime dt = (ISODateTimeFormat.dateTime()).parseDateTime(timestamp);
return dt.toString("HH:mm", locale);
}
public static String getDurationBetween(String start, String end) {
DateTime startDate = (ISODateTimeFormat.dateTime()).parseDateTime(start);
DateTime endDate = (ISODateTimeFormat.dateTime()).parseDateTime(end);
return getDurationBetweenTwoDates(startDate, endDate);
public final class TravelToolsUtils {
/**
* Generate mock stop locations, given current location of user.
*/
public static CoordinatesEntity getCoordinatesEntity(double x0, double y0, double radius) {
Random random = new Random();
// Convert radius from meters to degrees
double w = (radius / 111000f) * Math.sqrt(random.nextDouble());
double t = 2 * Math.PI * random.nextDouble();
@ZahidRasheed
ZahidRasheed / error.java
Created December 15, 2016 08:57
Retrofit Error Response
Response response = Response.error(HttpURLConnection.HTTP_INTERNAL_ERROR, ResponseBody.create(MediaType.parse("application/json"),"Internal Server Error"));
<?php
//Set Variables:
$background = "bg.jpg"; //Background chose by user
$logo = "logo.png"; //This logo will always remain same
$userLogo = "20.png"; //Logo created by user.
$savePath = "/output/"; //Where to Save?
$showNotSave = true;
//No need to change anything below....
$bgImage = imagecreatefromjpeg($background);