Skip to content

Instantly share code, notes, and snippets.

View tugcearar's full-sized avatar
🍋

Tuğçe Arar tugcearar

🍋
View GitHub Profile
@tugcearar
tugcearar / WebCacheCleaner.swift
Created August 19, 2021 08:55 — forked from insidegui/WebCacheCleaner.swift
Clear WKWebView's cookies and website data storage, very useful during development.
import Foundation
import WebKit
final class WebCacheCleaner {
class func clean() {
HTTPCookieStorage.shared.removeCookies(since: Date.distantPast)
print("[WebCacheCleaner] All cookies deleted")
WKWebsiteDataStore.default().fetchDataRecords(ofTypes: WKWebsiteDataStore.allWebsiteDataTypes()) { records in
@tugcearar
tugcearar / EmptyCollectionContractResolver.cs
Created February 26, 2018 13:25 — forked from ejsmith/EmptyCollectionContractResolver.cs
EmptyCollectionContractResolver
class EmptyCollectionContractResolver : DefaultContractResolver {
protected override JsonProperty CreateProperty(MemberInfo member, MemberSerialization memberSerialization) {
JsonProperty property = base.CreateProperty(member, memberSerialization);
Predicate<object> shouldSerialize = property.ShouldSerialize;
property.ShouldSerialize = obj => (shouldSerialize == null || shouldSerialize(obj)) && !IsEmptyCollection(property, obj);
return property;
}
private bool IsEmptyCollection(JsonProperty property, object target) {
@tugcearar
tugcearar / gist:a0bf9eaa92925e77da2141f2209cc15c
Created February 5, 2017 21:58 — forked from brianmed/gist:4e458d9116889b798a8c
Xamarin Forms custom webView renderer with activity load
***
In Shared code:
public class WebViewPage : ContentPage
{
}
...
await Navigation.PushAsync (new WebViewPage());