Skip to content

Instantly share code, notes, and snippets.

View tib's full-sized avatar
🪶
Just flying around...

Tibor Bödecs tib

🪶
Just flying around...
View GitHub Profile
#! /usr/bin/swift
//
// - This is just some AppKit boilerplate to launch a window.
//
import AppKit
@available(OSX 10.15, *)
class AppDelegate: NSObject, NSApplicationDelegate {
let window = NSWindow()
let windowDelegate = WindowDelegate()
@tib
tib / main.swift
Created February 17, 2020 08:32 — forked from pofat/main.swift
How to write main function in a Swift iOS project
import Foundation
import UIKit
private let pointer = UnsafeMutableRawPointer(CommandLine.unsafeArgv).bindMemory(to: UnsafeMutablePointer<Int8>.self, capacity: Int(CommandLine.argc))
UIApplicationMain(CommandLine.argc, pointer, NSStringFromClass(UIApplication.self), NSStringFromClass(AppDelegate.self))
// Remeber to comment or remove `@UIApplicationMain` in your AppDelegate.swift
@tib
tib / ncurses_mouse_movement.c
Created May 20, 2021 15:02 — forked from sylt/ncurses_mouse_movement.c
Mouse movement example for NCURSES
// I had problems getting mouse movement events working in ncurses, but after
// some research, it seems as if this is how you can do it. The magic is in the
// printf("\033[?1003h\n") which was the missing piece in the puzzle for me
// (see console_codes(4) for more information). 1003 means here that all events
// (even position updates) will be reported.
//
// This seems to work in at least three X-based terminals that I've tested:
// xterm, urxvt and gnome-terminal. It doesn't work when testing in a "normal"
// terminal, with GPM enabled. Perhaps something for the next gist version? :)