Skip to content

Instantly share code, notes, and snippets.

View kumar303's full-sized avatar
💭
🍉

Kumar McMillan kumar303

💭
🍉
View GitHub Profile
@kumar303
kumar303 / gist:9652404
Created March 19, 2014 22:02
karma dev example
grunt.initConfig({
karma: {
dev: {
configFile: 'karma.conf.js',
autoWatch: true
}
}
});
@kumar303
kumar303 / gist:9652415
Last active August 29, 2015 13:57
mocha example
describe('fxpay', function() {
describe('purchase()', function() {
it('should error if mozPay() is undefined', function(done) {
var productId = '123';
fxpay.purchase(productId, {
onpurchase: function(error) {
assert.equal(error, 'PAY_PLATFORM_UNAVAILABLE');
done();
},
@kumar303
kumar303 / gist:9652425
Last active August 29, 2015 13:57
sinon example
describe('fxpay', function () {
describe('API', function() {
var api;
var server;
beforeEach(function() {
api = new fxpay.API();
server = sinon.fakeServer.create();
});
@kumar303
kumar303 / gist:9652443
Created March 19, 2014 22:04
PhantomJS example
grunt.initConfig({
karma: {
run: {
configFile: 'karma.conf.js',
singleRun: true,
browsers: ['PhantomJS']
},
}
});
@kumar303
kumar303 / gist:9652453
Created March 19, 2014 22:05
travis ci example
language: node_js
node_js:
- 0.10
before_script:
- npm rebuild
script: grunt karma:run
@kumar303
kumar303 / gist:9652462
Created March 19, 2014 22:06
travis ci browser example
before_script:
- npm rebuild
- "export DISPLAY=:99.0"
- "sh -e /etc/init.d/xvfb start"
@kumar303
kumar303 / gist:9652470
Created March 19, 2014 22:06
jshint example
grunt.initConfig({
jshint: {
options: { jshintrc: __dirname + '/.jshintrc' },
files: [
'Gruntfile.js',
'lib/*.js',
'test/*.js',
],
}
});
11:47:1422992837 w.auth:INFO fetching FxA token from auth_response: "http://fireplace.loc/mozpay/spa/fxa-auth?state=d56038033e894fe289d6f75f9fc668be&code=4d9287d3798ed74a965505ee7d2d62c740bf4426ffbf862dcd03f20ffa4dbe6f" :/Users/kumar/dev/webpay/webpay/auth/views.py:175
11:47:1422992837 requests_oauthlib.oauth2_session:DEBUG Requesting url https://oauth-latest.dev.lcip.org/v1/token using method POST. :/Users/kumar/.virtualenvs/webpay/lib/python2.7/site-packages/requests_oauthlib/oauth2_session.py:273
11:47:1422992837 requests_oauthlib.oauth2_session:DEBUG Supplying headers {u'Accept': u'application/json'} and data {u'code': u'4d9287d3798ed74a965505ee7d2d62c740bf4426ffbf862dcd03f20ffa4dbe6f', u'client_secret': u'8eb806fd56338aa604117a3ee8ebe3337c8f2cf69511df52214f08383f70cc5c', u'grant_type': u'authorization_code', u'client_id': u'1947ea4dfba1911d'} :/Users/kumar/.virtualenvs/webpay/lib/python2.7/site-packages/requests_oauthlib/oauth2_session.py:274
11:47:1422992837 requests_oauthlib.oauth2_session:DEBUG Passin
@kumar303
kumar303 / new-fxpay-interface.js
Last active August 29, 2015 14:15
new fxpay interface with promises
// Fetch products from the API and also restore products from receipts.
// This used to be fxpay.init() and fxpay.getProducts()
// Old code:
// https://github.com/mozilla/fxpay/blob/master/example/shared/js/index.js#L41-L50
// https://github.com/mozilla/fxpay/blob/master/example/shared/js/index.js#L249-L257
fxpay.getProducts().then(function(allProducts) {
allProducts.forEach(function(product) {
console.log('product ID:', product.id);
console.log('product name:', product.name);
ALTER TABLE `users`
ADD COLUMN `last_login_attempt` DATETIME NULL DEFAULT NULL,
ADD COLUMN `last_login_attempt_ip` CHAR(45) NOT NULL DEFAULT '' AFTER `last_login_attempt`,
ADD COLUMN `failed_login_attempts` MEDIUMINT(8) UNSIGNED NOT NULL
DEFAULT '0' AFTER `last_login_attempt_ip`;
ALTER TABLE `users` CHANGE `fxa_uid` `username` varchar(255);