Skip to content

Instantly share code, notes, and snippets.

Jonathan Welzel jnwelzel

View GitHub Profile
jnwelzel / backbone_mixin.js
Created Jun 6, 2014
Backbone mixin for enabling Reactjs components to respond to Backbone objects/collections changes
View backbone_mixin.js
// An example generic Mixin that you can add to any component that should react
// to changes in a Backbone component. The use cases we've identified thus far
// are for Collections -- since they trigger a change event whenever any of
// their constituent items are changed there's no need to reconcile for regular
// models. One caveat: this relies on getBackboneModels() to always return the
// same model instances throughout the lifecycle of the component. If you're
// using this mixin correctly (it should be near the top of your component
// hierarchy) this should not be an issue.
var BackboneMixin = {
componentDidMount: function() {
import org.scribe.builder.api.DefaultApi10a;
import org.scribe.model.OAuthConstants;
import org.scribe.model.OAuthRequest;
import org.scribe.model.Verb;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class OAuthRequestValidator {
processArtifact() {
jnwelzel /
Created Mar 10, 2014 — forked from hstaudacher/
Integrating Gson into a JAX-RS application to replace the other shitty default providers
import static;
import java.lang.annotation.Annotation;
import java.lang.reflect.Type;
jnwelzel /
Created Mar 7, 2014
Workaround for starting Derby network server under JDK 7_u51 and its new security policies
  1. Grab the policy file here
  2. Use the following command $ java -Dderby.install.url=file:/home/jwelzel/apps/db-derby- -cp "lib/*" org.apache.derby.drda.NetworkServerControl start
jnwelzel /
Created Feb 27, 2014

#First "cd" to the top directory you want to start in. (Don't be stupid and run this from your root....)

To get a confirmation for every file use: find . -type f -name "*.bak" -exec rm -i {} \;

Or if you're feeling confident use: find . -type f -name "*.bak" -exec rm -f {} \;

// 2MB
if (picture.length > 2 * 1024 * 1024) {
throw new FDNFileTooLargeException("2MB.");

####Local archetype Execute this inside your archetype project $ mvn install archetype:update-local-catalog. After that, create a new project using the newly installed archetype by using $ mvn archetype:generate -DarchetypeCatalog=local, choose the archetype number corresponding to the one you just installed and follow the on screen instructions. Here's a good example of an archetype to get you started.

jnwelzel /
Last active Aug 11, 2017
Simple generic DAO structure for Java. Note that the interface takes two generic parameters, one for the primary key type, and the second for the bean type, which uses the same primary key. This enables you to use any kind of object as a primary key, making your code very flexible. This is a good behavior especially if you use JPA embedded ids (…
public abstract class Bean<PK extends Serializable> implements Serializable {
private static final long serialVersionUID = 1L;
@Column(name = "VERSION", nullable = false)
private Long version;
public Bean(PK id, Long version) {
jnwelzel /
Last active Jan 2, 2016
Perguntas a serem feitas pelo funcionário na hora da contratação que lá na frente podem evitar dores de cabeça.
  1. Vou ter que abrir outra conta bancária só pra receber o salário de vocês?
  2. Empresa dispõe de estacionamento coberto? Pra mim, que tenho moto, isso é essencial.
  3. Se não quiserem te dar tempo pra pensar na proposta e ficarem tentando te forçar a dar logo uma resposta se vai aceitar o cargo ou não, tome cuidado porque essa empresa provavelmente é ejaculação precoce e vai botar pressão p caramba. Esteja ciente disso.
You can’t perform that action at this time.