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
| def process_url(url, download_directory, pages) | |
| doc = Nokogiri::HTML(open(url)) | |
| doc.css('.thing.link').each do |entry| | |
| id = entry['data-fullname'] | |
| link = entry.css('a.title')[0] | |
| next unless link | |
| title = link.content | |
| if title =~ /(\d{3,5})\s?x\s?(\d{3,5})/ | |
| width, height = $1.to_i, $2.to_i |
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
| var d = document.createElement('div'); | |
| d.innerHTML = "\ | |
| <style>\ | |
| *:not(.icon):not(i), *:not(.icon):not(i):after, *:not(.icon):not(i):before {\ | |
| box-shadow: 0px 0px 4px 0px #000 !important;\ | |
| text-shadow: 1px 1px 3px #fff !important;\ | |
| }\ | |
| body { \ | |
| background-image: url(http://meepletown.com/wp-content/uploads/2012/07/depth.jpg) !important;\ | |
| } \ |
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 DisableAssetsLogger | |
| def initialize(app) | |
| @app = app | |
| Rails.application.assets.logger = Logger.new('/dev/null') | |
| end | |
| def call(env) | |
| previous_level = Rails.logger.level | |
| Rails.logger.level = Logger::ERROR if env['PATH_INFO'].index("/assets/") == 0 | |
| @app.call(env) |
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 'rmagick' | |
| include Magick | |
| [".jpg", ".png", ".gif"].each do |image_extension| | |
| `mkdir -p ./left` | |
| `mkdir -p ./right` |
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 Delayed | |
| module Plugins | |
| class Airbrake < Plugin | |
| callbacks do |lifecycle| | |
| lifecycle.after(:failure) do |worker, job| | |
| backtrace = job.last_error.split("\n") | |
| ::Airbrake.notify_or_ignore( | |
| :error_class => "Failed Delayed Job", | |
| :error_message => backtrace.shift, |
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 String | |
| def loch_ness_monster_case | |
| self.split('::').collect do |section| | |
| section.gsub(/([^\/])([A-Z])/, '\1_\2').downcase.split(/_/).collect { |part| | |
| chars = part.split('') | |
| half = chars.length/2 | |
| chars[half].upcase! | |
| chars[half - 1].upcase! | |
| chars.join('') |
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
| thread = Thread.new { | |
| Guard.start(:notify => 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
| localpeloton.com | |
| pelocalton.com | |
| paceliners.com | |
| velogroups.com |
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 JsonRenderer < WillPaginate::ViewHelpers::LinkRendererBase | |
| def prepare(collection, options, context) | |
| super(collection, options) | |
| @context = context | |
| end | |
| def to_json | |
| { | |
| :next_page => url(next_page), |
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 JsonRenderer < WillPaginate::ViewHelpers::LinkRendererBase | |
| def prepare(collection, options, context) | |
| super(collection, options) | |
| @context = context | |
| end | |
| def to_json | |
| { | |
| :next_page => url(next_page), |
NewerOlder