Skip to content

Instantly share code, notes, and snippets.

@JemarJones
JemarJones / jQuery Fallback
Created July 7, 2015 01:36
A function that replicates the familiar javascript fallback functionality for jquery objects (which are truthy).
var fallback = function(options){
var numOfOptions = options.length;
if (numOfOptions == 2){
return (options[0].length > 0)? options[0] : options[1];
}else if (numOfOptions > 2){
return fallback(options.slice(1));
}else if (numOfOptions == 1){
return options[0];
}else{
return $();
@JemarJones
JemarJones / backoff.sh
Last active December 5, 2015 09:14
Bash script to wait for time machine backup to finish, unmount drive, and shutdown
#!/bin/bash
# Requesting sudo if we don't have it already
[ "$UID" -eq 0 ] || exec sudo bash "$0" "$@"
if [[ -z "$1" ]]; then
#Replace this with your default harddrive (list them all with "df -h")
hd="/Volumes/Harddrive";
else
hd=$1;
package okhttp3;
import junit.framework.Assert;
import org.junit.Test;
public class ResponseBodyNeverNullTest {
@Test
public void responseBodyNeverNull() {
Response testResponse = new Response.Builder()

Keybase proof

I hereby claim:

  • I am jemarjones on github.
  • I am jemarjones (https://keybase.io/jemarjones) on keybase.
  • I have a public key ASDzxw2BwMFxpVHxSl7JkF0AMK5xu4kC1TqYEZYTabYokgo

To claim this, I am signing this object: