Skip to content

Instantly share code, notes, and snippets.

@GrantByrne
GrantByrne / UserValidator.cs
Created April 24, 2014 06:02
Using Fluent Validation with WPF - Dead Simple
using System.Text.RegularExpressions;
using FluentValidation;
using WpfFluentValidationExample.ViewModels;
namespace WpfFluentValidationExample.Lib
{
public class UserValidator : AbstractValidator<UserViewModel>
{
public UserValidator()
{
@cmoulton
cmoulton / URLSession Calls in Swift 4
Last active December 18, 2023 02:31
URLSession Calls in Swift 4
func makeGetCall() {
// Set up the URL request
let todoEndpoint: String = "https://jsonplaceholder.typicode.com/todos/1"
guard let url = URL(string: todoEndpoint) else {
print("Error: cannot create URL")
return
}
let urlRequest = URLRequest(url: url)
// set up the session
@danielplawgo
danielplawgo / MainWindow.xaml
Created June 14, 2018 04:06
Integracja Fluent Validation z WPF
<Window x:Class="FluentValidationWithWPF.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:FluentValidationWithWPF"
mc:Ignorable="d"
Title="MainWindow" Height="450" Width="800">
<StackPanel>
<TextBox Text="{Binding Email, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay, ValidatesOnDataErrors=True}"
import Foundation
// OAuth2Token structure
struct OAuth2Token: Codable {
let date = Date() // date when the token was initialized
var accessToken: String // access token
var refreshToken: String? // refresh token (optional)
var expiresIn: Int // seconds until token expires
var tokenType: String // for example "Bearer"
Prototypes in SwiftUI
https://youtu.be/1BHHybRnHFE
Animations SwiftUI
https://youtu.be/A4Byyls7zww
Clean code
https://youtu.be/7EmboKQH8lM
@Hiyorimi
Hiyorimi / apns.py
Last active January 15, 2023 15:40 — forked from alucard001/apns.py
Python3 Apple Push Notification HTTP/2 Example - Silent Push
"""
Use HTTP/2 send APNS Example main reference
===========================================
http://gobiko.com/blog/token-based-authentication-http2-example-apns/
Error 410 to detect uninstalls
==============================
https://leftshift.io/mobile-tracking-uninstalls-on-ios-and-android
https://developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/CommunicatingwithAPNs.html#//apple_ref/doc/uid/TP40008194-CH11-SW1
@Noluk1991
Noluk1991 / Устройство многопоточности в iOS (Podlodka iOS Crew. Season 3)
Last active July 11, 2024 10:37
Дополнительные материалы к докладу
// Разное интересное по многопоточности:
// Featured-секция, для любителей архивной документации от Apple:
1. https://developer.apple.com/library/archive/technotes/tn/tn2028.html#//apple_ref/doc/uid/DTS10003065 - про внутренности потоков в MAC OS X в сравнении с MAC OS 9
2. https://developer.apple.com/library/archive/documentation/Darwin/Conceptual/KernelProgramming/About/About.html - Kernel Programming guide, вы же понимаете, что там будет, да :D
// Для любителей WWDC:
1. https://developer.apple.com/videos/play/wwdc2015/718/ - GCD раз.
@filimo
filimo / WWDC.json
Created April 16, 2021 05:22 — forked from harishgonnabattula/WWDC.json
WWDC 2015-2018 Video urls and summary
[
{"url": "https://devstreaming-cdn.apple.com/videos/wwdc/2018/236mwbxbxjfsvns4jan/236/236_hd_avspeechsynthesizer_making_ios_talk.mp4?dl=1", "title": "AVSpeechSynthesizer: Making iOS Talk", "summary": "Speech can enhance the audio experience of your app, whether you are generating spoken feedback for accessibility, or providing critical information beyond simple alerts or notifications. AVSpeechSynthesizer produces synthesized speech from text and allows you to control and monitor the progress of ongoing speech. Learn the ins and outs of AVSpeechSynthesizer and how to add computer-generated speech output to your app."},
{"url": "https://devstreaming-cdn.apple.com/videos/wwdc/2018/405bjty1j94taqv8ii/405/405_hd_measuring_performance_using_logging.mp4?dl=1", "title": "Measuring Performance Using Logging", "summary": "Learn how to use signposts and logging to measure performance. Understand how the Points of Interest instrument can be used to examine logged data. Get an introduction into creating and using custo
@jbadger3
jbadger3 / parsing_character_entities_NSAttributedString.swift
Last active March 19, 2024 15:24
Gist for the article 'Parsing Character Entities from HTML/XML Content In Swift' on Medium.com
extension String {
init?(htmlEncodedString: String) {
guard let data = htmlEncodedString.data(using: .utf8) else {
return nil
}
let options: [NSAttributedString.DocumentReadingOptionKey: Any] = [
.documentType: NSAttributedString.DocumentType.html,
.characterEncoding: String.Encoding.utf8.rawValue
]
guard let attributedString = try? NSAttributedString(data: data, options: options, documentAttributes: nil) else {