Skip to content

Instantly share code, notes, and snippets.

@chriseidhof
chriseidhof / boilerplate.swift
Last active August 15, 2025 11:02
QuickMacApp
// Run any SwiftUI view as a Mac app.
import Cocoa
import SwiftUI
NSApplication.shared.run {
VStack {
Text("Hello, World")
.padding()
.background(Capsule().fill(Color.blue))
@ctreffs
ctreffs / main.swift
Created August 30, 2019 22:10
Minimal Cocoa/AppKit Swift Package Manager application (SwiftPM)
import AppKit
_ = NSApplication.shared
NSApp.setActivationPolicy(.regular)
//let delegate = AppDelegate()
//NSApplication.shared.delegate = delegate
let menubar = NSMenu()
let appMenuItem = NSMenuItem()
// This is the traditional version of the RxSwift-based gist posted here:
// https://gist.github.com/cliss/51cb740b14f3cd56ba1d11f2a9a6ba02
// This won’t compile and it surely has errors.
// (The same may be true as the original.)
// Some things are obviously omitted.
// It's meant as illustrative rather than as actual running code.
//
// The problem being solved:
// There is a text field. When you type in it, all changes are coalesced
// for 0.3 seconds, and then an HTTP call is made, and a table is updated
@dhh
dhh / gist:1014971
Created June 8, 2011 18:09
Use concerns to keep your models manageable
# autoload concerns
module YourApp
class Application < Rails::Application
config.autoload_paths += %W(
#{config.root}/app/controllers/concerns
#{config.root}/app/models/concerns
)
end
end
#!/bin/bash
### BEGIN INIT INFO
# Provides: APPLICATION
# Required-Start: $all
# Required-Stop: $network $local_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start the APPLICATION unicorns at boot
# Description: Enable APPLICATION at boot time.
### END INIT INFO
@rcmachado
rcmachado / html5.vim
Created December 15, 2009 10:35
Vim syntax file for HTML 5
" Vim syntax file
" Language: HTML (version 5)
" Maintainer: Rodrigo Machado <rcmachado@gmail.com>
" URL: http://gist.github.com/256840
" Last Change: 2010 Aug 26
" License: Public domain
" (but let me know if you liked it :) )
"
" Note: This file just adds the new tags from HTML 5
" and don't replace default html.vim syntax file