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
import PerfectLib | |
import PostgreSQL | |
class FoodListHandler: PageHandler { | |
let dbHost = "localhost" | |
let dbName = "cat_food" | |
let dbUsername = //PUT YOUR SYSTEM USERNAME HERE! | |
let dbPassword = "" | |
func valuesForResponse(context: MustacheEvaluationContext, collector: MustacheEvaluationOutputCollector) throws -> MustacheEvaluationContext.MapType { |
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
PageHandlerRegistry.addPageHandler("FullFoodList") { | |
(r:WebResponse) -> PageHandler in | |
return FoodListHandler() | |
} |
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
import PerfectLib | |
// This function is required. The Perfect framework expects to find this function | |
// to do initialization | |
public func PerfectServerModuleInit() { | |
PageHandlerRegistry.addPageHandler("CatName") { | |
// This closure is called in order to create the handler object. | |
// It is called once for each relevant request. | |
// The supplied WebResponse object can be used to tailor the return value. |
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
import PerfectLib | |
class CatNameHandler: PageHandler { | |
func valuesForResponse(context: MustacheEvaluationContext, collector: MustacheEvaluationOutputCollector) throws -> MustacheEvaluationContext.MapType { | |
let dict:MustacheEvaluationContext.MapType = ["name": "Sasha"] | |
return dict | |
} | |
} |
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
# Makefile for CatFoodServer | |
TARGET = CatFoodServer | |
OS = $(shell uname) | |
SWIFT_FILES = $(TARGET)/PerfectHandlers.swift \ | |
$(TARGET)/CatNameHandler.swift \ | |
$(TARGET)/FoodListHandler.swift | |
MUSTACHE_ROOT = $(TARGET)/Mustache |
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
#if os(Linux) | |
import Glibc | |
#else | |
import Darwin | |
#endif | |
enum Logger { | |
static func info(string: String) { | |
fputs(string, stdout) | |
fflush(stdout) |
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
#include <stdio.h> | |
#include <stdlib.h> | |
#include <stdbool.h> | |
#include <stdint.h> | |
#include <string.h> | |
#include <unistd.h> | |
#include <fcntl.h> | |
#include <sys/mman.h> | |
/* For supporting Linux and other systems that don't have mach-o headers */ |
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"?> | |
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>application-identifier</key> | |
<string>io.abjurato.fancyname</string> | |
</dict> | |
</plist> |
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
// | |
// main.m | |
// EndpointSecurityDemo | |
// | |
// Created by Omar Ikram on 17/06/2019 - Catalina 10.15 Beta 1 (19A471t) | |
// Updated by Omar Ikram on 15/08/2019 - Catalina 10.15 Beta 5 (19A526h) | |
// Updated by Omar Ikram on 01/12/2019 - Catalina 10.15 (19A583) | |
// | |
#import <Foundation/Foundation.h> |
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
extension List { | |
@ViewBuilder func noSeparators() -> some View { | |
if #available(iOS 14.0, *) { | |
self | |
.accentColor(Color.secondary) | |
.listStyle(SidebarListStyle()) | |
.onAppear { | |
UITableView.appearance().backgroundColor = UIColor.systemBackground | |
} | |
} else { |
OlderNewer