Skip to content

Instantly share code, notes, and snippets.

View lefloh's full-sized avatar

Florian Hirsch lefloh

View GitHub Profile
@lefloh
lefloh / apple-security-codes.md
Last active October 7, 2023 03:42
Apple Security Framework Result Codes
@lefloh
lefloh / parse-apple-security-codes.js
Last active March 8, 2018 08:21
Parse Apples Security Framework Result Codes
const fetch = require('node-fetch')
const cheerio = require('cheerio')
const baseUri = 'https://developer.apple.com'
const sourceUri = `${baseUri}/documentation/security/1542001-security_framework_result_codes?language=objc`
const printRow = (left, right) => {
console.info(`| ${left.padEnd(40)} | ${right.padStart(6)} |`)
}
@lefloh
lefloh / WebApplicationExceptionMapper.java
Last active November 28, 2016 07:39
WebApplicationExceptionMapper
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.ws.rs.WebApplicationException;
import javax.ws.rs.core.Response;
import javax.ws.rs.ext.ExceptionMapper;
import javax.ws.rs.ext.Provider;
@Provider
public class WebApplicationExceptionMapper implements ExceptionMapper<WebApplicationException> {
@lefloh
lefloh / CustomersResource.java
Last active November 21, 2016 06:30
CustomersResource#getCustomer
public Customer getCustomer(@PathParam("id") long id, @Context UriInfo uriInfo) {
Optional<Customer> customer = findCustomer(id);
if (!customer.isPresent()) {
throw new NotFoundException(
String.format("No customer with id %d found. RequestUri was %s",
id, uriInfo.getRequestUri()));
}
return customer.get();
}
@lefloh
lefloh / webapplication-exception.txt
Last active November 21, 2016 06:01
RESTEasy WebapplicationException
08:04:35,731 ERROR [org.jboss.resteasy.resteasy_jaxrs.i18n] (default task-1) RESTEASY002010: Failed to execute: javax.ws.rs.WebApplicationException: No customer with id 4711 found
at com.foo.bar.CustomerResource.get(CustomerResource.java:48)
at com.foo.bar.CustomerResource$Proxy$_$$_WeldClientProxy.get(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:139)
at org.jboss.resteasy.core.ResourceMethodInvoker.invokeOnTarget(ResourceMethodInvoker.java:295)
at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:249)

Keybase proof

I hereby claim:

  • I am lefloh on github.
  • I am lefloh (https://keybase.io/lefloh) on keybase.
  • I have a public key whose fingerprint is D227 63CD 4436 14D4 DAAD EC68 8ED9 9EE7 0F85 6738

To claim this, I am signing this object:

@lefloh
lefloh / resteasy-fileupload-2
Last active November 19, 2015 14:45
HTTP multipart POST
POST /some-resource HTTP/1.1
Content-Type: multipart/form-data; boundary=AaB03x
--AaB03x
Content-Disposition: form-data; name="file1"; filename="file1.txt"
Content-Type: text/plain; charset=utf-8
... content of file1.txt ...
--AaB03x--
@lefloh
lefloh / gist:4002160
Created November 2, 2012 15:48
ein bisschen js für den Kollegen S.
<!DOCTYPE html>
<html lang="de">
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type"/>
<title>a little bit of js</title>
<script type="text/javascript">
var de = {}; // so erzeugt man ein Objekt...
de.lefloh = {}; // ... und baut sich seinen Scope
de.lefloh.Core = function() {
{
"id": 4711,
"name": "iPhone",
"brand": {
"rel": "brand",
"href": "http://foo.bar.com/brands/1174"
}
}
public class Product {
private Long id;
private String name;
private Brand brand;
}
public class Brand {
private Long id;
private String name;
}