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
require 'kramdown' | |
text = <<-MARKDOWN | |
# Example | |
The quick brown fox jumps over the lazy dog. | |
```ruby | |
# one |
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
#!/bin/bash | |
for D in `find . -type d -name "*bot"` | |
do | |
NAME=`basename $D` | |
echo Restarting $NAME ... | |
dokku ps:restart $NAME | |
done |
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
require 'mongoid' | |
require 'mongoid-collection-snapshot' | |
Mongo::Logger.logger.level = Logger::INFO | |
Mongoid.connect_to 'widgets-and-gadgets', max_pool_size: 16 | |
class Widget | |
include Mongoid::Document | |
end |
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 ENV['DEBUG_REQUIRE'] | |
require 'benchmark' | |
def require(file) | |
@@first ||= Time.now | |
rc = false | |
ts = Benchmark.measure do | |
rc = super | |
end | |
if ENV['DEBUG_REQUIRE'].to_f < ts.total |
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 DelayedJobObserver < Mongoid::Observer | |
observe Delayed::Job | |
class << self | |
attr_accessor :total_processed | |
attr_accessor :total_errors | |
attr_accessor :enabled | |
def enabled? | |
!! DelayedJobObserver.enabled |
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
// | |
// ARKonamiKeyboardView.h | |
// Artsy | |
// | |
// Created by Daniel Doubrovkine on 3/21/14. | |
// Copyright (c) 2014 Art.sy. All rights reserved. | |
// | |
#import <DRKonamiCode/DRKonamiGestureRecognizer.h> |
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 Capybara::Session | |
def wait_until(timeout = Capybara.default_wait_time) | |
Timeout.timeout(timeout) do | |
sleep(0.1) until value = yield | |
value | |
end | |
end | |
end |
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
Team.active.asc(:_id).each do |team| | |
begin | |
next if team.premium | |
STDOUT.write "#{team.name}: " | |
client = Slack::Web::Client.new(token: team.token) | |
channels = client.channels_list['channels'].select { |channel| channel['is_member'] } | |
channels.each do |channel| | |
STDOUT.write "#{channel['name']} " | |
client.chat_postMessage( | |
channel: channel.id, |
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
require 'celluloid/current' | |
require 'celluloid/io' | |
require 'http' | |
require 'websocket/driver' | |
class Connection | |
include Celluloid::IO | |
extend Forwardable | |
def initialize(url) |
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
require 'spec_helper' | |
require 'grape' | |
module DATA | |
class User | |
attr_accessor :loginname, :email, :person | |
def initialize(attrs) | |
@loginname = attrs[:loginname] | |
@email = attrs[:email] |