Skip to content

Instantly share code, notes, and snippets.

Avatar

Trevor Squires protocool

  • Comox Valley, BC, Canada
View GitHub Profile
View sigill.swift
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
@protocool
protocool / gist:948666
Created Apr 29, 2011
A gist that shows how I'm embedding gists into Propane. Probably crappy but at least it feels a bit meta...
View gist:948666
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]);
}
},
@protocool
protocool / displayDataURLImages_fragment.js
Created May 26, 2011
Propane caveatPatchor.js hack to display data:image urls inline as images
View displayDataURLImages_fragment.js
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]);
}
},
@protocool
protocool / gist:1535541
Created Dec 29, 2011
Propane caveatPatchor.js snippet for a /clear command
View gist:1535541
/*
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*$/)) {
@protocool
protocool / gist:2048775
Created Mar 16, 2012
Propane caveatPatchor.js snippet to display Instagram images inline
View gist:2048775
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]);
@protocool
protocool / And the results are...
Created May 7, 2012
A question of taste, style, and naming
View And the results are...
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.
@protocool
protocool / caveatPatchor.js
Created Feb 11, 2011
Sample Propane caveatPatchor.js file
View caveatPatchor.js
/**
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
@protocool
protocool / caveatPatchor.js
Created Feb 14, 2011
Sample caveatPatchor.js file for use in Propane 1.1.2 and above
View caveatPatchor.js
/*
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.
You can’t perform that action at this time.