Skip to content

Instantly share code, notes, and snippets.

Agnaldo de Oliveira agnaldo4j

Block or report user

Report or block agnaldo4j

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@agnaldo4j
agnaldo4j / Mongo.scala
Created Oct 24, 2012 — forked from sundorf/Mongo.scala
Play 2.0 Utility-Trait for Casbah/MongoDB
View Mongo.scala
package models
import scala.Option.option2Iterable
import org.scalastuff.scalabeans.Preamble.descriptorOf
import org.scalastuff.scalabeans.BeanDescriptor
import com.mongodb.casbah.Imports._
import play.Logger
/**
* Utility trait for MongoDB to mix into entity classes.
@agnaldo4j
agnaldo4j / Build.scala
Created Oct 24, 2012
Configurando Play 2 com casbah
View Build.scala
import sbt._
import Keys._
import PlayProject._
object ApplicationBuild extends Build {
val appName = "test"
val appVersion = "1.0-SNAPSHOT"
val appDependencies = Seq(
@agnaldo4j
agnaldo4j / PrevaylerRestaurantSpec.scala
Created Nov 6, 2012
BDD, como ajuda para métrica de progresso
View PrevaylerRestaurantSpec.scala
package persistence
import org.specs2.mutable._
import play.api.test._
import play.api.test.Helpers._
import models.nereida.{Restaurant, City, RestaurantSystem}
import persistence.commands.restaurant.{AddNewRestaurant, FindAllRestaurants, UpdateRestaurant, DeleteRestaurant, FindRestaurantById}
@agnaldo4j
agnaldo4j / CityController.scala
Created Nov 22, 2012
Removendo código duplicado com funções.
View CityController.scala
package controllers.nereida
import play.api._
import play.api.mvc._
import play.api.data._
import play.api.data.Forms._
import play.api.libs.json.{Json, JsValue}
import models.nereida.City
import persistence.Prevayler
import persistence.commands.city.{AddNewCity, DeleteCity, UpdateCity, FindAllCities, FindCityById}
@agnaldo4j
agnaldo4j / ManageCities.scala
Created Nov 26, 2012
MongoDB with scala and casbah
View ManageCities.scala
package models.nereida
import scala.collection.mutable.ArrayBuffer
import com.mongodb.casbah.Imports._
import scala.collection.JavaConversions._
import org.bson.types.ObjectId
trait ManageCities {
def addCity(city:City):City = {
@agnaldo4j
agnaldo4j / EnumMain.scala
Created Dec 5, 2012
How to work with enumerations in scala
View EnumMain.scala
object Planet extends Enumeration {
case class PlanetVal(name: String, mass: Double, radius: Double) extends Val(name) {
// universal gravitational constant (m3 kg-1 s-2)
val G = 6.67300E-11
val surfaceGravity = G * mass / (radius * radius)
def surfaceWeight(otherMass: Double) = otherMass * surfaceGravity
}
val MERCURY = PlanetVal("Mercury", 3.303e+23, 2.4397e6)
@agnaldo4j
agnaldo4j / BPMConnector.scala
Created Dec 5, 2012
Conectando ao Bonita, gerenciando processos de desenvolvimento
View BPMConnector.scala
package com.softsimples.bpm
import javax.security.auth.login.LoginContext
import org.ow2.bonita.util.{AccessorUtil, SimpleCallbackHandler, BonitaConstants}
import scala.collection.JavaConversions._
import org.ow2.bonita.facade.identity.User
import org.bonitasoft.console.security.server.api.{ICredentialsEncryptionAPI, SecurityAPIFactory}
object BPMConnector {
private val jaasFile = getClass.getResource("jaas-standard.cfg").getFile
@agnaldo4j
agnaldo4j / AutotestConfig.st
Created Dec 24, 2012
Instalacao de ferramenta de autotest.
View AutotestConfig.st
Gofer it
squeaksource: 'MetacelloRepository';
package: 'ConfigurationOfAutotest';
load.
ConfigurationOfAutotest project latestVersion load: #OB.
@agnaldo4j
agnaldo4j / clone_with_push_settings.sh
Created Dec 25, 2012
Exemplo para clonar repositorio com permissoes de push. Primeiro passo para auto deploy via hooks
View clone_with_push_settings.sh
git clone --bare -l [repository]
@agnaldo4j
agnaldo4j / Boot.scala
Created Jan 21, 2013
Jetty embarcado com scala e serviço de rest. outros exemplos de Jetty embarcado http://wiki.eclipse.org/Jetty/Tutorial/Embedding_Jetty#Setting_a_Web_Application_Context
View Boot.scala
package com.softsimples.social
import filter.SecurityFilter
import org.eclipse.jetty.server.{Server, Handler}
import org.eclipse.jetty.server.handler.{HandlerList, ResourceHandler}
import org.eclipse.jetty.servlet.{ServletHolder, ServletContextHandler}
import servlet.{WebSocketHandlerServlet, SocialCollectorHandler}
import com.sun.jersey.spi.container.servlet.ServletContainer
object Boot {
You can’t perform that action at this time.