Skip to content

Instantly share code, notes, and snippets.

View jfuerth's full-sized avatar

Jonathan Fuerth jfuerth

View GitHub Profile
@jfuerth
jfuerth / tracker-bookmarklet.html
Last active December 22, 2016 15:45
Enhanced Pivotal Tracker Story Links!
<!DOCTYPE html>
<body style="width: 100%; font-family: helvetica,arial,sans-serif">
<h1>Enhanced Pivotal Tracker Story Links!</h1>
<a style="align:center; font-size:40pt; text-decoration: none" href='javascript:void(function(){storyIdPattern = /.*\/([0-9]+)/;storyInternalIdPattern = /story_copy_link_(.*)/;var buttons=document.querySelectorAll("button.link[data-clipboard-text]");for (i = 0; i < buttons.length; i++) {var b=buttons[i];var textAttr=b.attributes.getNamedItem("data-clipboard-text");var storyId=storyIdPattern.exec(textAttr.value)[1];var idAttr=b.attributes.getNamedItem("id");var storyInternalId=storyInternalIdPattern.exec(idAttr.value)[1];var storyTitle=document.getElementById("story_name_"+storyInternalId).value;var idButton=document.getElementById("story_copy_id_"+storyInternalId);idButton.attributes.getNamedItem("data-clipboard-text").value=storyTitle + " [#"+storyId+"]"}}())'>Enhance Story Links</a>
<p>To use it:
<ol>
<li>Drag the above link to your bookmarks bar!
<li>Expand one or more stor
#!/bin/bash
set -e
set -x
if [ -z "$1" ]; then
echo "Usage: $0 <stemcell_name.tgz>"
exit 1
fi
@jfuerth
jfuerth / ctl.erb
Last active August 29, 2015 14:21
control script with restart protection
#!/bin/bash
RUN_DIR=/var/vcap/sys/run/hello-go
LOG_DIR=/var/vcap/sys/log/hello-go
PIDFILE=${RUN_DIR}/pid
case $1 in
start)
mkdir -p $RUN_DIR $LOG_DIR
@jfuerth
jfuerth / pre-commit
Last active August 29, 2015 14:21
Help prevent accidental disclosure of secret keys
#!/bin/sh
# To enable this hook, copy it into .git/hooks/pre-commit in your project's workspace
# or use the reinstall-git-hook-everywhere.sh script
if git rev-parse --verify HEAD >/dev/null 2>&1
then
against=HEAD
else
# Initial commit: diff against an empty tree object
against=4b825dc642cb6eb9a060e54bf8d69288fbee4904
@jfuerth
jfuerth / .bash_profile
Created April 21, 2015 13:57
Handy Shell Aliases
alias gf='git fetch --all'
alias gpo='git push origin'
alias gpu='git push upstream'
alias gt='git log --oneline --decorate --all --graph'
alias gd='git diff'
alias gs='git status'
@jfuerth
jfuerth / Example.java
Created December 12, 2014 23:04
Dropdown tab support for GwtBootstrap3
TabPanelWithDropdowns tabPanel = new TabPanelWithDropdowns();
RootLayoutPanel.get().add(tabPanel);
tabPanel.addItem("First", new Text("This is the content in pane 1"));
tabPanel.addItem("Second", new Text("This is the content in pane 2"));
tabPanel.addItem("Third", new Text("This is the content in pane 3"));
tabPanel.addItem("Really really really really really long tab name", new Text("This is the content in pane 4"));
tabPanel.addItem("Fifth", new Text("This is the content in pane 5"));
DropDownContents dropDownContents = tabPanel.addDropdownTab("Dropdown");
package ca.fuerth.misc;
import static java.lang.Long.*;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Memorator {
@jfuerth
jfuerth / NativeCallbackExample.java
Created July 23, 2014 18:08
NativeCallbackExample.java
package ca.fuerth.gwt.playground.client;
import com.google.gwt.core.client.JavaScriptObject;
import com.google.gwt.core.shared.GWT;
public class NativeCallbackExample {
public native void installGlobalFunction(String functionName) /*-{
var me = this;
$wnd[functionName] = function(message, callback) {
00:04:47.928 [ERROR] Remote connection lost
<pre>com.google.gwt.dev.shell.BrowserChannel$RemoteDeathError: Remote connection lost
at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessages(BrowserChannelServer.java:304)
at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:547)
at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:364)
at java.lang.Thread.run(Thread.java:724)
Caused by: com.google.gwt.dev.shell.BrowserChannelException: Invalid message type RETURN
at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessages(BrowserChannelServer.java:304)
at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:547)
at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:364)
package ca.fuerth.misc;
import static org.junit.Assert.*;
import java.sql.Date;
import java.text.DateFormat;
import java.util.TimeZone;
import org.junit.Test;