Skip to content

Instantly share code, notes, and snippets.

View mhemmings's full-sized avatar
UPDATE_ROLLBACK_COMPLETE_CLEANUP_IN_PROGRESS

Mark Hemmings mhemmings

UPDATE_ROLLBACK_COMPLETE_CLEANUP_IN_PROGRESS
View GitHub Profile
@mhemmings
mhemmings / chrome-popups.js
Created August 5, 2014 10:29
Enable <a> links in Chrome extension pop-ups.
var aTags = document.getElementsByTagName('a');
for (var i = 0; i < aTags.length; i++) {
aTags[i].addEventListener('click', function (e) {
chrome.tabs.create({url: e.target.href});
});
}
@chrisbanes
chrisbanes / FloatLabelLayout.java
Last active March 15, 2024 06:39
FloatLabelLayout
/*
* Copyright 2014 Chris Banes
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@mhemmings
mhemmings / googledns
Last active August 29, 2015 13:58
A DNS zone file to set up Google Apps For Business
; CNAME Records
mail 3600 IN CNAME ghs.google.com.
calendar 3600 IN CNAME ghs.google.com.
docs 3600 IN CNAME ghs.google.com.
; MX Records
@ 3600 IN MX 10 ASPMX.L.GOOGLE.COM.
@ 3600 IN MX 20 ALT1.ASPMX.L.GOOGLE.COM.
@ 3600 IN MX 20 ALT2.ASPMX.L.GOOGLE.COM.
@ 3600 IN MX 30 ASPMX2.GOOGLEMAIL.COM.
@mhemmings
mhemmings / node.nginxconf
Last active August 29, 2015 13:57
Proxy a Node.js app through Nginx
upstream app_name {
# where the app is running
server 127.0.0.1:3000;
}
server {
listen 0.0.0.0:80;
server_name domain.com;
access_log /var/log/nginx/app_name.log;
@mhemmings
mhemmings / adminer.sh
Created January 30, 2014 22:52
Download Adminer like a boss! Found myself often wanting to quickly put Adminer on a box for a few minutes while I investigated something but couldn't remember the URL. This script downloads Adminer and also has some cool extra functionality, including automatic deletion (see --help for usage)
#!/bin/bash
usage() {
printf "%s\n" "Usage: $0 [-m] [-e] [-o] [-c] [-d]"
printf "\t%s\n\t%s\n\t%s\n\t%s\n" \
"-m MySQL only" "-e English only" "-o Output file" \
"-c CSS file to download" "-d Auto-delete time (minutes)"
exit 1
}
@mhemmings
mhemmings / setOpacity(View view, float alpha)
Created January 6, 2014 21:48
An android method to set the opacity of a view while supporting API 1+.
/**
* Sets the opacity of the view. This is a value from 0 to 1, where 0 means the view is
* completely transparent and 1 means the view is completely opaque.
*
* @param alpha The opacity of the view.
* @param view The view to change.
*
*/
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
public void setOpacity(View view, float alpha) {