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 'package:flutter_bloc/flutter_bloc.dart'; | |
extension BlocReset on Bloc { | |
void reset(dynamic initialState) { | |
emit(initialState); | |
} | |
} |
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 'package:flutter/material.dart'; | |
void main() => runApp(MyApp()); | |
class MyApp extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return const MaterialApp( | |
title: 'Flutter Adaptive AlertDialog Demo', | |
debugShowCheckedModeBanner: false, |
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
/** | |
* Return the first and last items from a List | |
*/ | |
fun <T> List<T>.ends(): List<T> { | |
if (this.size > 1) return this.take(1) + this.takeLast(1) | |
return this | |
} |
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.content.Context | |
import androidx.appcompat.app.AppCompatActivity | |
import androidx.core.util.component1 | |
import androidx.core.util.component2 | |
import androidx.fragment.app.DialogFragment | |
import com.google.android.material.datepicker.MaterialDatePicker | |
import com.google.android.material.timepicker.MaterialTimePicker | |
/** | |
* Time and Date Pickers for Jetpack Compose. |
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
// My solution to: https://pl.kotl.in/Q1PY9OvAu | |
// | |
// Write a function called "reconcileHelper" that processes two arrays of integers. | |
// Each array will have only distinct numbers (no repeats of the same integer in | |
// the same array), and the arrays are not sorted. | |
// Your job is to find out which numbers are in array 1, but not array 2, | |
// and which numbers are in array 2, but not in array 1. | |
// Your function should return a string formatted as so: | |
// "Numbers in array 1 that aren't in array 2: |
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.content.Context | |
import android.net.ConnectivityManager | |
import android.net.NetworkCapabilities | |
import android.os.Build | |
val Context.isConnected: Boolean | |
get() { | |
val connectivityManager = this.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager | |
return when { | |
Build.VERSION.SDK_INT >= Build.VERSION_CODES.M -> { |
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
package uk.co.thewirelessguy.thewirelessguy.extensions | |
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout | |
fun SwipeRefreshLayout?.start() { | |
this?.apply { | |
isRefreshing = true | |
isEnabled = false | |
} | |
} |
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
package uk.co.thewirelessguy.thewirelessguy.widget | |
import android.content.Context | |
import android.graphics.Canvas | |
import android.text.BoringLayout | |
import android.text.Layout | |
import android.text.TextUtils | |
import android.util.AttributeSet | |
import android.view.Gravity | |
import androidx.appcompat.widget.AppCompatTextView |
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
<?php | |
# Create new Magento admin user programmatically. | |
require_once('./app/Mage.php'); | |
umask(0); | |
Mage::app(); | |
try { | |
$user = Mage::getModel('admin/user') | |
->setData(array( | |
'username' => 'admin1', |
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
// | |
// GetAppIcon.swift | |
// | |
// Get the AppIcon from Assets and return it as a UIImage | |
// Created by Stephen Mullen | |
// | |
import UIKit | |
func getAppIcon() -> UIImage { |
NewerOlder