Skip to content

Instantly share code, notes, and snippets.

View chriscorwin's full-sized avatar

Chris Corwin chriscorwin

View GitHub Profile
@chriscorwin
chriscorwin / github-issue-to-branch-name-bookmarklet-chrome.js
Created March 26, 2014 14:26
On a GitHub issue page, this will take an issue name and transform it into a valid Git branch name, presenting an alert box for copying and pasting.
javascript:(function(){ var title = jQuery('title').text(); var repoAuthor = jQuery('a.url.fn').text(); var repoName = jQuery('a.js-current-repository').text(); var issueNumber = jQuery('.gh-header-number').text(); var titleStripped = title.replace('·', ''); issueNumber = issueNumber.replace('#', ''); titleStripped = titleStripped.replace(' %C2%B7 ', ''); titleStripped = titleStripped.replace(repoAuthor + '\/', ''); titleStripped = titleStripped.replace(repoName, ''); titleStripped = titleStripped.replace('Issue #', ''); titleStripped = titleStripped.replace('] ', '___'); titleStripped = titleStripped.replace(/ \& /g, '_and_'); titleStripped = titleStripped.replace(/\&/g, '/'); titleStripped = titleStripped.replace(/,/g, '_'); titleStripped = titleStripped.replace(/: /g, '--'); titleStripped = titleStripped.replace(/:/g, '--'); titleStripped = titleStripped.replace(/ %E2%80%93 /g, '--'); titleStripped = titleStripped.replace(/ %E2%80%94 /g, '---'); titleStripped = titleStripped.replace(/%E2%80%93/g, '--'); ti
@chriscorwin
chriscorwin / jira-issue-to-branch-name-bookmarklet-chrome.js
Created March 26, 2014 14:28
On a JIRA issue page, this will take an issue name and transform it into a valid Git branch name, presenting an alert box for copying and pasting.
javascript: (function() { var title = jQuery('title').text(); var titleStripped = title.replace(' - JIRA', ''); titleStripped = titleStripped.replace('[#', ''); titleStripped = titleStripped.replace('] ', '___'); titleStripped = titleStripped.replace(/ \& /g, '_and_'); titleStripped = titleStripped.replace(/\&/g, '/'); titleStripped = titleStripped.replace(/,/g, '_'); titleStripped = titleStripped.replace(/: /g, '--'); titleStripped = titleStripped.replace(/:/g, '--'); titleStripped = titleStripped.replace(/ %E2%80%93 /g, '--'); titleStripped = titleStripped.replace(/ %E2%80%94 /g, '---'); titleStripped = titleStripped.replace(/%E2%80%93/g, '--'); titleStripped = titleStripped.replace(/%E2%80%94/g, '---'); titleStripped = titleStripped.replace(/\//g, '_or_'); titleStripped = titleStripped.replace(/\%/g, '-percent'); titleStripped = titleStripped.replace(/\"/g, ''); titleStripped = titleStripped.replace(/\'/g, ''); titleStripped = titleStripped.replace(/`/g, ''); titleStripped = titleStripped.replace(/%E2%80%9
@chriscorwin
chriscorwin / rpd_xform_and_copy_nodes_to_clipboard-bookmarklet.js
Last active August 29, 2015 13:58
Copy nodes of body to the clipboard.
javascript:(function() {
window.nodes;
window.timeoutLength = 200;
var po = document.createElement('script');
po.type = 'text/javascript';
po.async = true;
if (window.location.protocol !== 'https:') {
po.src = "http://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js";
} else {
po.src = "https://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js";
javascript:(function() {
window.nodes;
window.timeoutLength = 200;
var po = document.createElement('script');
po.type = 'text/javascript';
po.async = true;
if (window.location.protocol !== 'https:') {
po.src = "http://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js";
} else {
po.src = "https://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js";
javascript: (function() {
var headElement = document.getElementsByTagName('head')[0];
var bodyElement = document.getElementsByTagName('body')[0];
var bootstrapStylesheetLink = document.createElement('link');
bootstrapStylesheetLink.rel = 'stylesheet';
bootstrapStylesheetLink.href = "file:/Users/ccorwin/floobits/share/chriscorwin/RPD/css/bootstrap.css";
headElement.appendChild(bootstrapStylesheetLink, headElement);
@chriscorwin
chriscorwin / pbash.sh
Last active August 29, 2015 14:00
Grabs contents from clipboard, pastes it into a clipboard file, sends it to highlight to format it as RTF (and places result in clipboard), then creates a Gist of .sh type and opens the Gist in the browser.
#!/bin/bash
touch '/Users/ccorwin/Google Drive/Documents/pasteboard.sh'
pbpaste > '/Users/ccorwin/Google Drive/Documents/pasteboard.sh'
highlight -O rtf -t 2 -K 11 -k 'Source Code Pro' --syntax 'Bash' '/Users/ccorwin/Google Drive/Documents/pasteboard.sh' | pbcopy
@chriscorwin
chriscorwin / pjs.sh
Created April 25, 2014 16:04
Grabs contents from clipboard, pastes it into a clipboard file, sends it to highlight to format it as RTF (and places result in clipboard), then creates a Gist of .js type and opens the Gist in the browser.
#!/bin/bash
touch '/Users/ccorwin/Google Drive/Documents/pasteboard.js'
pbpaste > '/Users/ccorwin/Google Drive/Documents/pasteboard.js'
highlight -O rtf -t 2 -K 11 -k 'Source Code Pro' --syntax 'js' '/Users/ccorwin/Google Drive/Documents/pasteboard.js' | pbcopy
@chriscorwin
chriscorwin / phtml.sh
Last active August 29, 2015 14:00
Grabs contents from clipboard, pastes it into a clipboard file, sends it to highlight to format it as RTF (and places result in clipboard), then creates a Gist of .html type and opens the Gist in the browser.
#!/bin/bash
touch '/Users/ccorwin/Google Drive/Documents/pasteboard.html'
pbpaste > '/Users/ccorwin/Google Drive/Documents/pasteboard.html'
highlight -O rtf -t 2 -K 11 -k 'Source Code Pro' '/Users/ccorwin/Google Drive/Documents/pasteboard.html' | pbcopy
<div class="form-group">
<label class="col-md-4 control-label" for="textinput">ID</label>
<div class="col-md-4">
<input id="textinput-group" name="textinput" type="text" class="form-control input-md elmID" required value="" placeholder="Optional, will be generated if blank.">
</div>
</div>
<div class="form-group">
<label class="col-md-4 control-label" for="textinput">ID</label>
<div class="col-md-4">
<input id="textinput-group" name="textinput" type="text" class="form-control input-md elmID" required value="" placeholder="Optional, will be generated if blank.">
</div>
</div>