Skip to content

Instantly share code, notes, and snippets.

@cpilsworth
cpilsworth / eddystone-url-beacon
Last active September 11, 2015 13:49
Simple node app to advertise a URL over BT4 using eddystone protocol
== title
@cpilsworth
cpilsworth / aem-is-a-two-stack-cms.md
Last active September 16, 2015 18:04
Comparison of the Two Stack CMS pattern with Adobe Experience Manager

Adobe AEM - Two Stack CMS comparison

TL;DR

The architecture outlined by Martin Fowler in his Two Stack CMS article is very similar to that used by Adobe AEM. One key difference is that AEM does not split out a separate "preview layer", so that content can be previewed as it is being prepared.

Overview

@cpilsworth
cpilsworth / TestNullify.java
Created June 7, 2011 12:09
The awesome power of nullify
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
import static org.junit.Assert.*;
@RunWith(JUnit4.class)
public class TestNullify {
@Test
@cpilsworth
cpilsworth / ClientTest.java
Created September 11, 2012 10:56
Jersey Client Test
import java.util.Map;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.MultivaluedMap;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.sun.jersey.api.client.Client;
import com.sun.jersey.api.client.WebResource;

Install XCode command line tools

gcc will trigger the download dialog.

Download brew

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Install Brews

brew install git
package com.test;
import java.io.File;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.ie.InternetExplorerDriver;
public class SeleniumTest {
@cpilsworth
cpilsworth / libraries.json
Created January 25, 2013 12:41
My JSBin Libraries
libraries.add(
{ text: 'My Libraries',
scripts: [ {text: 'h5validate', url: 'https://raw.github.com/dilvie/h5Validate/master/jquery.h5validate.js' } ]
}
);
@cpilsworth
cpilsworth / textarea.maxlength.js
Last active December 14, 2015 21:19 — forked from nodesocket/gist:3102236
Listen for textarea changes to textarea and limit length according to maxlength attribute
$(document).on('keyup input paste', 'textarea[maxlength]', function() {
var limit = parseInt($(this).attr('maxlength'));
var text = $(this).val();
var chars = text.length;
if (chars > limit) {
var new_text = text.substr(0, limit);
$(this).val(new_text);
}
});
@cpilsworth
cpilsworth / SSLTest.java
Created March 14, 2013 09:12
Simple utility to test SSL connections (i.e. certificate/trust store configuration) from java applications, use debug flag for lots of information.
package uk.co.diffa.ssltest;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.MalformedURLException;
import java.net.URL;
import javax.net.ssl.HttpsURLConnection;