Skip to content

Instantly share code, notes, and snippets.

View mczachurski's full-sized avatar

Marcin Czachurski mczachurski

View GitHub Profile
import Foundation
extension Notification.Name {
static let darkModeEnabled = Notification.Name("net.sltch.vcoin.notifications.darkModeEnabled")
static let darkModeDisabled = Notification.Name("net.sltch.vcoin.notifications.darkModeDisabled")
}
import Foundation
import CoreData
import UIKit
class SettingsHandler : CoreDataHandler {
func getDefaultSettings() -> Settings {
var settingsList:[Settings] = []
@mczachurski
mczachurski / index.html
Created October 14, 2017 08:16
Simple maintenance page
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>Maintenance</title>
<link href=' http://fonts.googleapis.com/css?family=Roboto' rel='stylesheet' type='text/css'>
<style>
body {
background-color: #E74D3D;
font-family: Roboto;
var serviceAssembly = typeof(IGraphQLType).GetTypeInfo().Assembly;
builder.RegisterAssemblyTypes(serviceAssembly)
.Where(t => t.GetInterfaces()
.Any(i => i.IsAssignableFrom(typeof (IGraphQLType))))
.AsSelf();
public class GroupDto
{
public string Name { get; set; }
public string SvgIcon { get; set; }
}
public class GroupType : ObjectGraphType<GroupDto>, IGraphQLType
{
public GroupType()
{
Field(x => x.Name).Description("The group name.");
Field(x => x.SvgIcon).Description("The icon of group.");
}
}
var serviceAssembly = typeof(IResolver).GetTypeInfo().Assembly;
builder.RegisterAssemblyTypes(serviceAssembly)
.Where(t => t.Name.EndsWith("Resolver"))
.AsImplementedInterfaces()
.InstancePerLifetimeScope();
public class GroupsResolver : Resolver, IGroupsResolver
{
private readonly IGroupsService _groupsService;
public GroupsResolver(IGroupsService groupsService)
{
_groupsService = groupsService;
}
public void Resolve(GraphQLQuery graphQLQuery)
public interface IResolver
{
void Resolve(GraphQLQuery graphQLQuery);
}
public class GraphQLQuery : ObjectGraphType
{
public GraphQLQuery(IServiceProvider serviceProvider)
{
var type = typeof(IResolver);
var resolversTypes = AppDomain.CurrentDomain.GetAssemblies()
.SelectMany(s => s.GetTypes())
.Where(p => type.IsAssignableFrom(p));
foreach(var resolverType in resolversTypes)