Skip to content

Instantly share code, notes, and snippets.

View eduarddedu's full-sized avatar

Eduard Dedu eduarddedu

  • Bucharest
View GitHub Profile
package org.codecritique.thrifty.mapping;
import org.codecritique.thrifty.entity.Expense;
import com.google.gson.Gson;
import javax.ws.rs.Consumes;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.MultivaluedMap;
import javax.ws.rs.ext.MessageBodyReader;
import javax.ws.rs.ext.Provider;
@eduarddedu
eduarddedu / ExpenseService.java
Last active October 2, 2018 09:58
ExpenseService - fragment 2
@POST
@Consumes({
MediaType.APPLICATION_JSON
})
public Response createExpense(Expense expense) {
try {
em.persist(expense);
} catch (Exception e) {
throw new WebApplicationException(e);
}
@eduarddedu
eduarddedu / ExpenseService.java
Last active October 2, 2018 07:52
ExpenseService - fragment
package org.codecritique.thrifty.rest;
import javax.ejb.Stateless;
import javax.ws.rs.*;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import org.codecritique.thrifty.entity.Expense;
@Stateless
package org.codecritique.thrifty;
import javax.ws.rs.ApplicationPath;
import javax.ws.rs.core.Application;
@ApplicationPath("rest-api")
public class RestApplication extends Application {
}
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
@Path("hello")
public class HelloService {
@GET
@Produces("text/html")
public String getHtml() {
return "<html><body><h1>Hello!</h1></body></html>";
@eduarddedu
eduarddedu / vimrc
Created February 3, 2018 10:22
Launch source code execution from Vim
" Enter command line mode and press the
" right arrow key to run this function.
" The script will attempt to compile and execute
" the program file opened in active buffer.
cnoremap<Right> <C-R> call RunProgram()<CR>
function! RunProgram()
let b:filetype = getbufvar("%", "&filetype")
let b:filename = expand("%")

Keybase proof

I hereby claim:

  • I am eduarddedu on github.
  • I am eduarddedu (https://keybase.io/eduarddedu) on keybase.
  • I have a public key whose fingerprint is C81A 4A95 52C6 656C BA62 B8E7 BC1F CA09 3EDC 1EF5

To claim this, I am signing this object: