Skip to content

Instantly share code, notes, and snippets.

View cleuton's full-sized avatar
💭
preparing quantum deep learning projects

Cleuton Sampaio cleuton

💭
preparing quantum deep learning projects
View GitHub Profile
@cleuton
cleuton / blockerbal.js
Created April 8, 2014 15:55
This is another version of a bad implementation
// blockerbal.js
/*
This code is a bad example! It will
block the server. It is for demonstration
only.
Arguments: port number
*/
var restify = require('restify');
@cleuton
cleuton / balanceador.js
Created April 8, 2014 15:51
Naive load balancer written in Node.js
// balanceador de carga
var http = require('http');
// npm install http-proxy
var http_proxy = require('http-proxy');
var proxServer = 0;
var servidores = [
{'url':'http://localhost:8085'},
{'url':'http://localhost:8090'},
@cleuton
cleuton / blocker.js
Created April 8, 2014 12:05
A Node.js bad example: Blocking server
// blocker.js
/*
This code is a bad example! It will
block the server. It is for demonstration
only.
*/
var restify = require('restify');
var fs = require('fs');
@cleuton
cleuton / TestNormalCDC
Created March 26, 2014 17:02
Swing application FEST testcase
package com.obomprogramador.tutoriais.testes.emprestimos;
import static org.fest.assertions.Assertions.assertThat;
import javax.swing.JFormattedTextField;
import javax.swing.JPanel;
import javax.swing.JRadioButton;
import javax.swing.border.TitledBorder;
import org.fest.swing.core.GenericTypeMatcher;
@cleuton
cleuton / ajaxIe
Created March 24, 2014 13:12
Old Ajax MS IE Sample
<html>
<head>
<title>*** Ajax básico ***</title>
<script>
function iniciaRequest(url) {
// Teste do Browser
if(window.XMLHttpRequest) {
// Não é MS Internet Explorer
@cleuton
cleuton / TokenController
Last active August 29, 2015 13:57
A sails.js controller invoking a java class' method
/**
* TokenController
*
* @module :: Controller
* @description :: A set of functions called `actions`.
*
* Actions contain code telling Sails how to respond to a certain type of request.
* (i.e. do stuff, then send some JSON, show an HTML page, or redirect to another URL)
*
* You can configure the blueprint URLs which trigger these actions (`config/controllers.js`)
@cleuton
cleuton / microblog
Created March 20, 2014 11:35
A RESTful / JSON Webservice made with Node.js, and using a Java MongoDB DAO
// (c) http://www.obomprogramador.com
// REST / JSON WS implementation with Node.js calling Java
var restify = require('restify')
var server = restify.createServer()
var fs = require('fs')
var java = require('java')
java.classpath.push("lib/joda-time-2.3.jar")
java.classpath.push("lib/mongo-java-driver-2.11.4.jar")
@cleuton
cleuton / lcom4bad
Created March 18, 2014 10:46
LCOM4 Bad
public class One {
int x;
int y;
void a() {
b();
}
int b() {
return this.x;
@cleuton
cleuton / lcom4good
Created March 18, 2014 10:32
LCOM4 = 1 sample
public class One {
int x;
int y;
void a() {
b();
}
int b() {
return this.x;
@cleuton
cleuton / pom.xml
Created March 12, 2014 18:32
Jersey / JSON Webservice running an enbedded Jetty
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.obomprogramador.discoarq</groupId>
<artifactId>microblog</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>microblog</name>