Skip to content

Instantly share code, notes, and snippets.

Avatar

Miguel de Icaza migueldeicaza

View GitHub Profile
@migueldeicaza
migueldeicaza / MyTextLabel.swift
Created Jan 26, 2021 — forked from CrystDragon/MyTextLabel.swift
Most basic custom UITextInput conformance, without selection interaction, no UI elements but only pure texts.
View MyTextLabel.swift
import UIKit
class MyTextLabel: UIView {
var textLayer = CATextLayer()
var textStorage: String = "" {
didSet {
textLayer.string = textStorage
}
}
View gist:c0f01661b895f2333405279ccbb6c4c8
/Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift -frontend -c /Users/miguel/cvs/SwiftSH/SwiftSH/SSHLibrary.swift /Users/miguel/cvs/SwiftSH/SwiftSH/Queue.swift /Users/miguel/cvs/SwiftSH/SwiftSH/Session.swift /Users/miguel/cvs/SwiftSH/SwiftSH/ConsoleLogger.swift /Users/miguel/cvs/SwiftSH/SwiftSH/Error.swift /Users/miguel/cvs/SwiftSH/SwiftSH/Extensions.swift /Users/miguel/cvs/SwiftSH/SwiftSH/SFTP.swift /Users/miguel/cvs/SwiftSH/SwiftSH/Logger.swift /Users/miguel/cvs/SwiftSH/SwiftSH/Libssh2.swift /Users/miguel/cvs/SwiftSH/SwiftSH/Shell.swift /Users/miguel/cvs/SwiftSH/SwiftSH/SCP.swift /Users/miguel/cvs/SwiftSH/SwiftSH/DNS.swift -primary-file /Users/miguel/cvs/SwiftSH/SwiftSH/Channel.swift /Users/miguel/cvs/SwiftSH/SwiftSH/Command.swift -emit-module-path /Users/miguel/DerivedData/SwiftSH-cyqzhumcvedcnhajuftnadmnmmiy/Build/Intermediates.noindex/SwiftSH.build/Debug-iphonesimulator/SwiftSH.build/Objects-normal/x86_64/Channel\~partial.swiftmodule -emit-module-doc-pa
View problem.md

I have a problem with a native library dependency in my project SwiftTerm, the native library dependency is a wrapper for libssh, and I compile this as a .framework which I then reference from SwiftTerm.

The problem is that on the same system where I build the .framework, something makes the build system go poking at the original site where the code was built, and produces this error:

/Users/miguel/cvs/SwiftTerm/SwiftSH.binaries/module.modulemap:1:8: error: redefinition of module 'Libssh2'
module Libssh2 {
       ^
View gist:bdfee246a6baea13673fe088971298f8
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x10)
* frame #0: 0x00000001008e32ac mlir-translate`llvm::FunctionType::getReturnType(this=0x0000000000000000) const at DerivedTypes.h:129:40
frame #1: 0x00000001008e3135 mlir-translate`llvm::CallInst::CallInst(this=0x000000010741a020, Ty=0x0000000000000000, Func=0x0000000000000000, Args=ArrayRef<llvm::Value *> @ 0x00007ffeefbf9c58, Bundles=ArrayRef<llvm::OperandBundleDefT<llvm::Value *> > @ 0x00007ffeefbf9c80, NameStr=0x00007ffeefbf9e10, InsertBefore=0x0000000000000000) at Instructions.h:1632:20
frame #2: 0x00000001008e3040 mlir-translate`llvm::CallInst::CallInst(this=0x000000010741a020, Ty=0x0000000000000000, Func=0x0000000000000000, Args=ArrayRef<llvm::Value *> @ 0x00007ffeefbf9cd0, Bundles=ArrayRef<llvm::OperandBundleDefT<llvm::Value *> > @ 0x00007ffeefbf9cf0, NameStr=0x00007ffeefbf9e10, InsertBefore=0x0000000000000000) at Instructions.h:1636:30
frame #3: 0x00000001008e2d82 mlir-translate`llvm::CallIn
View gist:592905022620c58f938e7b6b70cb7028
$next = 0;
while (<>){
if (/DllImport/){
$import = $_;
$next = 1;
} elsif ($next){
($prefix, $func, $args) = $_ =~ /(.*) (TF_[A-Za-z0-9]*) (\(.*)/;
#print "Got [$prefix][$func][$args] - $_\n";
$res = $import;
$res =~ s/Library/Library, EntryPoint="$func"/;
@migueldeicaza
migueldeicaza / gist:624675f0edc9f5dd1a908bf547445987
Created Apr 2, 2018
Public type surface for System.Runtime.Extensions.dll
View gist:624675f0edc9f5dd1a908bf547445987
Assembly Information:
Culture=neutral
PublicKeyToken=b03f5f7f11d50a3a
System.AppDomain
System.AppDomainUnloadedException
System.ApplicationId
System.AssemblyLoadEventArgs
@migueldeicaza
migueldeicaza / gist:43b28ef3ceb8db59ffc00b70eb37f309
Created Apr 25, 2017
Dictionary-literal improvement to allow literals to be assigned to other Dictionary-shaped objects
View gist:43b28ef3ceb8db59ffc00b70eb37f309
--- /dev/null 2017-04-24 21:53:22.000000000 -0400
+++ README.md 2017-04-24 21:53:03.000000000 -0400
@@ -0,0 +1,67 @@
+Current work:
+
+Trying to allow the existing patch for dictionary literals that allows:
+
+ var a = ["key":"value"];
+
+Which creates an inferred Dictionary<string,string> above into
View gist:c3750f60ca77b476a3ba2c05b55b81c3
mono$ mono /usr/local//share/dotnet/sdk/1.0.0-preview3-004056/csc.exe
Could not load signature of Microsoft.CodeAnalysis.CommonCompiler:ResolveAnalyzersFromArguments due to: Could not load file or assembly 'System.Collections.Immutable, Version=1.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. assembly:System.Collections.Immutable, Version=1.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a type:<unknown type> member:<none>
Unhandled Exception:
System.TypeLoadException: Could not load type of field 'Microsoft.CodeAnalysis.CoreClrAnalyzerAssemblyLoader:_loadContext' (0) due to: Could not load file or assembly 'System.Runtime.Loader, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. assembly:System.Runtime.Loader, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a type:<unknown type> member:<none>
at Microsoft.CodeAnalysis.CommandLine.BuildClient.RunCompilation (System.Collections.Generic.IEnumerable`1[T] o
@migueldeicaza
migueldeicaza / gist:8de4f89b182588927ba16f31b214e35a
Created Sep 25, 2016
Minimal HoloLens app with UrhoSharp.
View gist:8de4f89b182588927ba16f31b214e35a
using System;
using Windows.ApplicationModel.Core;
using Urho;
using Urho.Holographics;
using Urho.HoloLens;
internal class Program
{
[MTAThread]
private static void Main()
@migueldeicaza
migueldeicaza / gist:96c2bc52bfc30aa47a3ba34ce135e6f1
Last active Sep 12, 2016
Implicit string constant to byte[]/byte* conversions for C#
View gist:96c2bc52bfc30aa47a3ba34ce135e6f1
diff --git a/mcs/mcs/constant.cs b/mcs/mcs/constant.cs
old mode 100644
new mode 100755
index a0ae78c..0f45e74
--- a/mcs/mcs/constant.cs
+++ b/mcs/mcs/constant.cs
@@ -12,6 +12,7 @@
using System;
using System.Globalization;