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 'uri_validator' |
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
#!/usr/bin/env ruby | |
require 'nokogiri' | |
require 'open-uri' | |
class Mp3Crawler | |
def initialize(url) | |
@data = Nokogiri::XML(open(url)) | |
end | |
def links |
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
$(function(){ | |
var controllers = <%= | |
actions = {} | |
Rails.application.routes.routes.each do |route| | |
if route.defaults.include?(:controller) | |
actions[route.defaults[:controller]] ||= [] | |
actions[route.defaults[:controller]] << route.defaults[:action] if route.defaults.include?(:action) | |
end | |
end | |
actions.to_json %>; |
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
namespace :deploy do | |
desc "Notifies Honeybadger locally using curl" | |
task :notify_honeybadger do | |
require 'json' | |
require 'honeybadger' | |
begin | |
require './config/initializers/honeybadger' | |
rescue LoadError | |
logger.info 'Honeybadger initializer not found' |
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
Honeybadger.configure do |config| | |
config.api_key = 'asdf' | |
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
# config/initializers/honeybadger.rb | |
Honeybadger.configure do |config| | |
... | |
config.async do |notice| | |
WorkingBadger.perform_async(notice.to_json) | |
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
# config/initializers/active_record.rb | |
module ActiveRecordRelationExt | |
def self.included(base) | |
base.send(:attr_accessor, :with_values) | |
base::MULTI_VALUE_METHODS << :with | |
end | |
def with(*subqueries) | |
return self if subqueries.blank? |
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
module CanCanController | |
extend ActiveSupport::Concern | |
included do | |
extend(ClassMethods) | |
cattr_accessor :cancan_includes | |
self.cancan_includes = [] | |
end | |
module ClassMethods |
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
# config/initializers/simple_form_bootstrap.rb | |
# https://github.com/plataformatec/simple_form/issues/857 | |
# https://gist.github.com/adamico/6510093 | |
class CollectionCheckBoxesInput < SimpleForm::Inputs::CollectionCheckBoxesInput | |
def item_wrapper_class | |
"checkbox-inline" | |
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
# Notifies Honeybadger locally using curl | |
after :finishing, :notify_honeybadger do | |
on roles(:app) do | |
require 'json' | |
require 'honeybadger' | |
begin | |
require './config/initializers/honeybadger' | |
rescue LoadError | |
error 'Honeybadger initializer not found' |
OlderNewer