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 'marcel' | |
require 'memory_profiler' | |
require 'benchmark/ips' | |
puts "Memory stats for requiring mini_mime" | |
result = MemoryProfiler.report do | |
require 'mini_mime' | |
end | |
puts "Total allocated: #{result.total_allocated_memsize} bytes (#{result.total_allocated} objects)" |
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
return ( | |
<Formsy.Form ref={(form) => {this.formsyForm = form;}} onSubmit={(model) => { onSubmit(model); }} onValid={this.enableButton} onInvalid={this.disableButton}> | |
<Dialog | |
title="Tạo bill mới" | |
actions={actions} | |
open={selectedBill.editing} | |
> | |
<BillInput name='bill[full_name]' isSmall={true} required label="Họ Tên" value={selectedBill.full_name} validations="isExisty" errorMessage="Điền họ tên vào nhé người đẹp"/> | |
<BillPhoneNumberInput name='bill[phone_number]' isSmall={true} label="Số điện thoại" value={selectedBill.phone_number} required validations="maxLength:13" validationError="Số ĐT tối đa 11 số"/> | |
<BillAddressInput name='bill[ship_address]' label="Địa chỉ" value={selectedBill.ship_address} requied/> |
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
config.action_mailer.smtp_settings = { | |
address: 'smtp.gmail.com', | |
port: 587, | |
domain: ENV['MAIL_DOMAIN'], | |
user_name: ENV['MAIL_ID'], | |
password: ENV['MAIL_PASSWORD'], | |
authentication: 'plain', | |
enable_starttls_auto: true } |
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 send_message(cart) | |
message = "\nYour order:\n" | |
cart.orderlines.each do |orderline| | |
message += "* #{orderline.food.name} x #{orderline.quantity} - price: $#{orderline.unit_price}\n" | |
end | |
message += "\nTotal value: #{cart.orderlines.sum(:unit_price)}" | |
@client = Twilio::REST::Client.new ENV['TWILIO_SID'], ENV['TWILIO_TOKEN'] | |
@client.messages.create( | |
from: ENV['TWILIO_TEL'], | |
to: phone, |