Skip to content

Instantly share code, notes, and snippets.

View mrbusche's full-sized avatar

Matt Busche mrbusche

View GitHub Profile
@mrbusche
mrbusche / desktop computer
Last active April 7, 2018 14:28
desktop computer boxstarter
# Description: Boxstarter Script
# Original Author: Jess Frazelle <jess@linux.com>
# Modifed by Matt Busche
# Last Updated: 4/7/2018
#
# Install boxstarter:
# . { iwr -useb http://boxstarter.org/bootstrapper.ps1 } | iex; get-boxstarter -Force
#
# You might need to set: Set-ExecutionPolicy RemoteSigned
#
@mrbusche
mrbusche / numberToRoman.groovy
Created March 6, 2018 02:13
Number to Roman Numeral
String getRomanNumeral(int userEnteredNumber) {
//Numbers that are needed to reduce the complexity of code.
//In some cases the numbers are absolutely necessary (1000, 500, etc)
//but numbers like 990, 490 are added to decrease code complexity
List numbers = [1000, 999, 990, 900, 500, 499, 490, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1]
List romanNumerals = ['M','CMXCIX','XM','CM','D','CDXCIX','XD','CD','C','XC','L','XL','X','IX','V','IV','I']
String romanNumeral = ''
int i = 0
while (userEnteredNumber > 0) {
while (userEnteredNumber - numbers[i] >= 0) {
@mrbusche
mrbusche / romanToNumber.groovy
Created March 6, 2018 02:13
Roman Numeral to Number
//no return type specified because it can be an int or a string.
//Generally this would be in a class and an exception would be throw rather than
//returning a string, but a whole class cannot be ran on the Groovy Console
def romanToDecimal(String romanNumber) {
Integer newNumber = 0, previousNumber = 0
Map romanToNumberMapping = [M:1000, D:500, C:100, L:50, X:10, V:5, I:1]
//convert the string to upper case in case the user entered it in lower case
String romanNumeral = romanNumber.toUpperCase()
for (Integer oneChar = romanNumeral.length() - 1; oneChar >= 0; oneChar--) {
String oneLetter = romanNumeral.charAt(oneChar)
@mrbusche
mrbusche / laptop boxstarter
Last active November 28, 2018 16:35
Boxstart Script
# Description: Boxstarter Script
# Original Author: Jess Frazelle <jess@linux.com>
# Modified by Matt Busche
# Last Updated: 11/28/2018
#
# Install boxstarter:
# . { iwr -useb http://boxstarter.org/bootstrapper.ps1 } | iex; get-boxstarter -Force
#
# You might need to set: Set-ExecutionPolicy RemoteSigned
#
@mrbusche
mrbusche / whereis.txt
Created November 30, 2017 18:48
Where is my git commit
git branch -r --contains {commit}
tells you all of the branches (including remote) that contain a commit
@mrbusche
mrbusche / ApiSecurityConfig.groovy
Created September 18, 2017 02:32 — forked from jeffsheets/ApiSecurityConfig.groovy
Spock Test for Spring Boot Security configuration - showing basic simple examples for unauthenticated users, role based access, and httpBasic logins
@EnableWebSecurity
class ApiSecurityConfig extends WebSecurityConfigurerAdapter {
@Inject
void configureGlobal(AuthenticationManagerBuilder auth) {
auth.inMemoryAuthentication()
.withUser('svc_acct').password('somePassword').roles('FULL_ACCESS')
}
@Override
protected void configure(HttpSecurity http) {
@mrbusche
mrbusche / jira hide specific words from view
Created August 23, 2017 02:10
jira hide specific words from view
//remove anything with the title "words" from jira view
var jq = document.createElement('script');
jq.src = "https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js";
document.getElementsByTagName('head')[0].appendChild(jq);
$('.ghx-inner').each(function() {
var str = $(this).text().replace(/ /g, '').toUpperCase();
if (str.indexOf("words") >= 0) {
$(this).parent().parent().parent().parent().hide();
}
@mrbusche
mrbusche / gist:524eda3c26f71986475e0c958fdb5222
Created August 23, 2017 02:09
jira hide assigned tickets
//load in jquery
var jq = document.createElement('script');
jq.src = "https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js";
document.getElementsByTagName('head')[0].appendChild(jq);
//hide assigned tickets
$('.ghx-avatar').each(function() {
var str = $(this)[0].outerHTML;
if (str.indexOf("Assignee:") >= 0) {
$(this).parent().hide();
@mrbusche
mrbusche / delete old git branches locally
Last active March 31, 2018 02:08
Delete deleted git branches locally
git remote update origin --prune && git branch -vv | grep gone] | awk '{print $1}' | xargs git branch -D
@mrbusche
mrbusche / duplicateIDCheckerJavaScript
Created April 14, 2015 02:09
Checking an HTML page for duplicate IDs using JavaScript
var allElements = document.getElementsByTagName("*");
var allIds = {};
var found = false;
for (var i = 0, n = allElements.length; i < n; ++i) {
var id = allElements[i].id;
if (id) {
if (allIds[id] === undefined) {
allIds[id] = 1;
} else {
found = true;