Skip to content

Instantly share code, notes, and snippets.

@nisargshah100
Created March 3, 2015 16:55
Show Gist options
  • Save nisargshah100/ab97dbeeb971f75722f0 to your computer and use it in GitHub Desktop.
Save nisargshah100/ab97dbeeb971f75722f0 to your computer and use it in GitHub Desktop.
cvv
querying deal_types (bit_field) in mysql:
-- avs
SELECT deal_types,
( deal_types & 1048576 ) AS foo,
deals.*
FROM deals
WHERE offer_starts_at > '2012-02-01'
AND ( deal_types & 1048576 ) <> 0
types: [s.collect { |sym| [sym, 2**s.index(sym)] }]
[[:destination, 1],
[:limelight, 2],
[:visa, 4],
[:cheerios, 8],
[:national, 16],
[:marked_as_live, 32],
[:side_deal, 64],
[:shipping_required, 128],
[:disable_purchase_feedback, 256],
[:can_run_on_amazon, 512],
[:rerun, 1024],
[:dated_event, 2048],
[:exclusive, 4096],
[:shipping_phone_required, 8192],
[:no_expiration, 16384],
[:plus_deal, 32768],
[:concierge_available, 65536],
[:instant_ordering_available, 131072],
[:best_of, 262144],
[:ipad_received, 524288],
[:avs, 1048576],
[:cvv, 2097152],
[:highly_giftable, 4194304],
[:regional, 8388608],
[:plus_required, 16777216],
[:incentivized_deal, 33554432]]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment