Skip to content

Instantly share code, notes, and snippets.

View sudansh's full-sized avatar
🎯
Focusing

Sudhanshu Singh sudansh

🎯
Focusing
View GitHub Profile
/**
* Navigates only if this is safely possible; when this Fragment is still the current destination.
*/
fun Fragment.navigateSafe(
@IdRes resId: Int,
args: Bundle? = null,
navOptions: NavOptions? = null,
navigatorExtras: Navigator.Extras? = null
) {
if (mayNavigate()) findNavController().navigate(
@shehabic
shehabic / TrieDictionaryWildCard.java
Last active March 19, 2020 13:26
Dictionary Search With Wildcard Implemented using Trie in Java
public class TrieDictionaryWildCard
public static class TrieNode {
public boolean end = false;
public final Map<Character, TrieNode> children = new HashMap<>();
}
public static class TrieFinder {
private final char wildcard;
@prime31
prime31 / gist:5675017
Last active May 28, 2024 11:37
Simple PHP script showing how to send an Android push notification. Be sure to replace the API_ACCESS_KEY with a proper one from the Google API's Console page. To use the script, just call scriptName.php?id=THE_DEVICE_REGISTRATION_ID
<?php
// API access key from Google API's Console
define( 'API_ACCESS_KEY', 'YOUR-API-ACCESS-KEY-GOES-HERE' );
$registrationIds = array( $_GET['id'] );
// prep the bundle
$msg = array