Skip to content

Instantly share code, notes, and snippets.

View m8ttyB's full-sized avatar

Matt B m8ttyB

  • Nope
  • Earth
View GitHub Profile
@m8ttyB
m8ttyB / HelloEmailer.py
Created December 8, 2010 04:51
Emailing with Python. I’ve been in need of some Jython code that would allow me to send out emails with 1 to n files attached to the message. I puttered around my books and a few websites but couldn’t find exactly what I needed.
#!/usr/bin/env python
import smtplib, string, os
from email.MIMEMultipart import MIMEMultipart
from email.MIMEText import MIMEText
from email.MIMEBase import MIMEBase
from email.Encoders import encode_base64
class Emailer():
'''Creates a simple object to interact with to send out mass emails'''
@m8ttyB
m8ttyB / ObjectIntrospection.py
Created December 8, 2010 04:54
Python object introspection
class InspectorGadget(object):
def __init__(self, quarrel_with):
self.__evil_antagonist = quarrel_with
def go_go_gadget_hat(self):
... deploy hat
def go_go_gadget_arms(self):
... do that crazy arm thing
Workflow:
From forked & updated repo:
create branch
Either:
-git branch litmus_11759_test_blank_search (create branch)
-git checkout litmus_11759_test_blank_search (switch to that branch)
or:
-git checkout -b litmus_11759_test_blank_search (create & switch to branch)
@m8ttyB
m8ttyB / locales.sh
Created October 5, 2012 21:10
for testing the stub installer (curling ftw)
#!/bin/bash
# locales=(en-US ach af ak ar as ast be bg bn-BD bn-IN br bs ca cs csb cy da de el en-GB en-ZA eo es-AR es-CL es-ES es-MX et eu fa ff fi fr fy-NL ga-IE gd gl gu-IN he hi-IN hr hu hy-AM id is it ja kk km kn ko ku lg lij lt lv mai mk ml mn mr nb-NO nl nn-NO nso or pa-IN pl pt-BR pt-PT rm ro ru si sk sl son sq sr sv-SE sw ta ta-LK te th tr uk vi zh-CN zh-TW zu)
products=(firefox-beta-stub firefox-aurora-latest firefox-beta-latest firefox-nightly-latest)
locales=(en-US fr de lg)
platforms=(win linux linux64 osx)
for product in "${products[@]}"
do
for locale in "${locales[@]}"
@m8ttyB
m8ttyB / gist:3908174
Created October 17, 2012 21:04 — forked from davehunt/gist:2988477
Conditional xfails for pytest-mozwebqa tests.
import pytest
class TestConditionalXFails:
@pytest.mark.xfail("config.getvalue('platform') == 'MAC'")
def test_xfail_platform(self, mozwebqa):
assert False
@pytest.mark.xfail("config.getvalue('browser_name') == 'firefox'")
#!/bin/bash
set -o errexit
echo "Plug in your device"
adb wait-for-device
echo "Found device"
#dir=$(mktemp -d -t revision)
dir=$(mktemp -d -t revision.XXXXXX)
if [!dir]; then
mkdir dir
fi

Keybase proof

I hereby claim:

  • I am m8ttyb on github.
  • I am m8ttyb (https://keybase.io/m8ttyb) on keybase.
  • I have a public key whose fingerprint is 5F61 FB76 48C1 F839 5F67 13D3 A395 B75E 8BB6 559E

To claim this, I am signing this object:

# coding: utf-8
from selenium.webdriver import Firefox
from selenium.webdriver.common.by import By
f = Firefox()
f.get('https://crash-stats.mozilla.org')
l = f.find_element(By.CSS_SELECTOR, '#advanced-search .select2-container-active')
for i in range(2):
print 'displayed: {}, size: {}, location{}'.format(l.is_displayed(), l.size, l.location)
Some are our docs, some we might've used before:
https://developer.mozilla.org/en-US/docs/Learn/Accessibility
http://www.bbc.co.uk/gel/guidelines/how-to-design-for-accessibility
http://www.bbc.co.uk/guidelines/futuremedia/accessibility/html/
http://www.bbc.co.uk/guidelines/futuremedia/accessibility/mobile/user-experience
This one is currently a work in progress - https://developer.mozilla.org/en-US/docs/user:chrisdavidmills/Understanding_WCAG
@m8ttyB
m8ttyB / gif.py
Last active April 10, 2017 20:40
Generate a gif from your jpgs
#!/usr/bin/env python
from lib import picture as p
import sys
if __name__ == '__main__':
jpg_filenames = p.list_images(sys.argv[1])
p.build_gif(jpg_filenames)