Skip to content

Instantly share code, notes, and snippets.

View davidmerrick's full-sized avatar

David Merrick davidmerrick

View GitHub Profile
@davidmerrick
davidmerrick / purge.sh
Created September 27, 2018 22:31
Purge a file from git's history
git filter-branch --force --index-filter \
'git rm --cached --ignore-unmatch myFile' \
--prune-empty --tag-name-filter cat -- --all
@davidmerrick
davidmerrick / MyEnum.java
Last active June 27, 2018 23:01
enum example
public enum MyEnum {
GOOD("GOOD");
private String value;
public enum MyEnum(String value){
this.value = value;
}
@Override
@davidmerrick
davidmerrick / Solution.java
Last active August 26, 2017 18:58
Balance parentheses with a stack in Java
package com.david;
import org.junit.Assert;
import java.util.Stack;
public class Solution {
private static String one = "[]";
private static String two = "[[]]";
private static String three = "[][]";
@davidmerrick
davidmerrick / 0_reuse_code.js
Created June 28, 2017 01:49
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@davidmerrick
davidmerrick / showssh.sh
Created June 27, 2017 23:14
Show SSH IP connected from
echo $SSH_CONNECTION | cut -f 1 -d " "
@davidmerrick
davidmerrick / print.js
Created June 22, 2017 21:26
Open print dialog in browser
window.print();
@davidmerrick
davidmerrick / templateCreator.js
Created June 7, 2017 17:15
JIRA template creator. Put this in a bookmarklet.
javascript:var u=document.location.protocol+"//"+document.location.host+"/CreateIssueDetails!init.jspa?",onTemplatePage=null!=document.getElementById("issue-create");if(onTemplatePage)for(var x=document.getElementById("issue-create").querySelectorAll("input,select,textarea"),i=0;i<x.length;i++)x[i].value&&(x[i].name&&x[i].name.indexOf("customfield_10151")<0||x[i].id&&x[i].id.indexOf("customfield_10151")<0)&&(u=u+(x[i].name?x[i].name:x[i].id)+"="+encodeURIComponent(x[i].value)+"&");else for(var x=document.getElementsByName("jiraform")[0].querySelectorAll("input,select,textarea"),i=0;i<x.length;i++)x[i].value&&(x[i].name&&x[i].name.indexOf("customfield_10151")<0||x[i].id&&x[i].id.indexOf("customfield_10151")<0)&&(u=u+(x[i].name?x[i].name:x[i].id)+"="+encodeURIComponent(x[i].value)+"&");document.body.insertAdjacentHTML("beforeend","<div id='x' style='word-wrap:break-word;display:inline;position:absolute;z-index:5000;left:30%;top:30%;padding:10px;width:40%;color:white;background-color:black;'>Copy this link:<br/>
@davidmerrick
davidmerrick / .gitconfig
Created May 27, 2017 16:58
Git alias for switching origins
[alias]
gso = "!gitSwitchOrigin() { \
if [[ \"$#\" -ne 1 ]]; then { echo \"Usage: git gso <newOrigin>\"; exit 1; } fi; \
git remote add new_origin \"$1\"; \
git remote remove origin; \
git remote rename new_origin origin; \
}; gitSwitchOrigin"
@davidmerrick
davidmerrick / .gitconfig
Last active August 26, 2017 17:53
git alias to generate gitignore file from gitignore.io
[alias]
gitignore = "!gitignore(){ curl https://www.gitignore.io/api/$1; }; gitignore"
# Example usage: git gitignore node,intellij,macos > .gitignore
@davidmerrick
davidmerrick / .gitconfig
Last active May 27, 2017 16:23
Git alias to push to all remotes
[alias]
gpa = !git remote | xargs -L1 git push --all