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
customer_data = begin | |
YAML::load(File.open('lib/tasks/data/simplicitus_customer.yml')) | |
rescue => exception | |
puts "Could not parse YAML: #{e.message}" | |
end | |
customer_data.each do |key, value| | |
Customer.create!() | |
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
customer: | |
id: 1337 | |
customerName: Simplicitus, Corp | |
createBy: 1 | |
addr1: 190 Peach Ave | |
addr: | |
city: Hershey | |
st: PA | |
zip: 17033 | |
zip4: |
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
# CFW-Atom-Snippets - Craig Kauppila | |
#Cfwheels Snippets for Atom Editor | |
#I love Atom editor and thought it would be nice to have snippets for CFwheels while writing in script. | |
#My setup: | |
#Install language-cfml package | |
#Install Atom-Beautify package | |
#Go to File > Snippets > Paste all or just a few of the snippets into your snippets.cson file. |
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
<!--- read the spreadsheet data into a query object ---> | |
<cfspreadsheet action="read" src="#ExpandPath( './data.xlsx' )#" query="importdata" headerrow="1" /> | |
<!--- create a variable to store the codes of products that could not be imported ---> | |
<cfset failedimports = "" /> | |
<!--- loop through the query starting with the first row containing data (row 2) ---> | |
<cfloop query="importdata" startrow="2"> | |
<!--- check row contains valid data (all fields must contain a value and price must be numeric) ---> | |
<cfif !Len( product_title ) || !Len( product_code ) || !IsNumeric( product_price )> |