Skip to content

Instantly share code, notes, and snippets.

View billy-bacon's full-sized avatar

Billy Bacon billy-bacon

View GitHub Profile
package com.alex.integration.processor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
@Component("pushNotificationMessageProcessor")
public class PushNotificationMessageProcessor {
private static final Logger log = LoggerFactory.getLogger(PushNotificationMessageProcessor.class);
@billy-bacon
billy-bacon / LendingPolicyMapper.xml
Created November 12, 2013 17:46
LendingPolicy SQL
select
max(library.name) as libraryName,
libraryId,
max(tv_rating_system) as tv_rating_system,
max(movie_rating_system) as movie_rating_system,
max(ab_enabled) as ab_enabled,
max(movie_enabled) as movie_enabled,
max(music_enabled) as music_enabled,
max(tv_enabled) as tv_enabled
from (
@billy-bacon
billy-bacon / AWSCredentialsFactoryTest.java
Created November 6, 2013 18:22
AWSCredentialsFactoryTest snippet
@After
public void after() {
System.clearProperty("AWS_ACCESS_KEY_ID");
System.clearProperty("AWS_SECRET_KEY");
}
@Test
public void should_get_aws_credentials_in_local_environment() throws Exception {
// setup test
@billy-bacon
billy-bacon / KindService.java
Created October 22, 2013 22:11
KindService with static cache
public class KindService extends BaseCacheService {
public static final String LIST = "/browse/kinds/list";
private Logger log = LoggerFactory.getLogger(KindService.class);
static List<Kind> cachedList;
@Inject
public KindService(CacheWrapper<String, Object> cache,
HttpExecutor httpExecutor,
@Test
public void should_throw_exception_for_configure() throws Exception {
// setup test
module = new AWSModule();
final Binder binder = mock(Binder.class);
when(binder.skipSources(any(Class.class))).thenThrow(new IOException("WTF"));
try {
module.configure(binder);
@billy-bacon
billy-bacon / BaseModule.java
Created October 9, 2013 20:35
Guice Names.bindProperties
public void bindProperties(Binder binder, String propertiesFile) {
log.info("binding {}", propertiesFile);
try {
final Properties props = new Properties();
props.load(this.getClass().getClassLoader().getResourceAsStream(propertiesFile));
Names.bindProperties(binder, props);
} catch (IOException e) {
throw new RuntimeException("Could not load " + propertiesFile, e);
}
var carousel_${carouselName} = $('#${carouselName}').bxSlider({
minSlides: 7,
maxSlides: 7,
slideWidth: 120,
slideMargin: 10,
pager: false,
infiniteLoop: false,
controls: true,
onSlideNext: function(){
@Override
protected PlaylistInfo doInBackground(AudioTrack... params) {
// pull the track out of the single element array...
final AudioTrack audioTrack = params[0];
// get the content and segment index
final Content content = audioTrack.getContent();
final int segment = audioTrack.getSegment();
@Override
protected PlaylistInfo doInBackground(AudioTrack... params) {
// pull the track out of the single element array...
final AudioTrack audioTrack = params[0];
// get the content and segment index
final Content content = audioTrack.getContent();
final int segment = audioTrack.getSegment();
// this is the service that plays the audio
private ServiceConnection audioServiceConnection = new ServiceConnection() {
public void onServiceConnected(ComponentName componentName, IBinder binder) {
mediaController = getMediaController(view.getApplicationContext());
Log.d(TAG, "audio service connected");
//noinspection unchecked
audioService = ((SimpleBinder<AudioService>) binder).getService();