Skip to content

Instantly share code, notes, and snippets.

@andrewhancox
andrewhancox / autoplay.js
Created May 30, 2017 16:00
Autoplay audio on mobile devices
var mobile = /iPad|iPhone|iPod|android/.test(navigator.userAgent) && !window.MSStream;
if (mobile) {
$('body').on('touchstart click doubleclick keydown', function() {
$("audio[autoplay='autoplay']").each(
function(){
this.play();
this.removeAttribute('autoplay');
});
});
}
<?php
// Override glossify_links theme function in your template.php file
function themename_glossify_links($vars) {
global $base_url;
drupal_add_css(drupal_get_path('module', 'glossify') . '/glossify.css');
if ($vars['type'] == 'taxonomy') {
$path = 'taxonomy/term/' . $vars['id'];
}
else {
#!/usr/bin/python
import cgi
import sys
import elementtree.ElementTree as ET
from jira.client import JIRA
instance_url = 'jira_instance_url'
instance_username = 'jira_instance_username'
instance_password = 'jira_instance_password'
@andrewhancox
andrewhancox / Speed_testing_Rackspace_Cloudfiles
Created June 25, 2013 13:53
Speed testing Rackspace Cloudfiles (they're really slow)
import os
import pyrax
import pyrax.exceptions as exc
import shutil
import datetime
import sys
from multiprocessing import Process
import uuid
def get_container():
@andrewhancox
andrewhancox / global_add_group_to_role.py
Created June 19, 2013 13:09
Adding a group to a role across every project in a Jira instance using python and jira-python
from jira.client import JIRA
import pickle
instance_url = 'https://XXXXXXXXXXX.atlassian.net'
instance_username = 'XXXXXXXXXXX.XXXXXXXXXXX'
instance_password = 'XXXXXXXXXXX'
role_to_add_group_to = 'Developers'
group_to_add_to_role = 'SEO'
options = {