Skip to content

Instantly share code, notes, and snippets.

View rafaeljesus's full-sized avatar

Rafael Jesus rafaeljesus

  • Berlin, Germany
View GitHub Profile
/**
* Autowire Quartz Jobs with Spring context dependencies
* @see http://stackoverflow.com/questions/6990767/inject-bean-reference-into-a-quartz-job-in-spring/15211030#15211030
*/
public final class AutowiringSpringBeanJobFactory extends SpringBeanJobFactory implements ApplicationContextAware {
private transient AutowireCapableBeanFactory beanFactory;
public void setApplicationContext(final ApplicationContext context) {
beanFactory = context.getAutowireCapableBeanFactory();
}
@rafaeljesus
rafaeljesus / enforce_dependencies
Created February 2, 2014 20:54
Check for dependencies constructor in backbone
function enforceDependencies(klass, options, deps){
deps = _.filter(deps, function(depName){
if( !options[depName] ){
throw new Error('Missing required dependency: '+ depName);
}
return !!klass[depName];
});
_.extend(klass, _.pick(options, deps));
}
@rafaeljesus
rafaeljesus / Gemfile
Created February 14, 2014 01:49 — forked from flomotlik/Gemfile
gem 'foreman'
gem 'puma'
@rafaeljesus
rafaeljesus / README.md
Created February 18, 2014 02:47 — forked from mloughran/README.md
OO Design with Event Machine

Getting started

First add your twitter username and password. Then server.rb and once it's started open websocket.html in your browser. You should see some tweets appear. If not take a look at the javascript console.

=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')
@rafaeljesus
rafaeljesus / backbone_sync.js
Created March 21, 2014 18:24
Backbone parse with Faye
this.BackboneSync = this.BackboneSync || {};
BackboneSync.RailsFayeSubscriber = (function() {
function RailsFayeSubscriber(collection, options) {
this.collection = collection;
this.client = new Faye.Client(’<%= BackboneSync::Rails::Faye.root_address %>/faye’);
this.channel = options.channel;
this.subscribe();
}
/**
* Module dependencies
*/
var express = require('express');
var fs = require('fs');
var mongoose = require('mongoose');
var Schema = mongoose.Schema;
// img path
Criar um episódio e gerar classes do commonsTypes:
C:\Tools\jaxb-ri-20070122\bin>xjc -episode shared.episode -p com.embraer.erepair
.integration.outbound.shared shared\commonsTypes.xsd
parsing a schema...
compiling a schema...
com\embraer\erepair\integration\outbound\shared\AddressType.java
com\embraer\erepair\integration\outbound\shared\AmmountType.java
com\embraer\erepair\integration\outbound\shared\DocumentReferenceType.java
@rafaeljesus
rafaeljesus / jaxb_episodes_ex
Last active August 29, 2015 14:04
Jaxb + episodes generation example
bin\xjc -episode shared.episode -p com.embraer.erepair.integration.outbound.shared.request shared\commonsTypes.xsd
bin\xjc -p com.embraer.erepair.integration.outbound.awb.request awbDetailsRequest.xsd -extension -b shared.episode
// Node.js CheatSheet.
// Download the Node.js source code or a pre-built installer for your platform, and start developing today.
// Download: http://nodejs.org/download/
// More: http://nodejs.org/api/all.html
// 0. Synopsis.
// http://nodejs.org/api/synopsis.html