Skip to content

Instantly share code, notes, and snippets.

View IT-Delinquent's full-sized avatar
🏠
Working from home

Mark Harwood IT-Delinquent

🏠
Working from home
View GitHub Profile
@IT-Delinquent
IT-Delinquent / materialDesignStyleToggltButtonInWPFandXAML.xaml
Created June 22, 2021 16:17
materialDesignStyleToggltButtonInWPFandXAML
<Style TargetType="{x:Type ToggleButton}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ToggleButton}">
<Viewbox>
<Border x:Name="Border" CornerRadius="10"
Background="#FFFFFFFF"
Width="40" Height="20">
<Border.Effect>
<DropShadowEffect ShadowDepth="0.5" Direction="0" Opacity="0.3" />
import 'package:flutter/material.dart';
import 'package:rxdart_timer/blocs/timer_state.dart';
class TimerView extends StatefulWidget {
@override
_TimerViewState createState() => _TimerViewState();
}
class _TimerViewState extends State<TimerView> {
//Create a new instance of the timer for the stateful widget
StreamBuilder(
stream: _timerState.timerObservable,
builder: (context, snapshot){
if(snapshot.hasData){
return Text(snapshot.data)
}else{
return Text('No data')
}
}
)
import 'dart:async';
import 'package:rxdart/rxdart.dart';
///The class for the timer
class TimerState {
///The Stopwatch object for running the timer
final Stopwatch _sWatch = Stopwatch();
///Creating a BehaviorSubject of type String for the Stopwatch display
BehaviorSubject<String> _subjectDisplay;
@IT-Delinquent
IT-Delinquent / PowerShellGenerateSecurePassword.ps1
Created June 22, 2021 15:59
PowerShellGenerateSecurePassword
function New-RandomPassword(){
Add-Type -AssemblyName 'System.Web'
return [System.Web.Security.Membership]::GeneratePassword(10,5)
}
@IT-Delinquent
IT-Delinquent / PowerShellCodetoSendaCustomHTMLEmail.ps1
Last active June 22, 2021 15:56
PowerShell Code to Send a Custom HTML Email
#Define a valid SMTP server to send your emails through
$smtpServer = 'SERVER HERE' #e.g smtp.local.com
#Define a new SMTP object using the server defined above
$smtpObject = New-Object Net.Mail.SmtpClient($smtpServer)
#Create a new mail message object
$msg = New-Object Net.Mail.MailMessage
$msg.From = '[email protected]'
$msg.ReplyTo = '[email protected]'
$msg.BCC.Add('[email protected]')
@IT-Delinquent
IT-Delinquent / CustomHTMLEmailforPowerShell.html
Last active June 22, 2021 15:56
Custom HTML Email for PowerShell
<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml" xmlns:o="urn:schemas-microsoft-com:office:office">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<meta name="x-apple-disable-message-reformatting">
<title></title>
<!--[if mso]>
<noscript>
@IT-Delinquent
IT-Delinquent / iOSStyleToggleButtoninWPFandXAML.xaml
Last active June 21, 2023 01:45
iOS Style Toggle Button in WPF and XAML
<Style TargetType="{x:Type ToggleButton}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ToggleButton}">
<Viewbox>
<Border x:Name="Border" CornerRadius="10"
Background="#FFFFFFFF"
Width="40" Height="20">
<Border.Effect>
<DropShadowEffect ShadowDepth="0.5" Direction="0" Opacity="0.3" />