Skip to content

Instantly share code, notes, and snippets.

View mquan's full-sized avatar

Quan Nguyen mquan

  • San Francisco, CA
View GitHub Profile
class PurchaseAuditor
def self.get_effective_purchased_amount(txn, purchased_balance)
if txn.finalized?
effective_amount = if txn.purchased_amount.nil? || txn.purchased_amount < 0
[txn.purchased_amount || txn.amount, -purchased_balance].max
elsif txn.purchased_amount == 0
0
elsif txn.purchased_amount > 0
if ["Purchase", "CreditBuyOrder"].include?(txn.source_type)
txn.purchased_amount
@mquan
mquan / gist:4218591
Created December 5, 2012 19:11
comma stuffs
diff --git a/app/views/auction/view_beta.html.erb b/app/views/auction/view_beta.html.erb
index 5a7f8d4..e817565 100644
--- a/app/views/auction/view_beta.html.erb
+++ b/app/views/auction/view_beta.html.erb
@@ -472,6 +472,7 @@
:onclick => "this.value = ''" %>
<% else %>
<%= f.text_field :amount,
+ :data => {:remove_comma => true},
:placeholder => "#{@minimum_bid_amount} or more" %>
@mquan
mquan / gist:3418248
Created August 21, 2012 18:43
turbobin package.json
{
"name": "turbobin",
"description": "supercharge your point of sale",
"author": "Quan Nguyen",
"version": "0.8.6-12",
"dependencies": {
"express": "2.5.11",
"coffee-script": "1.3.3",
"socket.io": "0.9.10",
"underscore": "1.3.3",