Difference between revisions of "Adafruit Order"

From ATXHackerspace

Jump to: navigation, search
(April/May 2013 Adafruit Order)
m (Protected "Adafruit Order": Adafruit Order Closed - Sending Invoices (‎[edit=sysop] (indefinite) ‎[move=sysop] (indefinite)))
(No difference)

Revision as of 21:14, 2 May 2013

Adafruit Wholesale Order

We get various discounts from Adafruit if we order $250 worth of stuff. It's the Adafruit wholesale discount! So, if you want to get in on an order, add your request to this page. When the total gets to be ~$250, the order goes in, and is delivered to the hackerspace.

There have been various non-paying people on the last couple orders. SO, in order to put the order in this time, when the order is complete we'll be taking the payments BEFORE placing the order. Sorry, but the hackerspace just can't absorb $70-100 in unpaid items.

If there are any major items that are marked OUT OF STOCK the order will not be placed until either 1) the rest of the order totals more than $250 or 2) the major items come back into stock .. usually 5-7 days.

April/May 2013 Adafruit Order is OPEN

ITEM# DESCRIPTION QTY COST DISCOUNT_COST TOTAL MEMBER
1278 BeagleBone Black 2 $45.00 OUT OF STOCK $90.00 Martin Bogomolni
954 USB to TTL serial Cable 2 $9.95 $7.00 $14.00 Martin Bogomolni
276 5V, 2A Power Supply 2 $9.95 $7.00 $14.00 Martin Bogomolni
1278 BeagleBone Black 1 $45.00 OUT OF STOCK $45.00 Jessica Ross
954 USB to TTL serial Cable 1 $9.95 $7.00 $7.00 Jessica Ross
1278 BeagleBone Black 1 $45.00 OUT OF STOCK $45.00 Eric Blount
1278 BeagleBone Black 1 $45.00 OUT OF STOCK $45.00 Vlad
249 Light and temperature data-logger pack 1 $37.50 $26.25 $26.25 Eric Blount
1278 BeagleBone Black 1 $45.00 OUT OF STOCK $45.00 Danny Miller
          $331.25  


133% of $250 goal

Adding it up

Mostly you can add it up your total in your head or with a calculator just as quickly as copy/pasting this, but you can also use some tools to help.

Copy/paste + awk

Copy/paste the table from your web browser into a text file. You should get tab delimited output (tested using Google Chrome pasting into vim). Save the text file as "order.tsv" and run:

 awk -F"\t" '/YOURNAMEHERE/ {print $6}' order.tsv | tr -d '~$ '| awk '{sum+=$1}END{print sum}'

screen scraping with lynx and grep

This avoids the copy/paste, but requires that your name not appear on any other lines in this page.

  lynx -width=500 -dump "http://www.atxhackerspace.org/index.php?title=Adafruit_Order" | egrep -o "[0-9\.]*[0-9]*[ ]+YOURNAMEHERE" | awk '{sum+=$1}END{print sum}'

Here's one for elinks, which uses a vertical pipe and variable whitespace when rendering table cells:

  elinks --dump-width 500 -dump "http://www.atxhackerspace.org/index.php?title=Adafruit_Order" | egrep -o "[0-9\.]*[0-9]*[ ]+\|[ ]*YOURNAMEHERE" | awk '{sum+=$1}END{print sum}'

Built-in browser javascript console sniffing via DOM

You can open a javsacript console in Google Chrome or Firefox with Firebug installed by pressing the F12 key. Then paste in:

  var NAME_REGEXP=/YOURNAMEHERE/;var t = document.getElementById("orderTable");var sum=0;for( var i =0; i < t.rows.length ; ++i){var r = t.rows[i]; if( NAME_REGEXP.test(r.cells[6].textContent) ) { sum+= parseFloat( r.cells[5].textContent.replace(/[^\d\.]/g,'' ), 10); } };console.log( NAME_REGEXP.source + " owes: $" + sum );

Floating point rounding errors can happen due to IEEE 754 float representation in javscript. You'd have to convert dollars to cents to fix.