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
/** | |
Sample Propane caveatPatchor.js file based on tmm1's avatar hack. | |
You'll need at least version 1.1.1 to experiment with this: | |
http://propaneapp.com/appcast/Propane.1.1.1.zip | |
Once I'm sure exposing this hack-injection point doesn't cause problems | |
I'll do an official auto-updating version. | |
As of version 1.1.1, Propane will load and execute the contents of |
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
/* | |
As of version 1.1.2, Propane will load and execute the contents of | |
~Library/Application Support/Propane/unsupported/caveatPatchor.js | |
immediately following the execution of its own enhancer.js file. | |
You can use this mechanism to add your own customizations to Campfire | |
in Propane. | |
Below you'll find two customization examples. |
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
if (displayExpandedGists) { | |
Campfire.GistExpander = Class.create({ | |
initialize: function(chat) { | |
this.chat = chat; | |
var messages = this.chat.transcript.messages; | |
for (var i = 0; i < messages.length; i++) { | |
this.detectGistURL(messages[i]); | |
} | |
}, |
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
if (displayDataURLImages) { | |
Campfire.DataImageURLExpander = Class.create({ | |
initialize: function(chat) { | |
this.chat = chat; | |
var messages = this.chat.transcript.messages; | |
for (var i = 0; i < messages.length; i++) { | |
this.detectDataURLImage(messages[i]); | |
} | |
}, |
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
/* | |
Add a /clear command to clear out the chat transcript in Propane. | |
Place this snippet into: | |
~Library/Application Support/Propane/unsupported/caveatPatchor.js | |
*/ | |
Campfire.Speaker.Filters.push( | |
function(message) { | |
var match; | |
if (match = message.match(/^\/clear\s*$/)) { |
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
var displayInstagramImages = true; | |
if (displayInstagramImages) { | |
Campfire.InstagramExpander = Class.create({ | |
initialize: function(chat) { | |
this.chat = chat; | |
var messages = this.chat.transcript.messages; | |
for (var i = 0; i < messages.length; i++) { | |
this.detectInstagramURL(messages[i]); |
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
Had some great suggestions. | |
'set' came up a few times. It makes sense, "set the error ptrptr with your | |
last error". Unfortunately there's too much baggage with property setters | |
for that to work. | |
'propagate' was a good one too, but it also has a little bit of baggage, | |
at least for me, because propagate is often a word I use to describe the | |
larger concept of errors propagating up the stack. That's not the job of | |
this one little method. |
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 P { | |
typealias PT: NSObject = Self | |
static func vendSpecific() -> PT? | |
} | |
extension P where Self: NSObject, PT == Self { | |
static func vendSpecific() -> PT? { | |
return nil |
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
public final class UnfairLockPointer { | |
deinit { | |
pointer.deinitialize(count: 1) | |
pointer.deallocate() | |
} | |
private let pointer: os_unfair_lock_t | |
public init() { |