Skip to content

Instantly share code, notes, and snippets.

View kumar303's full-sized avatar
💭
🍉

Kumar McMillan kumar303

💭
🍉
View GitHub Profile
import manage # this initializes Django
import datetime
import hashlib
import pprint
import traceback
from collections import defaultdict
from amo.utils import chunked
from constants.base import VALID_STATUSES

We're about to release some tools for developers to sign add-ons so they can publish the .xpi files to their own site as opposed to hosting them on addons.mozilla.org. This would let users install the add-ons in a release or beta channel when add-on signatures are required.

Can you help test what we have so far? Here's how:

  • Clone jpm and install it so you can run jpm from your shell:
git clone https://github.com/mozilla-jetpack/jpm.git
cd jpm
npm install
@kumar303
kumar303 / patch.diff
Created September 3, 2015 17:43
payments-ui tests without Provider
diff --git a/tests/apps/test.management-app.jsx b/tests/apps/test.management-app.jsx
index 23836ec..dcdf9ba 100644
--- a/tests/apps/test.management-app.jsx
+++ b/tests/apps/test.management-app.jsx
@@ -2,7 +2,6 @@ import React from 'react';
import TestUtils from 'react/lib/ReactTestUtils';
import * as appActions from 'actions/app';
-import { createReduxStore } from 'data-store';
@kumar303
kumar303 / gist:6369cd876edabf9b27f4
Last active August 29, 2015 14:21
GPG key proof

Keybase proof

I hereby claim:

  • I am kumar303 on github.
  • I am kumar (https://keybase.io/kumar) on keybase.
  • I have a public key whose fingerprint is ED25 3AD5 F740 4F8B 5BAB BE20 E8EF E298 1481 41C3

To claim this, I am signing this object:

import unittest
from mohawk import Receiver, Sender
class TestBewit(unittest.TestCase):
def setUp(self):
self.credentials = {'id': 'some-sender',
'key': 'some complicated SEKRET',
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);
@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);
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 / gist:9652470
Created March 19, 2014 22:06
jshint example
grunt.initConfig({
jshint: {
options: { jshintrc: __dirname + '/.jshintrc' },
files: [
'Gruntfile.js',
'lib/*.js',
'test/*.js',
],
}
});
@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"