Skip to content

Instantly share code, notes, and snippets.

View groovecoder's full-sized avatar

luke crouch groovecoder

View GitHub Profile
def uuid_please():
full_uuid = uuid.uuid4()
# uuid is truncated because paypal must be <30
return str(full_uuid)[:25]
def round_penny(amount):
return amount.quantize(Decimal('.01'), rounding=ROUND_HALF_UP)
chrome.tabs.executeScript(requestTabID, {
file: '/popup.js'
});
[main]
s3_upload=false
s3_bucket=net-mozaws-stage-shavar-lists
[tracking-protection]
allowlist_url=https://raw.githubusercontent.com/mozilla-services/shavar-list-exceptions/master/allow_list
disconnect_url=https://raw.githubusercontent.com/mozilla-services/shavar-prod-lists/master/disconnect-blacklist.json
output=mozpub-track-digest256
s3_key=tracking/mozpub-track-digest256
data: [
{
text: '301.1: Exterior property areas and premises unclean, unsafe, and in unsanitary conditions'
},
{
text: '301.2: Premises and structures unsanitary'
},
{
text: '301.3: Vacant property is unsanitary with accumulation of trash and debris.'
},
def find_uris1(node):
for i in node:
for j in node[i]:
for k in j:
for l in j[k]:
for uri in j[k][l]:
check_uri(uri)
# Send a push message with the VAPID headers
message = "Testing push service"
'''
headers = py_vapid.sign({
"aud": "http://test.com",
"sub": "mailto:tester@test.com"
})
'''
WebPusher(subscription).send(message)
Traceback (most recent call last):
File "./manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/home/vagrant/env/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 354, in execute_from_command_line
utility.execute()
File "/home/vagrant/env/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 346, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/home/vagrant/env/local/lib/python2.7/site-packages/django/core/management/base.py", line 394, in run_from_argv
self.execute(*args, **cmd_options)
File "/home/vagrant/env/local/lib/python2.7/site-packages/django/core/management/base.py", line 445, in execute
@groovecoder
groovecoder / gist:6e33905861a0f4aaa7d9751965222a17
Created April 29, 2016 13:59
python Counter.most_common() example
>>> from collections import Counter
>>> print Counter('abccdeffccdbbaacdefffbbccdaa').most_common()
[('c', 7), ('a', 5), ('b', 5), ('f', 5), ('d', 4), ('e', 2)]
a {
color: $blue;
}
h1, h2, h3, h4, h5, h6 {
font-family: "Fira Sans";
}
@fudge.patch('auctions.models.paypalrestsdk.PaypalPayout')
def test_request_payout(self, mock_paypal):
fake_items = []
mock_paypal.expects_call().returns(
fudge.Fake().expects('create')
.returns(True)
.has_attr(items=fake_items)
)