A Pen by Dimitri Roche on CodePen.
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 BackgroundIndexer | |
| extend ActiveSupport::Concern | |
| included do | |
| after_save { IndexerJob.perform_later('index', self.class.index_name, self.class.name.downcase, self) } | |
| after_destroy { IndexerJob.perform_later('delete', self.class.index_name, self.class.name.downcase, self.id) } | |
| 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
| // Block Grid | |
| // Technique adapted from Foundation 5 for Bootstrap 3. | |
| // https://github.com/zurb/foundation/blob/f755d8704123f86c281ede0b171881e2672f150d/scss/foundation/components/_block-grid.scss | |
| // Original LESS Version by Christopher Mitchell (https://gist.github.com/ChrisTM) | |
| // Converted to SCSS by Rasmus Jürs (https://github.com/Jursdotme) | |
| [class*="block-grid-"] { | |
| display: block; | |
| margin: -($grid-gutter-width/2); | |
| padding: 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
| class Gift::FilterParams | |
| NESTED_PARAMS = %i(send_at sent_at redeemed_at shipped_at created_at updated_at) | |
| attr_reader :originals | |
| def initialize(params) | |
| @originals = if params.is_a?(Gift::FilterParams) | |
| params.originals.dup | |
| elsif params.present? | |
| params.with_indifferent_access | |
| else |
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 Stubs | |
| module S3 | |
| def s3_succeeds_to_get_fixture(fixture) | |
| WebMock.stub_request(:get, /https:\/\/s3\.amazonaws\.com\/test\.loopandtie\.com\/csv_imports\/.*#{fixture}/). | |
| with(:headers => {'Accept'=>'*/*', 'Accept-Encoding'=>''}). | |
| to_return(:status => 200, :body => fixture_url(fixture), :headers => {}) | |
| end | |
| def s3_succeeds_to_check_files | |
| WebMock.stub_request(:head, /https:\/\/s3\.amazonaws\.com\/test\.loopandtie\.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
| import Foundation | |
| public let defaultDebugLevel = DDLogLevel.Debug | |
| public let defaultTag = NSString(format: "ManhattanForum") | |
| class DDLogHelper { | |
| class func SwiftLogMacro(async: Bool, level: DDLogLevel, flag flg: DDLogFlag, context: Int = 0, file: String = __FILE__, function: String = __FUNCTION__, line: UWord = __LINE__, tag: AnyObject? = defaultTag, format: String, args: CVaListPointer) { | |
| let string = NSString(format: format, arguments: args) as String | |
| SwiftLogMacro(async, level: level, flag: flg, context: context, file: file, function: function, line: line, tag: tag, string: string) | |
| } |
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
| # Could not call this DatepickerInput because it leads to | |
| # the setting of css classes that cause chaos in the javascript/css | |
| # side of things. | |
| class BetterDateInput < SimpleForm::Inputs::StringInput | |
| def input(wrapper_options = nil) | |
| input_html_classes.unshift(:datepicker) | |
| input_html_options[:autocomplete] = 'off' | |
| value = @builder.object.send(attribute_name) | |
| input_html_options[:value] = case value |
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 Datafixes::AddSupplierIdToGifts < Datafix | |
| def self.up | |
| execute(<<-SQL) | |
| UPDATE gifts SET supplier_id = products.selected_supplier | |
| FROM (SELECT gifts.id as gift_id, products.supplier_id as selected_supplier FROM gifts JOIN products | |
| ON gifts.selected_product_id = products.id | |
| WHERE stage = 'redeemed') as products | |
| WHERE gifts.id = products.gift_id | |
| SQL | |
| 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
| class FastlyAssetsProvider | |
| include Roadie::AssetProvider | |
| def find_stylesheet(name) | |
| Rails.logger.info("## FastlyAssetsProvider retrieving asset named: #{name}") | |
| asset_host = Rails.application.config.action_mailer.asset_host | |
| return nil unless asset_host.present? | |
| uri = URI(name) | |
| uri.scheme = 'https' |
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
| export CLICOLOR=1 | |
| export LANG="en_US.UTF-8" | |
| alias rm="rm -i" | |
| alias mv="mv -i" | |
| alias cp="cp -i" | |
| alias ls="ls --color=auto" | |
| alias ll="ls -alh" |