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
## Automate FTP uploads | |
## Go to destination | |
cd C:\Test | |
$location = Get-Location | |
"We are here: $location" | |
## Get files | |
$files = Get-ChildItem -recurse | |
## Get ftp object | |
$ftp_client = New-Object System.Net.WebClient | |
$ftp_address = "ftp://user:pass@adress:/home/chardcastle/test" |
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
deepCopy(obj) { | |
let copy; | |
// Handle the 3 simple types, and null or undefined | |
if (null == obj || "object" != typeof obj) return obj; | |
// Handle Date | |
if (obj instanceof Date) { | |
copy = new Date(); | |
copy.setTime(obj.getTime()); |
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
[Reflection.Assembly]::LoadWithPartialName('System.IO.Compression.FileSystem') | |
$files = [IO.Compression.ZipFile]::OpenRead($sourceFile).Entries | |
Write-Host $files |
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
$requiredFruit= @("apple","pear","nectarine","grape") | |
$someFruit= @("apple","banana","pear","nectarine","orange","grape") | |
$moreFruit= @("apple","banana","nectarine","grape") | |
-not @($requiredFruit| where {$someFruit -notcontains $_}).Count | |
-not @($requiredFruit| where {$moreFruit -notcontains $_}).Count | |
-not @($requiredFruit| where {$moreFruit -notcontains $_}| select -first 1).Count |
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
# https://docs.microsoft.com/en-gb/powershell/module/Microsoft.PowerShell.Archive/Expand-Archive?view=powershell-5.1 | |
Expand-Archive c:\a.zip -DestinationPath c:\a |
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
function isBase64(str) { | |
try { | |
return btoa(atob(str)) == str; | |
} catch (err) { | |
return 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
public interface IToastMessageService | |
{ | |
void ShowToastMessage(string message); | |
} |
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
[assembly: Xamarin.Forms.Dependency(typeof(ToastMessageService))] | |
namespace ToastTestXamarin.Droid | |
{ | |
public class ToastMessageService : IToastMessageService | |
{ | |
public void ShowToastMessage(string message) | |
{ | |
Toast.MakeText(Android.App.Application.Context, message, ToastLength.Long).Show(); | |
} | |
} |
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
<?xml version="1.0" encoding="utf-8" ?> | |
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms" | |
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" | |
xmlns:local="clr-namespace:ToastTestXamarin" | |
x:Class="ToastTestXamarin.MainPage"> | |
<Button x:Name="BtnToastMessage" Text="Show Toast" Clicked="ShowToast"></Button> | |
</ContentPage> |
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
private bool doubleBackToExitPressedOnce = false; | |
public override void OnBackPressed() | |
{ | |
if (doubleBackToExitPressedOnce) | |
{ | |
base.OnBackPressed(); | |
Java.Lang.JavaSystem.Exit(0); | |
return; | |
} |
OlderNewer