Skip to content

Instantly share code, notes, and snippets.

View sunnyrjuneja's full-sized avatar

Sunny R. Juneja sunnyrjuneja

View GitHub Profile
@BaseCase
BaseCase / dc_2017_biblio.md
Last active January 23, 2020 05:13
List of resources recommended or mentioned by the speakers at Deconstruct 2017

Deconstruct 2017 Bibliography

Here are all of the resources mentioned by Deconstruct 2017 speakers, along with who recommended what. Please post a comment if I missed something or have an error!

DC 2017 Speakers' Choice Gold Medalist

  • Seeing Like a State by James Scott

Books

  • Public Opinion by Walter Lippmann (Evan Czaplicki)
  • A Pattern Language by Christopher Alexander (Brian Marick)
  • Domain Driven Design by Eric Evans (Brian Marick)
@belisarius222
belisarius222 / ddp_log.js
Created January 10, 2013 07:24
patch client-side Meteor functions to print out the DDP messages. Add this somewhere in your client-side JS before Meteor.startup() and it should print out the DDP messages. Please let me know if there are some that are missing! I'm not sure I caught all of the handler functions.
var monkeyPatches = {
'_livedata_data': 'DATA',
'_livedata_error': 'ERROR',
'_livedata_nosub': 'NOSUB',
'_livedata_connected': 'CONNECTED',
'_livedata_result': 'RESULT',
};
_.each(_.keys(monkeyPatches),function(funcName){
var modifiedFunctionName = funcName+'_original';
var extension = {};
  • Constraints - super important for ensuring data integrity (bad data can't get into the DB)

  • Indexes - i

I've written this code to test what happens once a Stripe card token has been passed through to the server. This code does not do any browser testing (because JS-friendly headless testing is painful at best, and impossible if you want VCR in the mix). VCR is being used here to capture interactions with a test Stripe account, to ensure the tests are fast on future runs. That said, it's structured so that nothing is expected to be present in the Stripe account. If you delete all the stored VCR cassettes, the specs will safely re-record them.

Instead of using VCR.use_cassette directly, instead you use stripe_cassette in your specs, passing in the current spec example object. This will automatically generate a cassette name based on the spec's file name and the example's description (limitations of this are noted in the code comments). Within the cassette's recording block, Stripe data is cleared out before yielding back to the spec, with a context object. The context object provides access to helper methods