Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am danvalencia on github.
  • I am danvalencia (https://keybase.io/danvalencia) on keybase.
  • I have a public key ASDSrzfyP85D0t1HelVZc9I7BWF8jhjtx6FnYz-hYmFfKAo

To claim this, I am signing this object:

package com.example.pubsubtest;
import com.google.cloud.pubsub.v1.MessageReceiver;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.gcp.pubsub.core.PubSubTemplate;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

Keybase proof

I hereby claim:

  • I am danvalencia on github.
  • I am danvalencia (https://keybase.io/danvalencia) on keybase.
  • I have a public key ASD2KD-cg4vH5HqMKCn-2HHMDhfgOcaCn5atzhPM_lvQRQo

To claim this, I am signing this object:

@danvalencia
danvalencia / gist:5490611
Last active December 16, 2015 20:10
Java version of the JCR node updating Groovy script I uploaded previously. This one does work, though.
import org.apache.jackrabbit.commons.JcrUtils;
import javax.jcr.Node;
import javax.jcr.NodeIterator;
import javax.jcr.Repository;
import javax.jcr.RepositoryException;
import javax.jcr.Session;
import javax.jcr.SimpleCredentials;
import javax.jcr.query.Query;
import javax.jcr.query.QueryManager;
@danvalencia
danvalencia / Output of above script
Last active December 16, 2015 20:10
Groovy script for updating JCR nodes given a certain resource type. Annoyed that doesn't work and I don't know why!
Session is org.apache.jackrabbit.jcr2spi.SessionImpl@699238ad
First finding resource with type: foundation/components/image
[main] WARN org.apache.jackrabbit.jcr2spi.query.NodeIteratorImpl - Exception retrieving Node with Id: {} {}content {}audiusa-retail {}en_US {}sales-assist {}2013 {}models {}s6 {}transmission---drivetrain {}s-tronic-transmission {http://www.jcp.org/jcr/1.0}content {}slideImage
[main] WARN org.apache.jackrabbit.jcr2spi.query.NodeIteratorImpl - Exception retrieving Node with Id: {} {}content {}audiusa-retail {}en_US {}sales-assist {}2013 {}models {}s5-coupe {}transmission---drivetrain {}s-tronic-transmission {http://www.jcp.org/jcr/1.0}content {}toutImage
[main] WARN org.apache.jackrabbit.jcr2spi.query.NodeIteratorImpl - Exception retrieving Node with Id: {} {}content {}audiusa-retail {}en_US {}sales-assist {}2013 {}models {}s7 {}driver-assistance {http://www.jcp.org/jcr/1.0}content {}toutImage
[main] WARN org.apache.jackrabbit.jcr2spi.query.NodeIteratorImpl - Exception retrieving Node wi
@danvalencia
danvalencia / karate_chop_1.rb
Created May 3, 2012 02:41
Code kata two: karate chop
# Mixin module for enhancing the Array class
module KarateChopArray
def left_side
slice(0, self.size/2)
end
def right_side
slice(self.size/2, self.size-1)
end