Skip to content

Instantly share code, notes, and snippets.

@jtmitchell
jtmitchell / keybase.md
Created February 20, 2017 06:41
Keybase.io identity verification

Keybase proof

I hereby claim:

  • I am jtmitchell on github.
  • I am saywibble (https://keybase.io/saywibble) on keybase.
  • I have a public key ASARehohkh3rM3qppZFV_qZo3KGKDwzdEidNf2fBqD9BWgo

To claim this, I am signing this object:

@jtmitchell
jtmitchell / dynamic_dns.sh
Last active December 15, 2020 01:38
Dynamic DNS script for Amazon Route53
#!/bin/bash
# Update Dynamic DNS
CURRENTIP=""
IPADDR=""
# Various get IP websites
# WWW_IP=http://www.focb.co.nz/myip.php
WWW_IP=http://icanhazip.com/
#!/usr/bin/env bash
# Generates gource video out of multiple repositories.
# First, get a local branch/clone of each repository.
# Then, pass the repositories as command line arguments.
#
# Example:
# $ gource-multiple-repositories.sh /path/to/repo1 /path/to/repo2
@jtmitchell
jtmitchell / ajax on event
Created February 14, 2014 06:31
Sample jquery to send an ajax request when clicked
<button id="mybutton" data-url="/json/endpoint/" data-value="hi there">Click me</button>
<script type="application/javascript">
// like this one http://stackoverflow.com/a/8517361/2246999
$('#mybutton').live('click',function() {
$.ajax({
data: { myvalue: $(this).attr('data-value'},
type: 'post',
url: $(this).attr('data-url'),
success: function(response, status, xhr) {
@jtmitchell
jtmitchell / ajax-form jquery
Created February 13, 2014 20:30
Javascript to submit forms with class ajax-form, and expect an ajam response to put onto the page
// General jQuery function to autosubmit forms with a class of 'ajax_form' and put the return html into a div
// the .spin() function is from http://fgnass.github.io/spin.js/
$('.ajax_form').live('submit',function() { // catch the form's submit event
this_form = this;
replace_div = $(this).attr('data-replace-div');
$(replace_div).spin(); // start the busy spinner
$.ajax({
data: $(this).serialize(), // get the form data
type: $(this).attr('method'), // GET or POST
url: $(this).attr('action'),