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
//terminal script:(takes 3 sec to setup) http://stackoverflow.com/questions/12306223/how-to-manually-create-icns-files-using-iconutil | |
//or drag and drop solution (sketchy website, download is a hex file, no link to devs): https://iconverticons.com/online/ | |
Here's a script to convert a 1024x1024 png (named "Icon1024.png") to the required icns file. Save it to a filed called "CreateICNS.src" in the folder where your png file is then in terminal "cd" to the same folder and type "source CreateICNS.src" to call it: | |
mkdir MyIcon.iconset | |
sips -z 16 16 Icon1024.png --out MyIcon.iconset/icon_16x16.png | |
sips -z 32 32 Icon1024.png --out MyIcon.iconset/[email protected] | |
sips -z 32 32 Icon1024.png --out MyIcon.iconset/icon_32x32.png | |
sips -z 64 64 Icon1024.png --out MyIcon.iconset/[email protected] |
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 Cocoa | |
import XCPlayground | |
import XCTest | |
class FlippedView:NSView {//Organizes your view from top to bottom | |
override var flipped:Bool { | |
get { | |
return true | |
} |
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 Cocoa | |
import XCPlayground | |
import XCTest | |
/* | |
shadow.shadowColor = NSColor.blackColor().colorWithAlphaComponent(1.0) | |
shadow.shadowOffset = NSMakeSize(0.1, 0.1) | |
shadow.shadowBlurRadius = 15 | |
*/ | |
extension NSShadow{ |
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 Cocoa | |
/* | |
let a = TempNSView(frame:NSRect(0,0,100,100)) | |
a.name = "a" | |
addSubview(a) | |
let b = TempNSView(frame:NSRect(50,50,100,100)) | |
b.name = "b" |
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
class TranslucentWin:NSWindow, NSApplicationDelegate, NSWindowDelegate{ | |
/** | |
* | |
*/ | |
override init(contentRect: NSRect, styleMask aStyle: Int, backing bufferingType: NSBackingStoreType, `defer` flag: Bool) { | |
super.init(contentRect: Win.sizeRect, styleMask: NSTitledWindowMask|NSResizableWindowMask|NSMiniaturizableWindowMask|NSClosableWindowMask|NSFullSizeContentViewWindowMask, backing: NSBackingStoreType.Buffered, `defer`: false) | |
self.contentView!.wantsLayer = true;/*this can and is set in the view*/ | |
self.backgroundColor = NSColor.greenColor().alpha(0.2) | |
self.opaque = false | |
self.makeKeyAndOrderFront(nil)//moves the window to the front |
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 | |
/* | |
* TODO: Implement the immediate variable if its needed (it would be a way to get assert the 1-level down immediate child an event came from, rather than the origin child which can be many levels deeper in the hirarchy) | |
*/ | |
class Event{ | |
static var update:String = "eventUpdate"/*Idealy I would name this change but apparently then subclasses can name their const the same*/ | |
var type:String | |
var origin:AnyObject/*origin sender of event, this could also be weak if you discover a memory leak*/ | |
/*var immediate:Any?*///prev sender of event, may be implemented in the future if needed |
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>groupInfo</key> | |
<dict> | |
<key>expandAfterMode</key> | |
<integer>0</integer> | |
<key>groupName</key> | |
<string>markdown</string> |
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
- [ ] %| | mtd | |
[%filltext:name=the title:default=here%](%clipboard) | lnk | |
![%filltext:name=img:default=img%](%clipboard) | img | |
```%filltext:name=lang% %| ``` | fence | |
**%clipboard** | bld | |
~~%clipboard~~ | strike | |
<img width="%filltext:name=width:default=320%" alt="%filltext:name=img:default=img%" src="https://dl.dropboxusercontent.com/u/2559476/%clipboard"> | rimg | |
``` %clipboard%| ``` | fe | |
* [[%clipboard]] | sbi | |
_%clipboard_ | italic |
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 | |
protocol ILayout{ | |
init(_ args:Double...) | |
} | |
class Fillet:ILayout{ | |
required init(_ args:Double...){ | |
Swift.print("Fillet: " + "\(args.count)") | |
} | |
} | |
class Margin:ILayout{ |
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
private func createDisplayLink() { | |
CVDisplayLinkCreateWithActiveCGDisplays(&displayLink) | |
guard let displayLink = displayLink else { | |
return | |
} | |
let callback: CVDisplayLinkOutputCallback = { (_, _, _, _, _, userInfo) -> CVReturn in | |
let myView = Unmanaged<MyView>.fromOpaque(COpaquePointer(userInfo)).takeUnretainedValue() | |
dispatch_async(dispatch_get_main_queue()) { | |
myView.update() |
OlderNewer