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 AppProxyController < ApplicationController | |
| include ShopifyApp::AppProxyVerification | |
| def login_form | |
| render layout: false, content_type: 'application/liquid' | |
| end | |
| def check_password | |
| @setting = Setting.find(1) | |
| if @setting.password == params[:password] |
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
| Started POST "/supplements" for 127.0.0.1 at 2017-04-07 15:21:36 -0700 | |
| Processing by SupplementsController#create as JSON | |
| Parameters: {"null"=>"", "file"=>#<ActionDispatch::Http::UploadedFile:0x007f8b342e2860 @tempfile=#<Tempfile:/tmp/RackMultipart20170407-3374-3wy5j7.csv>, @original_filename="us-500.csv", @content_type="application/vnd.ms-excel", @headers="Content-Disposition: form-data; name=\"file\"; filename=\"us-500.csv\"\r\nContent-Type: application/vnd.ms-excel\r\n">} | |
| From: /mnt/c/Users/Matt/Desktop/RubyProjects/resource_center/app/controllers/supplements_controller.rb @ line 27 SupplementsController#create: | |
| 23: def create | |
| 24: @supplement = Supplement.new | |
| 25: @supplement.supplement_file = params[:file] | |
| 26: @supplement.name = params[:file].original_filename |
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
| $("#csv_form").on("success", function() { | |
| console.log("what the fuck"); | |
| }); |
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
| [1] pry(#<CsvsController>)> params | |
| => <ActionController::Parameters {"null"=>"", "file"=>#<ActionDispatch::Http::UploadedFile:0x007fe20cbbec98 @tempfile=#<Tempfile:/tmp/RackMultipart20170405-26867-13irnim.pdf>, @original_filename="MattQuintoResume.pdf", @content_type="application/pdf", @headers="Content-Disposition: form-data; name=\"file\"; filename=\"MattQuintoResume.pdf\"\r\nContent-Type: application/pdf\r\n">, "controller"=>"csvs", "action"=>"save_csv"} permitted: false> | |
| [2] pry(#<CsvsController>)> params['file'] | |
| => #<ActionDispatch::Http::UploadedFile:0x007fe20cbbec98 | |
| @content_type="application/pdf", | |
| @headers="Content-Disposition: form-data; name=\"file\"; filename=\"MattQuintoResume.pdf\"\r\n" + "Content-Type: application/pdf\r\n", | |
| @original_filename="MattQuintoResume.pdf", | |
| @tempfile=#<File:/tmp/RackMultipart20170405-26867-13irnim.pdf>> |
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 myApp | |
| class Application < Rails::Application | |
| config.active_job.queue_adapter = :delayed_job | |
| config.active_record.raise_in_transactional_callbacks = true | |
| config.middleware.insert_before 0, Rack::Cors do | |
| allow do | |
| origins '*' | |
| resource '*', :headers => :any, :methods => [:get, :post, :options] | |
| 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
| def close_order | |
| session = ShopifyAPI::Session.new("my-website.myshopify.com") | |
| uri = URI("https://#{session.url}/admin/orders/#{self.order_id}/close.json") | |
| params = {shopify_api_key: ENV["shopify_api_key"]} | |
| uri.query = URI.encode_www_form(params) | |
| res = Net::HTTP.get_response(uri) | |
| puts JSON.parse(res.body) if res.is_a?(Net::HTTPSuccess) | |
| 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
| <div> | |
| <% if flash[:notice].present? %> | |
| <script> | |
| $(document).on("turbolinks:load", function() { | |
| $(".page-heading").after("<div class='flash flash-notice'><%= flash[:notice] %></div>"); | |
| }); | |
| </script> | |
| <% flash.clear %> | |
| <% end %> | |
| <%= yield %> |
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 OrdersCreateJob < ActiveJob::Base | |
| queue_as :default | |
| def perform(json) | |
| order = Order.create(order_data: json) | |
| product_ids = [] | |
| json['line_items'].each do |line_item| | |
| product_ids << line_item['product_id'] |
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
| function submitForm(theForm) { | |
| $.ajax({ | |
| data: $(theForm).serialize(), | |
| type: $(theForm).attr('method'), | |
| url: $(theForm).attr('action'), | |
| success: function(response) { | |
| console.log("Printer Updated"); | |
| } | |
| }); | |
| return false |
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
| $(document).on('submit','#weekly-pitch-count',function(e){ | |
| $('.processing-reports-wrapper').show(); | |
| var data = $('#weekly-pitch-count').serialize(); | |
| $.ajax({ | |
| data: data, | |
| type: 'post', | |
| url: '/app-dashboard/get-pitch-count', | |
| success: function(data){ | |
| // console.log('profile here'); | |
| console.log(data); |