[color] branch = auto diff = auto status = auto [color "branch"] current = yellow reverse local = yellow remote = green [color "diff"]
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
| class SomeMiddleware | |
| def initialize(app) @app = app end | |
| def call(env) | |
| background(env) { ... } | |
| @app.call env | |
| end | |
| def background(env, &block) | |
| if env['rack.run_once'] then yield |
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 'logger' | |
| require 'openssl' | |
| class UcellGateway | |
| #dunno what this is, but it's yours :) | |
| include MessageFilter | |
| def initialize | |
| @logger = Logger.new |
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 'sinatra' | |
| require 'eventmachine' | |
| class EventStream | |
| include EventMachine::Deferrable | |
| def initialize(channel, &block) | |
| @channel = channel | |
| @block = block |
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
| (function () { | |
| Backbone.syncWithoutUpload = Backbone.sync | |
| Backbone.syncWithUpload = function(method, model, options) { | |
| // Create iframe | |
| var iframe_id = 'file_upload_iframe_' + Date.now() | |
| , iframe = jQuery('<iframe id="' + iframe_id + '" name="' + iframe_id + '" ></iframe>').hide() | |
| // Create an hidden form | |
| var authToken = jQuery('meta[name=csrf-token]').attr('content') | |
| , authParam = jQuery('meta[name=csrf-param]').attr('content') |
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
| // includes bindings for fetching/fetched | |
| var PaginatedCollection = Backbone.Collection.extend({ | |
| initialize: function() { | |
| _.bindAll(this, 'parse', 'url', 'pageInfo', 'nextPage', 'previousPage'); | |
| typeof(options) != 'undefined' || (options = {}); | |
| this.page = 1; | |
| typeof(this.perPage) != 'undefined' || (this.perPage = 10); | |
| }, | |
| fetch: function(options) { |
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 'uri' | |
| require 'base64' | |
| require 'openssl' | |
| # NOTE: Oauth uses a specific unreserved character list for URL encoding. | |
| def url_encode(input) | |
| unreserved = '-._~0-9A-Za-z' # These are the only characters that should not be encoded. | |
| URI.escape(input, Regexp.new("[^#{unreserved}]")) | |
| 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
| #!/usr/bin/ruby | |
| require 'getoptlong' | |
| filename = "" | |
| blocksize = 1024 | |
| opts = GetoptLong.new( | |
| [ "-f", "--file", GetoptLong::REQUIRED_ARGUMENT], | |
| [ "-b", "--block", GetoptLong::REQUIRED_ARGUMENT] |
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
| #!/usr/bin/env ruby | |
| require 'logger' | |
| $stdout.sync = true | |
| $stdin.sync = true | |
| path = "/usr/local/var/log/ejabberd/auth.log" | |
| file = File.open(path, File::WRONLY | File::APPEND | File::CREAT) | |
| file.sync = true |
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
| #!/usr/bin/env ruby | |
| require 'logger' | |
| require 'rest_client' | |
| $stdout.sync = true | |
| $stdin.sync = true | |
| path = "/usr/local/var/log/ejabberd/auth.log" | |
| file = File.open(path, File::WRONLY | File::APPEND | File::CREAT) |