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 tableView(tableView: NSTableView, acceptDrop info: NSDraggingInfo, row: Int, dropOperation: NSTableViewDropOperation) -> Bool { | |
var pasteboard = info.draggingPasteboard() | |
var rowData = pasteboard.dataForType(MyRowType) | |
if(rowData != nil) { | |
var dataArray = NSKeyedUnarchiver.unarchiveObjectWithData(rowData!) as! Array<NSIndexSet>, |
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 tableView(tableView: NSTableView, writeRowsWithIndexes: NSIndexSet, toPasteboard: NSPasteboard) -> Bool { | |
var data = NSKeyedArchiver.archivedDataWithRootObject([writeRowsWithIndexes]) | |
toPasteboard.declareTypes([MyRowType], owner:self) | |
toPasteboard.setData(data, forType:MyRowType) | |
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
let MyRowType = “MyRowType" |
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
override func viewDidLoad() { | |
// … | |
tableView.registerForDraggedTypes([MyRowType, NSFilenamesPboardType]) | |
//… | |
} |
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 tableView(tableView: NSTableView, validateDrop info: NSDraggingInfo, proposedRow row: Int, proposedDropOperation dropOperation: NSTableViewDropOperation) -> NSDragOperation { | |
tableView.setDropRow(row, dropOperation: NSTableViewDropOperation.Above) | |
return NSDragOperation.Move | |
} |
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
[ | |
{ | |
"name": "Stephen Bartholomew", | |
"email": "[email protected]", | |
"age": 34, | |
"languages": ["Ruby", "Javascript"] | |
}, | |
{ | |
"name": "Tim Peat", | |
"email": "[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
class Array | |
def to_annotated_xml(root) | |
output = "<#{root}>" | |
each do |i| | |
if i.is_a?(Fixnum) | |
output << "<number>#{i}</number>" | |
elsif i.is_a?(String) | |
if i.match(/@/) | |
output << "<email>#{i}</email>" |
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
# Example: | |
# rendered_content = t("rendering layout") do | |
# layout.render('item' => self, 'contents' => contents) | |
# end | |
# | |
def t(title, &block) | |
puts "===========" | |
puts title | |
beginning_time = Time.now | |
result = yield |
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
* | |
!y.php | |
!x.php | |
!folder_xy |
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
# Quick and dirty JS test runner | |
# | |
# Required files: | |
# {testdir} | |
# /index.html (rails specific sample below) | |
# <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" | |
# "http://www.w3.org/TR/html4/loose.dtd"> | |
# <html> | |
# <head> | |
# <link rel="stylesheet" href="<%= JS_TEST_BASE %>/qunit.css" type="text/css" media="screen" /> |
NewerOlder