Skip to content

Instantly share code, notes, and snippets.

@JemarJones
JemarJones / jQuery Fallback
Created Jul 7, 2015
A function that replicates the familiar javascript fallback functionality for jquery objects (which are truthy).
View jQuery Fallback
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 Dec 5, 2015
Bash script to wait for time machine backup to finish, unmount drive, and shutdown
View backoff.sh
#!/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;
View ResponseBodyNeverNullTest.java
package okhttp3;
import junit.framework.Assert;
import org.junit.Test;
public class ResponseBodyNeverNullTest {
@Test
public void responseBodyNeverNull() {
Response testResponse = new Response.Builder()
View keybase.md

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: