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
/// Dart import | |
import 'dart:math'; | |
import 'dart:ui' as ui; | |
///Package import | |
import 'package:flutter/material.dart'; | |
///Date picker imports | |
import 'package:syncfusion_flutter_datepicker/datepicker.dart'; |
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 QuietActiveStorageLoggerMiddleware | |
def initialize(app) | |
@app = app | |
@regex = %r(\/rails\/active_storage) | |
end | |
def call(env) | |
if env['PATH_INFO'] =~ @regex | |
::Rails.logger.silence { @app.call(env) } # silences the logs! | |
else |
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
#test | |
class ActiveStorageLoggerMute | |
class << self | |
def around(controller) | |
if controller.kind_of?(ActiveStorage::DiskController) | |
begin | |
old_logger = ActionController::Base.logger | |
ActionController::Base.logger = nil | |
Rails.logger.silence { yield } | |
ensure |
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 Repo::Github | |
attr_accessor :account, :client | |
def initialize(account) | |
@account = account | |
end | |
def client | |
@client ||= Octokit::Client.new(access_token: account.access_token) | |
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
# redtube.com crawler | |
module Crawler::Redtube | |
class Parser < Crawler::BaseParser | |
scrape :video_id, ->(i) { i.url.split('/').reverse.first.to_i } | |
scrape :title, '.videoTitle' | |
scrape :author_name, '.video-details tr:eq(1) td:eq(2) a', alt: '.video-details tr:eq(1) td:eq(2) span' | |
scrape :views, '.video-details tr:eq(2) td:eq(2)', type: :integer | |
scrape :rating_percent, '.percent-likes', type: :integer | |
scrape :duration, '.video-duration' | |
scrape :uploaded_at, '.added-time', remove: /ADDED/, type: :date |
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 ProductPriceHelper | |
# Render detailed product's price | |
def product_price(product) | |
ProductPrice.new(self, product).render | |
end | |
# render price for listing of products | |
def listing_price(product) | |
ProductPrice.new(self, product).render_for_listing |
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
Implement simple rails store app with abilities to track user's activities | |
Features: | |
- product has title, description, price, tags | |
- pages: list of products, product's detail page | |
- search by products(use mysql) | |
- track user's clicks by the product in the search results | |
- every user should have unique tracking code. Use cookies to set it. | |
- save product id, user's ip, search keywords, user-agent, user's geo location, user's tracking code | |
- page: the list of tracking clicks |
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
- content_for :content do | |
%h2{style: 'text-align: left'} | |
Setup Wizard for #{@user.company_name} | |
= link_to 'Go Back To Customer Details Page', admin_user_path(@user), class: 'back-link' | |
.panel_layout{style: 'padding-bottom: 30px'} | |
#customer-setup | |
.wizard-steps.clearfix | |
- wizard_steps.each_with_index do |wizard_step, i| | |
= link_to wizard_path(wizard_step), class: "wizard-step #{active_class(wizard_step == step)}" do |
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
[['Apparel', 1036592],['Appliances', 2619525011],[ 'ArtsAndCrafts', 2617941011],[ 'Automotive', 15690151],[ 'Baby', 165796011],[ 'Beauty', 11055981],[ 'Books', 1000],[ 'Classical', 301668],[ 'Collectibles', 4991425011],[ 'DigitalMusic', 195208011],[ 'DVD', 2625373011],[ 'Electronics', 493964],[ 'ForeignBooks', ''],[ 'Garden', ''],[ 'GourmetFood', 3580501],[ 'Grocery', 16310101],[ 'HealthPersonalCare', 3760931],[ 'Hobbies', ''],[ 'Home', ''],[ 'HomeGarden', 285080],[ 'HomeImprovement', ''],[ 'Industrial', 228239],[ 'Jewelry', 3880591],[ 'KindleStore', 133141011],[ 'Kitchen', 1063498],[ 'Lighting', ''],[ 'Magazines', 599872],[ 'Miscellaneous', 10304191],[ 'MobileApps', 2350149011],[ 'MP3Downloads', 195211011],[ 'Music', 301668],[ 'MusicalInstruments', 11091801],[ 'OfficeProducts', 1084128],[ 'OutdoorLiving', 1063498],[ 'PCHa |
NewerOlder