├── SimpleMailForwarderDkim ├── Dockerfile │ ├── TrustedHosts │ ├── supervisord.conf │ ├── opendkim.conf │ └── Dockerfile └── docker-compose.yml ├── WordPressDocker ├── php-uploads.ini ├── nginx.conf └── docker-compose.yml ├── Common.Wpf ├── Common.Wpf.csproj ├── ViewModel │ └── ViewModelBase.cs └── Command │ ├── CommandBase.cs │ └── GenericCommand.cs ├── InterviewPrep ├── Codility │ └── Palladium2020 │ │ ├── Palladium2020.csproj │ │ ├── Palladium2020.sln │ │ └── Program.cs └── LeetCode │ ├── find-the-town-judge.py │ ├── reorganize-string.py │ ├── remove-linked-list-elements.py │ └── find-and-replace-in-string.py ├── ReflectionEmitClassGeneration ├── ViewModel │ ├── ItemViewModelBase.cs │ └── MainWindowViewModel.cs ├── App.xaml ├── ReflectionEmitClassGeneration.csproj ├── App.xaml.cs ├── View │ ├── MainWindow.xaml.cs │ └── MainWindow.xaml ├── ReflectionEmitClassGeneration.sln └── Types │ └── TypeGenerator.cs ├── TPLDataflowProcessing ├── App.xaml.cs ├── App.xaml ├── TPLDataflowProcessing.csproj ├── View │ ├── MainWindow.xaml.cs │ └── MainWindow.xaml ├── TPLDataflowProcessing.sln ├── Model │ └── MockPriceFeed.cs └── ViewModel │ ├── PriceEventViewModel.cs │ └── MainWindowViewModel.cs ├── README.md ├── react-native-firebase-socialauth ├── GoogleProvider.js ├── TwitterProvider.js ├── FacebookProvider.js ├── LoginFunctions.js └── EmailProvider.js ├── .gitignore └── LICENSE /SimpleMailForwarderDkim/Dockerfile/TrustedHosts: -------------------------------------------------------------------------------- 1 | 127.0.0.1 2 | localhost 3 | 192.168.0.1/24 4 | -------------------------------------------------------------------------------- /WordPressDocker/php-uploads.ini: -------------------------------------------------------------------------------- 1 | 2 | # 3 | # Allow larger file uploads 4 | # 5 | file_uploads = On 6 | memory_limit = 64M 7 | upload_max_filesize = 64M 8 | post_max_size = 64M 9 | max_execution_time = 600 10 | 11 | -------------------------------------------------------------------------------- /Common.Wpf/Common.Wpf.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netcoreapp3.0 5 | true 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /InterviewPrep/Codility/Palladium2020/Palladium2020.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Exe 5 | netcoreapp3.1 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ReflectionEmitClassGeneration/ViewModel/ItemViewModelBase.cs: -------------------------------------------------------------------------------- 1 | using Common.Wpf.ViewModel; 2 | 3 | namespace ReflectionEmitClassGeneration.ViewModel 4 | { 5 | public class ItemViewModelBase: ViewModelBase 6 | { 7 | public ItemViewModelBase() 8 | { 9 | 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /ReflectionEmitClassGeneration/App.xaml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /ReflectionEmitClassGeneration/ReflectionEmitClassGeneration.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | WinExe 5 | netcoreapp3.0 6 | true 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /SimpleMailForwarderDkim/Dockerfile/supervisord.conf: -------------------------------------------------------------------------------- 1 | [supervisord] 2 | nodaemon=true 3 | 4 | [program:smf] 5 | command=/entrypoint.sh 6 | autostart = true 7 | autorestart = true 8 | stdout_logfile=/dev/stdout 9 | stdout_logfile_maxbytes=0 10 | [program:smfopendkim] 11 | command=/usr/sbin/opendkim -f -x /etc/opendkim/opendkim.conf 12 | 13 | autostart = true 14 | stdout_logfile=/dev/stdout 15 | stdout_logfile_maxbytes=0 -------------------------------------------------------------------------------- /TPLDataflowProcessing/App.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Configuration; 4 | using System.Data; 5 | using System.Linq; 6 | using System.Threading.Tasks; 7 | using System.Windows; 8 | 9 | namespace TPLDataflowProcessing 10 | { 11 | /// 12 | /// Interaction logic for App.xaml 13 | /// 14 | public partial class App : Application 15 | { 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /TPLDataflowProcessing/App.xaml: -------------------------------------------------------------------------------- 1 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /ReflectionEmitClassGeneration/App.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Configuration; 4 | using System.Data; 5 | using System.Linq; 6 | using System.Threading.Tasks; 7 | using System.Windows; 8 | 9 | namespace ReflectionEmitClassGeneration 10 | { 11 | /// 12 | /// Interaction logic for App.xaml 13 | /// 14 | public partial class App : Application 15 | { 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /ReflectionEmitClassGeneration/View/MainWindow.xaml.cs: -------------------------------------------------------------------------------- 1 | using ReflectionEmitClassGeneration.ViewModel; 2 | using System.Collections.ObjectModel; 3 | using System.ComponentModel; 4 | using System.Windows; 5 | 6 | namespace ReflectionEmitClassGeneration.View 7 | { 8 | /// 9 | /// Interaction logic for MainWindow.xaml 10 | /// 11 | public partial class MainWindow : Window 12 | { 13 | public MainWindow() 14 | { 15 | InitializeComponent(); 16 | 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Common.Wpf/ViewModel/ViewModelBase.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel; 3 | using System.Runtime.CompilerServices; 4 | 5 | namespace Common.Wpf.ViewModel 6 | { 7 | public abstract class ViewModelBase : INotifyPropertyChanged 8 | { 9 | public event PropertyChangedEventHandler PropertyChanged; 10 | 11 | public void NotifyPropertyChanged([CallerMemberName] String propertyName = "") 12 | { 13 | PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); 14 | } 15 | 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Common.Wpf/Command/CommandBase.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Windows.Input; 3 | 4 | namespace Common.Wpf.Command 5 | { 6 | public abstract class CommandBase : ICommand 7 | { 8 | public virtual bool CanExecute(object parameter) 9 | { 10 | return true; 11 | } 12 | 13 | public abstract void Execute(object parameter); 14 | 15 | public event EventHandler CanExecuteChanged 16 | { 17 | add { CommandManager.RequerySuggested += value; } 18 | remove { CommandManager.RequerySuggested -= value; } 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /TPLDataflowProcessing/TPLDataflowProcessing.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | WinExe 5 | netcoreapp3.0 6 | true 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /SimpleMailForwarderDkim/Dockerfile/opendkim.conf: -------------------------------------------------------------------------------- 1 | AutoRestart Yes 2 | AutoRestartRate 10/1h 3 | UMask 002 4 | Syslog yes 5 | SyslogSuccess Yes 6 | LogWhy Yes 7 | Canonicalization relaxed/simple 8 | ExternalIgnoreList refile:/etc/opendkim/TrustedHosts 9 | InternalHosts refile:/etc/opendkim/TrustedHosts 10 | KeyTable refile:/etc/opendkim/KeyTable 11 | SigningTable refile:/etc/opendkim/SigningTable 12 | Mode sv 13 | PidFile /var/run/opendkim/opendkim.pid 14 | SignatureAlgorithm rsa-sha256 15 | UserID opendkim:opendkim 16 | Socket inet:8891@localhost 17 | -------------------------------------------------------------------------------- /SimpleMailForwarderDkim/docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '3.7' 2 | 3 | services: 4 | mail: 5 | build: 6 | context: Dockerfile 7 | dockerfile: Dockerfile 8 | args: 9 | SMF_EMAILDOMAIN: 'yourdomain.com' 10 | container_name: mail 11 | ports: 12 | - 25:25 13 | - 110:110 14 | - 995:995 15 | - 993:993 16 | - 143:143 17 | - 465:465 18 | - 587:587 19 | - 4190:4190 20 | restart: always 21 | volumes: 22 | - ./ssl_certs/smtp.key:/etc/postfix/cert/smtp.key 23 | - ./ssl_certs/smtp.cert:/etc/postfix/cert/smtp.cert 24 | - ./dkim/:/etc/opendkim/keys/ 25 | environment: 26 | SMF_CONFIG: 'yourdomain.com:your@email.com' 27 | SMF_DOMAIN: 'yourdomain.com' 28 | -------------------------------------------------------------------------------- /TPLDataflowProcessing/View/MainWindow.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Navigation; 14 | using System.Windows.Shapes; 15 | 16 | namespace TPLDataflowProcessing 17 | { 18 | /// 19 | /// Interaction logic for MainWindow.xaml 20 | /// 21 | public partial class MainWindow : Window 22 | { 23 | public MainWindow() 24 | { 25 | InitializeComponent(); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /InterviewPrep/LeetCode/find-the-town-judge.py: -------------------------------------------------------------------------------- 1 | from typing import List 2 | class Solution: 3 | def findJudge(self, N: int, trust: List[List[int]]) -> int: 4 | trustCount = {} 5 | for i in range(N): 6 | trustCount[i+1] = {"trusts": 0, "trusted": 0} 7 | for entry in trust: 8 | trustCount[entry[0]]["trusts"] += 1 9 | trustCount[entry[1]]["trusted"] += 1 10 | couldBeJudge = None 11 | for i in range(N): 12 | entry = trustCount[i + 1] 13 | if entry["trusts"] == 0 and entry["trusted"] == N -1: 14 | if couldBeJudge is not None: 15 | return -1 16 | couldBeJudge = i + 1 17 | if couldBeJudge is None: 18 | return -1 19 | return couldBeJudge 20 | 21 | sol = Solution() 22 | result = sol.findJudge(2, [[1,2]]) 23 | print(result) -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Public Samples 2 | You can find various snippets available for educational purposes in this repo: 3 | ### WordPress Docker 4 | Docker-compose files to allow you to spin up a wordpress site with https 5 | ### Simple Mail Forwarder DKIM 6 | Attempt at using docker-compose to spin up Zixia's Simple Mail Forwarder with added DKIM signing on top 7 | ### React Native Firebase Social Auth 8 | React Native samples on how to sign up users using Firebase's social auth and email/password signup 9 | ### Reflection.Emit Class Generation 10 | C# .NET Core code and sample WPF app showing how to generate a new type at runtime using Reflection.Emit 11 | ### TPL Dataflow Processing Pipeline 12 | C# .NET Core app to demo functionality of the TPL Dataflow library for parallel data processing 13 | ### Interview Prep 14 | Code snippets for various Codility and LeetCode questions in Python and C# 15 | 16 | -------------------------------------------------------------------------------- /Common.Wpf/Command/GenericCommand.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Common.Wpf.Command 4 | { 5 | public class GenericCommand : CommandBase 6 | { 7 | private readonly Action _commandAction; 8 | private readonly Func _canExecute; 9 | 10 | public GenericCommand(Action commandAction) 11 | { 12 | _commandAction = commandAction; 13 | } 14 | 15 | public GenericCommand(Action commandAction, Func canExecute) : this(commandAction) 16 | { 17 | _canExecute = canExecute; 18 | } 19 | 20 | public override void Execute(object parameter) 21 | { 22 | _commandAction.Invoke(); 23 | } 24 | 25 | public override bool CanExecute(object obj) 26 | { 27 | var result = ((_canExecute == null) || 28 | (_canExecute != null && _canExecute(obj))) && 29 | 30 | base.CanExecute(obj); 31 | 32 | return result; 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /InterviewPrep/LeetCode/reorganize-string.py: -------------------------------------------------------------------------------- 1 | class Solution: 2 | def reorganizeString(self, S: str) -> str: 3 | charDict = {} 4 | for c in S: 5 | if c in charDict: 6 | charDict[c] = charDict[c] + 1 7 | else: 8 | charDict[c] = 1 9 | maxVal = max(charDict.values()) 10 | 11 | result = '' 12 | if maxVal > ((len(S) / 2) + 0.5): 13 | return result 14 | 15 | while len(result) != len(S): 16 | sortedKeys = sorted(charDict, key=charDict.get, reverse=True) 17 | result = result + sortedKeys[0] 18 | charDict[sortedKeys[0]] = charDict[sortedKeys[0]] - 1 19 | if charDict[sortedKeys[1]] > 0: 20 | result = result + sortedKeys[1] 21 | charDict[sortedKeys[1]] = charDict[sortedKeys[1]] - 1 22 | 23 | return result 24 | 25 | sol = Solution() 26 | result = sol.reorganizeString("aaab") 27 | print(result) 28 | result = sol.reorganizeString("aab") 29 | print(result) 30 | result = sol.reorganizeString("aaacb") 31 | print(result) -------------------------------------------------------------------------------- /react-native-firebase-socialauth/GoogleProvider.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import { Button } from 'react-native' 3 | import auth from '@react-native-firebase/auth'; 4 | import { GoogleSignin } from '@react-native-community/google-signin'; 5 | import LoginFunctions from './LoginFunctions'; 6 | 7 | const webClientId = "YOUR_KEY_HERE"; 8 | 9 | export default class GoogleProvider extends Component { 10 | constructor(props) { 11 | super(props) 12 | } 13 | 14 | render() { 15 | return ( 16 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /TPLDataflowProcessing/TPLDataflowProcessing.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 16 4 | VisualStudioVersion = 16.0.29411.108 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TPLDataflowProcessing", "TPLDataflowProcessing.csproj", "{6F1C1BF7-46D9-4401-8C7A-E0D0CFE420C5}" 7 | EndProject 8 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Common.Wpf", "..\Common.Wpf\Common.Wpf.csproj", "{DAD4476B-351A-46EE-9D14-EF3902F18E75}" 9 | EndProject 10 | Global 11 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 12 | Debug|Any CPU = Debug|Any CPU 13 | Release|Any CPU = Release|Any CPU 14 | EndGlobalSection 15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 16 | {6F1C1BF7-46D9-4401-8C7A-E0D0CFE420C5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 17 | {6F1C1BF7-46D9-4401-8C7A-E0D0CFE420C5}.Debug|Any CPU.Build.0 = Debug|Any CPU 18 | {6F1C1BF7-46D9-4401-8C7A-E0D0CFE420C5}.Release|Any CPU.ActiveCfg = Release|Any CPU 19 | {6F1C1BF7-46D9-4401-8C7A-E0D0CFE420C5}.Release|Any CPU.Build.0 = Release|Any CPU 20 | {DAD4476B-351A-46EE-9D14-EF3902F18E75}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 21 | {DAD4476B-351A-46EE-9D14-EF3902F18E75}.Debug|Any CPU.Build.0 = Debug|Any CPU 22 | {DAD4476B-351A-46EE-9D14-EF3902F18E75}.Release|Any CPU.ActiveCfg = Release|Any CPU 23 | {DAD4476B-351A-46EE-9D14-EF3902F18E75}.Release|Any CPU.Build.0 = Release|Any CPU 24 | EndGlobalSection 25 | GlobalSection(SolutionProperties) = preSolution 26 | HideSolutionNode = FALSE 27 | EndGlobalSection 28 | GlobalSection(ExtensibilityGlobals) = postSolution 29 | SolutionGuid = {7625D392-52B8-4A05-86AF-68EC73AC5669} 30 | EndGlobalSection 31 | EndGlobal 32 | -------------------------------------------------------------------------------- /react-native-firebase-socialauth/FacebookProvider.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import { Button } from 'react-native' 3 | import { AccessToken, LoginManager, GraphRequest, GraphRequestManager } from 'react-native-fbsdk'; 4 | import auth from '@react-native-firebase/auth'; 5 | import LoginFunctions from './LoginFunctions'; 6 | 7 | export default class FacebookProvider extends Component { 8 | constructor(props) { 9 | super(props) 10 | } 11 | 12 | render() { 13 | return ( 14 | 60 | 63 | 64 | 65 | -------------------------------------------------------------------------------- /InterviewPrep/Codility/Palladium2020/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Palladium2020 4 | { 5 | class Program 6 | { 7 | static void Main(string[] args) 8 | { 9 | var H = new[] { 1, 1, 7, 6, 6, 6 }; 10 | var ans = solution(H); 11 | 12 | } 13 | 14 | // Second go at solution, using an array to hold the max seen hight at any position 15 | public static int solution(int[] H) 16 | { 17 | if (H.Length == 0) 18 | return 0; 19 | else if (H.Length == 1) 20 | return H[0]; 21 | else 22 | { 23 | var bestResult = int.MaxValue; 24 | var maxArray1 = new int[H.Length]; 25 | var maxArray2 = new int[H.Length]; 26 | var maxArray1Total = 0; 27 | var maxArray2Total = 0; 28 | { 29 | var maxSeen1 = int.MinValue; 30 | var maxSeen2 = int.MinValue; 31 | for (int i = 0; i < H.Length; i++) 32 | { 33 | if (H[i] > maxSeen1) 34 | maxSeen1 = H[i]; 35 | 36 | if (H[H.Length - i - 1] > maxSeen2) 37 | maxSeen2 = H[H.Length - i - 1]; 38 | 39 | maxArray1[i] = maxSeen1; 40 | maxArray1Total += maxSeen1; 41 | 42 | maxArray2[i] = maxSeen2; 43 | maxArray2Total += maxSeen2; 44 | } 45 | 46 | // working from left and right, figure out the least required canvas areas 47 | for (int i = 0; i < H.Length; i++) 48 | { 49 | var total1 = (maxArray1[i] * (i + 1)) + (maxArray1[H.Length - 1] * (H.Length - i - 1)); 50 | var total2 = (maxArray2[i] * (i + 1)) + (maxArray2[H.Length - 1] * (H.Length - i - 1)); 51 | if (total1 < bestResult) 52 | bestResult = total1; 53 | if (total2 < bestResult) 54 | bestResult = total2; 55 | } 56 | return bestResult; 57 | } 58 | } 59 | } 60 | 61 | // Brute force answer at every position 62 | public static int solution1(int[] H) 63 | { 64 | if (H.Length == 0) 65 | return 0; 66 | else if (H.Length == 1) 67 | return H[0]; 68 | else 69 | { 70 | var bestResult = -1; 71 | for (int i = 0; i < H.Length; i++) 72 | { 73 | var max1 = Max(H, 0, i); 74 | var max2 = Max(H, i + 1, H.Length - 1); 75 | var total = (max1 * (i + 1)) + ((max2 * (H.Length - (i + 1)))); 76 | if (bestResult == -1 || bestResult > total) 77 | bestResult = total; 78 | } 79 | return bestResult; 80 | } 81 | } 82 | 83 | private static int Max(int[] h, int start, int finish) 84 | { 85 | var max = int.MinValue; 86 | for (int i = start; i < finish + 1; i++) 87 | if (max < h[i]) 88 | max = h[i]; 89 | return max; 90 | } 91 | } 92 | } 93 | -------------------------------------------------------------------------------- /ReflectionEmitClassGeneration/ViewModel/MainWindowViewModel.cs: -------------------------------------------------------------------------------- 1 | using ReflectionEmitClassGeneration.Types; 2 | using System; 3 | using System.Collections; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Threading.Tasks; 7 | using System.Windows.Input; 8 | using Common.Wpf.Command; 9 | using Common.Wpf.ViewModel; 10 | 11 | namespace ReflectionEmitClassGeneration.ViewModel 12 | { 13 | public class MainWindowViewModel : ViewModelBase 14 | { 15 | private IList items; 16 | private Dictionary _properties; 17 | private string _newPropertyName; 18 | private TypeGeneratorGeneric _typeGenerator; 19 | 20 | private static object _feedLock = new object(); 21 | private bool _feedRunning; 22 | 23 | public MainWindowViewModel() 24 | { 25 | GenerateItemCommand = new GenericCommand(GenerateItems, obj => 26 | { 27 | return !string.IsNullOrEmpty(obj?.ToString()) && 28 | !_properties.ContainsKey(obj.ToString()); 29 | }); 30 | _properties = new Dictionary(); 31 | _newPropertyName = "Id"; 32 | GenerateItems(); 33 | StartDataFeed(); 34 | } 35 | 36 | public IList Items 37 | { 38 | get => items; 39 | set 40 | { 41 | items = value; 42 | NotifyPropertyChanged(); 43 | } 44 | } 45 | 46 | public ICommand GenerateItemCommand { get; } 47 | 48 | public string NewPropertyName 49 | { 50 | get => _newPropertyName; 51 | set 52 | { 53 | _newPropertyName = value; 54 | NotifyPropertyChanged(); 55 | } 56 | } 57 | 58 | public void GenerateItems() 59 | { 60 | _properties.Add(NewPropertyName, typeof(int)); 61 | NewPropertyName = null; 62 | _typeGenerator = new TypeGeneratorGeneric(_properties); 63 | var items = new List(); 64 | for (var i = 0; i < 10; i++) 65 | { 66 | var newObject = _typeGenerator.CreateInstance(new Dictionary { { "Id", i } }); 67 | items.Add(newObject); 68 | } 69 | 70 | Items = _typeGenerator.CreateList(items.ToArray()); 71 | } 72 | 73 | private async void StartDataFeed() 74 | { 75 | lock (_feedLock) 76 | _feedRunning = true; 77 | while (_feedRunning) 78 | { 79 | await Task.Delay(500); 80 | if (_properties.Count() == 1) continue; 81 | lock (_feedLock) 82 | { 83 | foreach (var item in Items) 84 | { 85 | var data = GetRandomData(); 86 | var vm = item as ItemViewModelBase; 87 | _typeGenerator.SetValues(vm, data); 88 | foreach (var property in _properties) 89 | vm.NotifyPropertyChanged(property.Key); 90 | 91 | 92 | } 93 | } 94 | } 95 | } 96 | 97 | private Dictionary GetRandomData() 98 | { 99 | var random = new Random(); 100 | var valuesDict = new Dictionary(); 101 | foreach (var property in _properties) 102 | { 103 | if (property.Key == "Id") continue; 104 | valuesDict.Add(property.Key, random.Next()); 105 | 106 | } 107 | return valuesDict; 108 | } 109 | 110 | ~MainWindowViewModel() 111 | { 112 | lock (_feedLock) 113 | _feedRunning = false; 114 | } 115 | } 116 | } 117 | -------------------------------------------------------------------------------- /react-native-firebase-socialauth/EmailProvider.js: -------------------------------------------------------------------------------- 1 | import React, { Component, StyleSheet } from 'react'; 2 | import { Button, TextInput, View, TouchableHighlight, Text } from 'react-native' 3 | import auth from '@react-native-firebase/auth'; 4 | import LoginFunctions from './LoginFunctions'; 5 | 6 | 7 | export default class EmailProvider extends Component { 8 | state = { 9 | email: '', 10 | password: '', 11 | password2: '', 12 | isEmailValid: true, 13 | isPasswordValid: true, 14 | showRegister: false 15 | }; 16 | 17 | constructor(props) { 18 | super(props) 19 | } 20 | 21 | render() { 22 | return ( 23 | 24 | { 29 | this.setState({ email: text }); 30 | }} 31 | error={this.state.isEmailValid} 32 | /> 33 | { 40 | this.setState({ password: text }); 41 | }} /> 42 | {this.state.showRegister ? 43 | 44 |