Skip to content

Instantly share code, notes, and snippets.

View miere's full-sized avatar
😁
Distributing data among friends

Miere Teixeira miere

😁
Distributing data among friends
View GitHub Profile
package user;
import static layr.api.ResponseBuilder.renderTemplate;
import layr.api.GET;
import layr.api.PathParameter;
import layr.api.Response;
import layr.api.WebResource;
@WebResource("user")
public class UserWebResource {
define( function() {
function isValidElement(element) {
var nodeName = element[0].nodeName.toUpperCase(), invalidInputTypes = [ "BUTTON", "SUBMIT", "CLEAR" ]
var result = ((nodeName != "BUTTON") && !(nodeName == "INPUT" && (invalidInputTypes.contains( element.attr(
"type" ).toUpperCase() ))))
return result
}
@miere
miere / DateConverter.java
Created July 18, 2013 00:46
Universal, easy to read, date converter.
public class DateConverter extends Converter<Date> {
@Override
public Date convert( String value, Class<Date> clazz ) throws ConversionException {
Date convertedDate = tryToConvertFromLong( value );
if ( convertedDate == null )
convertedDate = tryToConvertFromInternationDateFormat( value );
if ( convertedDate == null )
throwCantConvertValueToDate( value );
return convertedDate;
<html>
<head></head>
<body style="background: #343434; color: white;">
<div class="logo" style="font-family: 'Exo'; font-size: 9em; padding: 0px; text-align: center;">
<span class="texo">texo</span><span class="it" style="color: #ff3f3f;">it</span>
</div>
<small style="text-align: center; display: block; font-family: 'Exo'; border-top: 2px solid; width: 40%; margin: 0 auto; font-size: 1.4em; position: relative; top: -72px; background: inherit;
">Professional OpenSource Software Development</small>
</body>
</html>
@miere
miere / gist:6574977
Last active December 23, 2015 03:39
Breve overview técnico sobre o AngularJS

AngularJS - Not that heroic at all.

  • Código fonte, apesar de fuzzy, não trás risco. Passou no Lint, e pela minha análise não possui pontes para memory leak interna.

  • Smelly Controller API. Porém, a sua API parte do princípio que as controllers são uma Closure JavaScript ( function ). Isso tráz consigo alguns riscos:

    • Fere a orientação a objeto, oferencendo um modelo contextual ( baseado em Closure Stack ) para definir o escopo, diminuindo o reaproveitamento dos comportamentos das Views.
    • Quando se tem mais de um nó DOM para se manipular, uma prática muito comum é computar o nó pai mais próximo do nós em questão. Assim, a busca fica condicionada a um escopo menor, oferencendo melhor performance na interação da tela à hardwares mais fracos. Usando uma Closure somos obrigados a guardar o estado em váriaveis globais ou na variavel escopo. Se salvo na variavel de escopo, deve-se ater a possíveis conflitos com nomes que possa ficar exposto, podendo trazer efeitos colaterais no comportamento da tela.
@miere
miere / Help.md
Created September 16, 2013 03:07
Simple uAkka actor implementation used to demonstrate the basics with uAkka improved API.

uAkka basics

Actor System Auto Creation

Every time a WAR is deployed with uakka-servlet as dependency, an ActorSystem is created named with the WAR name.

Auto Handling Messages

Every time a message is consumed, HandleActor superclass will try to find a method named "handle" that accepts as parameter the same object type as the arrived message.

Actor Auto Creation

Every time an Actor is deployed with @Service annotation it will be auto-created in the WAR auto-created actor system.

@miere
miere / AkkaReative.md
Created October 12, 2013 15:26
Initial actor pattern analysis focused on long-I/O jobs like CRUD web apps', or throttled jobs.

Actors and Reactive pattern

Enterprise Beans vs Actors - some considerations:

  • Services are singletons, mostly
  • Every operation is performed asynchronously, with the implied hope that by the time someone asks for the result, the underlying operation will have finished.
  • Spring operation methods' become message classes in Akka actor model read more...

Actor Protocol

Great spirits have always encountered violent opposition from mediocre minds.

Albert Einstein

When you play, play hard; when you work, don't play at all

Theodore Roosevelt