This file contains hidden or 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 hidden or 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
| # utility lib for random OAuth2 crap. | |
| module OauthUtil | |
| extend self | |
| def bad_redirect_uri?(app, url) | |
| return false if url.blank? || url =~ /^https?:\/\/github\.com\/login\/oauth\/success$/ | |
| uri = URI.parse(url) | |
| uri.host != app.callback_uri.host || | |
| uri.port != app.callback_uri.port || | |
| (uri.path =~ %r{#{app.callback_uri.path}(\/|$)}) != 0 |
This file contains hidden or 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
| require 'rubygems' | |
| require 'parslet' | |
| require 'pp' | |
| def parse(klass, str) | |
| parser = klass.new | |
| puts "parsing #{str}" | |
| pp parser.parse(str) | |
| puts | |
| rescue Parslet::ParseFailed => err |
This file contains hidden or 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
| Queueing SELECT for next server connection. | |
| Queueing FLUSHDB for next server connection. | |
| Queueing QUIT for next server connection. | |
| Stream connected | |
| Sending offline command: SELECT | |
| send command: *2 | |
| $6 | |
| SELECT | |
| $2 |
This file contains hidden or 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
| // multi api proposal | |
| // http://github.com/mranney/node_redis | |
| // old and busted | |
| client.multi([ | |
| ["incr", ["multibar"], function (err, res) { | |
| console.log(err || res); | |
| }], | |
| ["incr", ["multifoo"], function (err, res) { | |
| console.log(err || res); |
This file contains hidden or 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
| # Step( | |
| # () -> redis.select 15, @ | |
| # () -> redis.flushdb @ | |
| # () -> redis.rpush 'fakelist', '1', @ | |
| # () -> redis.rpush 'fakelist', '2', @ | |
| # () -> redis.rpush 'fakelist', '3', @ | |
| # () -> redis.lrange 'fakelist', 0, 1, @ | |
| # (err, arr) -> | |
| # console.log arr.length | |
| # console.log arr[0].toString() |
This file contains hidden or 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
| # | |
| # Module dependencies | |
| # | |
| utils = require './utils' | |
| # | |
| # @api private | |
| # | |
| class Mapper | |
| constructor: (phases, riak) -> |
This file contains hidden or 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
| task :finish do | |
| next if ENV['NOCAMPFIRE'] | |
| require "#{rails_root}/lib/campfire" | |
| branch_name = branch.split('/', 2).last | |
| msg = "#{deploying_user}'s #{rails_env} deployment of #{branch_name} is done!" | |
| if rand > 0.7 | |
| msg.sub! /done\!$/, 'NOW DIAMONDS!' | |
| end | |
| Campfire.notify msg | |
| end |
This file contains hidden or 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
| @@http_auth_headers = %w(X-HTTP_AUTHORIZATION HTTP_AUTHORIZATION Authorization) | |
| # gets BASIC auth info | |
| def get_auth_data | |
| auth_key = @@http_auth_headers.detect { |h| request.env.has_key?(h) } | |
| if auth_key.present? && request.env[auth_key].to_s =~ /^Basic\s+(.*)/m | |
| Base64.decode64($1).split(':')[0..1] | |
| else | |
| [nil, nil] | |
| end | |
| end |
This file contains hidden or 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
| addHttpOptions: function(bucket, key, options) { | |
| if(!options.headers) options.headers = {}; | |
| var queryProperties = {}; | |
| // known url params are added to the query | |
| ['r', 'w', 'dw', 'keys', 'props', 'vtag', 'nocache', 'returnbody'].forEach(function(p) { | |
| if (options[p] !== undefined) { | |
| queryProperties[p] = options[p]; | |
| } |