Skip to content

Instantly share code, notes, and snippets.

View peas's full-sized avatar

Paulo Silveira peas

View GitHub Profile
@peas
peas / style.css
Created September 5, 2012 05:03
CSS de exemplo para o livro de Design Responsivo da Casa do Código
* {
margin: 0;
padding: 0;
}
html {
font-family: Arial, Helvetica, sans-serif;
}
.container {
@peas
peas / exemplo.html
Created September 5, 2012 04:43
Página exemplo do livro de design responsivo
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Layout Fixo</title>
<link href="style.css" rel="stylesheet" />
</head>
<body>
<div class="container">
@peas
peas / Testes.java
Created May 1, 2012 04:27
ideias para a palestra
class Palestrante {
private String name;
private int postsNoGuj;
public String getName() {
return name;
}
public int getPostsNoGuj() {
@peas
peas / mapinha.js
Created December 22, 2011 20:42
marcação simples de cidades no google maps
http://code.google.com/apis/ajax/playground/?type=visualization#geo_chart
function drawVisualization() {
console.log('asdad');
var data = new google.visualization.DataTable();
data.addColumn('string', 'City');
data.addRows([
['Foz do Iguacu'],
@peas
peas / funcional.js
Created June 13, 2011 03:58
prog funcional em js. wip
<script type="text/javascript">
console.log("ola mundo");
function par(a, b) {
return function(f) {
return f(a, b);
}
}
Query query = session.createQuery("select sum(p.valor) " +
"from ParcelaDeAula as p where " +
"p.contrato.dataDeCriacao <= :data " +
"and " +
"(p.dataDePagamento >= :data " +
"or (p.situacao = :situacao and (p.dataDePagamento = null and p.dataOriginalDeVencimento >= :data)) " +
")");
query.setParameter("data", data);
query.setParameter("situacao", SituacaoDeParcela.PAGO);
#lang racket
(define (pontos x)
(define (soma-lista x) (apply + x))
(define (strike? x) (= (length x) 1))
(define (spare? x) (= (soma-lista x) 10))
(define (pontos2 jogada-anterior jogadas)
; devolve a proxima jogada, que pode ter um ou dois lances
(define (proxima-jogada)
(if (= (first jogadas) 10)
class LRUCache extends LinkedHashMap<String, String> {
private int tamanho;
public LRUCache(int tamanho) {
super(3, 0.75f, true);
this.tamanho = tamanho;
}
protected boolean removeEldestEntry(
java.util.Map.Entry<String, String> eldest) {
@WebServlet(urlPatterns = { "/chat/*" }, asyncSupported=true, loadOnStartup = 1)
public class ChatServlet extends HttpServlet {
private Queue<AsyncContext> clients = new ConcurrentLinkedQueue<AsyncContext>();
private BlockingQueue<String> messages = new LinkedBlockingQueue<String>();
private int contador;
static {
System.out.println("tomcat carregou?");
}
apply plugin: 'java'
apply plugin: 'eclipse'
// apply plugin 'war'
version = '0.1-SNAPSHOT'
compileJava {
options.encoding='UTF-8'
}