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 ErrorReporter | |
extend Forwardable | |
@name = 'ErrorReporter Class Instance Variable' | |
def self.api_client | |
@sl_api_client ||= SlApi.api_client | |
end | |
api_client.public_methods(false).each do |method| |
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
$scope.loadItems = function() { | |
$scope.loadingItems = true; | |
$http({ | |
method: "GET", | |
url: '/api/admin/v1/'+mainConfig.merchantId+'/users/settings', | |
}).success(function(data,status) { | |
$scope.setting = data; | |
$http({ | |
method: 'GET', | |
url: '/api/admin/v1/'+mainConfig.merchantId+'/users/'+$scope.recordId, |
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 'rails_helper' | |
describe Api::OrdersController, type: :controller do | |
Given(:checkout_params) do | |
{ | |
order: { | |
billing_address: [], | |
coupons: [], | |
custom_fields_translations: [], | |
customer_email: '[email protected]', |
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 Api | |
class OrdersController < ApiController | |
include AllpayHelper | |
include AsiapayHelper | |
include UsersHelper,CartsHelper, OrdersHelper | |
include EsunHelper | |
include PaypalExpressHelper | |
before_action :set_order, only:[:payment_ack, :after_receive_payment, :after_create_allpay_order, :after_create_esun_payment,:linepay_confirm,:paypal_express_return,:asiapay_return, :shop_com] |
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
def checkout | |
m = @merchant_data | |
seller_id = m["_id"] | |
unfulfillable_items = get_invalid_cart_items | |
if unfulfillable_items.present? | |
render status: :unprocessable_entity, json: { message: I18n.t('orders.error.fulfillment_error'), data: unfulfillable_items} | |
return | |
end | |
delivery_option_id = params.fetchpath("order/delivery_option/_id") |
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
def checkout | |
m = @merchant_data | |
seller_id = m["_id"] | |
unfulfillable_items = get_invalid_cart_items | |
if unfulfillable_items.present? | |
render status: :unprocessable_entity, json: { message: I18n.t('orders.error.fulfillment_error'), data: unfulfillable_items} | |
return | |
end | |
delivery_option_id = params.fetchpath("order/delivery_option/_id") |
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
var text = 'there are a lot of great websites like www.missingmanuals.com and http://www.noelsaga.com' | |
var urlRegex = /((\bhttps?:\/\/)|(\bwww\.))\S*/g | |
var url = text.match(urlRegex) | |
console.log(url[0]) | |
console.log(url[1]); | |
//看看兩者的差異 | |
var text2 = 'my website is www.noelsaga.com' | |
var urlRegex2 = /((\bhttps?:\/\/)|(\bwww\.))\S*/ |
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
var jq = document.createElement('script'); | |
jq.src = "http://code.jquery.com/jquery-latest.min.js"; | |
document.getElementByTagName('head')[0].appendChild(jq); | |
//Done! Really simple as you imagine! |
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
// Without turbolinks, it works fine! | |
$(document).ready(function(){ | |
formmodified=0; | |
$('form *').change(function(){ | |
formmodified=1; | |
}); | |
window.onbeforeunload = confirmExit; | |
function confirmExit() { | |
if (formmodified == 1) { | |
return "資料有做修改,確定直接離開頁面嗎?"; |
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
Array.prototype.select = function(callback){ | |
count = this.length; | |
results = new Array(); | |
for(i=0;i<count;i++){ | |
if(callback(this[i])) | |
results.push(this[i]); | |
} | |
return results; | |
}; |