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
// Modified version of ContentView.swift from Pol Piella's blog | |
// post "Using Core Data and Swift Data side by side". | |
// | |
// See: https://www.polpiella.dev/core-data-and-swift-data | |
// | |
// Crux is in the `onAppear`. | |
// ``` | |
// .onAppear() { | |
// NotificationCenter.default.addObserver(forName: Notification.Name.NSManagedObjectContextDidSave, | |
// object: nil, |
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 UIKit | |
/// | |
///Declaration | |
/// | |
protocol UIViewBuilder: AnyObject {} | |
extension UIViewBuilder where Self: UIView { | |
init(_ build: ((Self) -> Void)) { |
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 <stdlib.h> | |
#include <stdio.h> | |
#include <string.h> | |
#include <xcb/xcb.h> | |
static void list_fonts(xcb_connection_t *c) | |
{ | |
// On my mac there are 10,000+ fonts! | |
uint16_t max_names = 20000; |
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
The answer, in case the question does not get enough reopen votes, is that you need to invoke the dll using `dotnet <dllname>`. | |
The easiest way to make sure that this works is to publish the app from Visual studio **Build > Publish To Folder...** and add | |
a script like the following in the produced folder. | |
```bash | |
#!/bin/bash | |
APP_NAME="HelloWorld" # Replace this with your app name | |
DIR="$(dirname ${BASH_SOURCE[0]})" | |
dotnet "$DIR"/"$APP_NAME".dll | |
``` |
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.swift | |
// | |
// Created by idz on 10/23/20. | |
// | |
import Foundation | |
import CryptoSwift | |
import CommonCrypto |
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
madra:tad danny$ npm install | |
> [email protected] install /Users/danny/Documents/GitHub/tad/tad/node_modules/sqlite3 | |
> node-pre-gyp install --fallback-to-build | |
node-pre-gyp WARN Using request for node-pre-gyp https download | |
node-pre-gyp WARN Tried to download(403): https://mapbox-node-binary.s3.amazonaws.com/sqlite3_ac/v4.1.1/node-v51-darwin-x64.tar.gz | |
node-pre-gyp WARN Pre-built binaries not found for [email protected] and [email protected] (node-v51 ABI, unknown) (falling back to source compile with node-gyp) | |
ACTION deps_sqlite3_gyp_action_before_build_target_unpack_sqlite_dep Release/obj/gen/sqlite-autoconf-3310100/sqlite3.c | |
TOUCH Release/obj.target/deps/action_before_build.stamp |
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
// | |
// ViewController.swift | |
// StockOverflowSceneKit | |
// | |
// Created by idz on 4/28/20. | |
// | |
import SceneKit | |
class TrianglePlane: SCNNode { |
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 <Foundation/Foundation.h> | |
#import <vector> // Needed for gist to compile. | |
#pragma mark - Pure Implementation Functions | |
const static unichar kUTF16Newline = (unichar)'\n'; // old naming habits die hard! | |
/** | |
* Calculates an array of line end "positions" for a given string. | |
* The equivalent Swift function was `(String) -> [Int]` or `(NSString) -> [Int]` | |
* | |
* In this context a "position" is the zero-based index of a newline | |
* character in the string as if it were an array of UTF-16 codepoints. |
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
func calculatorHelper() -> ParseTree { | |
let input = "2 + 8 / 2" | |
let lexer = VisitorCalcLexer(ANTLRInputStream(input)) | |
let parser = try! VisitorCalcParser(CommonTokenStream(lexer)) | |
return try! parser.s() | |
} | |
func calculatorHelper2() -> VisitorCalcParser { | |
let input = "2 + 8 / 2" | |
let lexer = VisitorCalcLexer(ANTLRInputStream(input)) |
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
protocol RecursiveSubSequence: Sequence where SubSequence: RecursiveSubSequence { } | |
extension String: RecursiveSubSequence { } | |
extension Substring: RecursiveSubSequence { } | |
extension Array: RecursiveSubSequence {} | |
extension ArraySlice: RecursiveSubSequence {} | |
func process<T>(_ value: T) -> T { return value } | |
func count<S: RecursiveSubSequence>(_ s: S) -> Int { |
NewerOlder