Skip to content

Instantly share code, notes, and snippets.

@dennishall
dennishall / jira-user-script.js
Last active August 4, 2021 19:09
UserScript (Tampermonkey) for JIRA - Adds buttons to copy branch name, pull request title to clipboard
// ==UserScript==
// @name Get branch name, get PR title, copy to clipboard
// @namespace http://tampermonkey.net/
// @version 1.0.0
// @description For JIRA. Adds buttons to copy branch name and pull request title to clipboard, adds console helpers.
// @author Dennis Hall
// @match https://*.atlassian.net/*
// @grant none
// ==/UserScript==
project = "MB Vans" AND comment ~ "(x) prod" AND updated >= -3w ORDER BY lastViewed DESC
@dennishall
dennishall / proxy.js
Last active August 29, 2015 14:27
No need to run nginx when you're running nodejs
var fs = require('fs');
var httpProxy = require('http-proxy');
// use environment variables if present.
var httpPort = process.env.PORT || 8000;
var httpsPort = process.env.HTTPS_PORT || 443;
//
@dennishall
dennishall / gruntfile-snippet.js
Created January 29, 2014 20:07
Prevent grunt imageEmbed from inlining fonts
var fs = require('fs');
var fontFilenames = ['c.eot', 'ci.eot', 'c.svg', 'ci.svg', 'c.ttf', 'ci.ttf', 'c.woff', 'ci.woff'];
grunt.registerTask('fontPrep', 'Move Celeste fonts so that they are not handled by imageEmbed.', function(){
// create a temp folder
fs.mkdirSync('css/fonts/tmp');
fontFilenames.forEach(function(name){
// move the Celeste fonts t othe temp folder
fs.renameSync('css/fonts/'+name, 'css/fonts/tmp/'+name);
// create dummy files that are large enough (>32k) to cause imageEmbed to skip them
fs.writeFileSync('css/fonts/'+name, (new Array(35000)).join(' '));
@dennishall
dennishall / sniffles
Last active December 17, 2015 06:58
Give identifying classnames -- css / styling hooks -- to pages opened by window.open and pages that are iframed.
var _open = window.open;
window.open = function(a,b,c,d,e,f){
var popupHandle = _open(a,b,c,d,e,f);
try {
popupHandle.isPopup = true;
}catch(e){
//for pdf pop-ups
}
return popupHandle;
};
// stream media
// urls to consider:
// http://html5doctor.com/video-canvas-magic/
// http://stackoverflow.com/questions/1106955/php-and-ffmpeg-performing-intelligent-video-conversion
// http://stackoverflow.com/questions/6954845/how-to-create-a-webm-video-file
// http://johndyer.name/ffmpeg-settings-for-html5-codecs-h264mp4-theoraogg-vp8webm/
// http://blog.pcode.nl/2010/10/17/encoding-webm-using-ffmpeg/
@dennishall
dennishall / columnize.js
Created July 9, 2012 18:42
Simple columnize javascript function
function columnize(ul){
var offsetTop = YAHOO.util.Dom.getRegion(ul).top;
var listItems = ul.getElementsByTagName('li');
for(var i=0,l=listItems.length;i<l;i++){
var region = YAHOO.util.Dom.getRegion(listItems[i]);
if(region.bottom - offsetTop > 200){
var clone = ul.cloneNode(true);
// remove all list items that follow this one from the current list. (will be covered by the clone)
for(var j=l-1; j>=i; j--){
ul.removeChild( ul.lastChild );
@dennishall
dennishall / include-exclude-zipcode-ranges.js
Created August 1, 2011 12:42
Include/Exclude zipcode ranges
$('ul.models li.model').each(function(i, node) {
var li = $(node);
// <li data-excludes="88995, 90000-99999">
var includes = li.attr('data-includes').replace(' ', '').split(',');
var excludes = li.attr('data-excludes').replace(' ', '').split(',');
if(!includes.length){
includes = [[0, 99999]];
@dennishall
dennishall / CQ5-wcmmode-toggler-bookmarklet.js
Created July 28, 2011 16:11
Toggle the current page between author and publish mode (if the page is powered by adobe day cq)
javascript:(function(){var a=location,b=/wcmmode=disabled[&]?/,c=a.search,d=c.replace(b,""),e="wcmmode=disabled",f=a.href.replace("/cf#","").replace("?","?"+e);a.href=b.test(a.href)?location.protocol+"//"+location.host+"/cf#"+location.pathname+(d.length?"?"+d:d)+location.hash:b.test(f)?f:f+"?"+e})()
@dennishall
dennishall / LogFilePathAsHTMLComment.java
Created July 19, 2011 15:33
Log JSP Include File Paths as HTML Comments
// replace "projectName" with your actual project name
package com.projectName.filters;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import java.io.IOException;