Skip to content

Instantly share code, notes, and snippets.

View danielpassos's full-sized avatar

Daniel Passos danielpassos

View GitHub Profile
@danbev
danbev / gist:4066691
Created November 13, 2012 16:14
CDI vs web.xml configuration

CDI vs web.xml configuration

To help decide which approach is best for our users this gist will show how configuring CORS in AeroGear Controller would be like using CDI and via web.xml

CDI

For a CDI version and the specific case of CORS users will probably need to provide their own configuration settings. The proposed solution for this is for a user to provide a CDI Producer, for example:

public class CorsConfigProducer {
    public @Produces CorsConfiguration getConfiguration() {
        return CorsConfig.create()
 .enableCorsSupport(true)
#!/bin/sh
git filter-branch --env-filter '
an="$GIT_AUTHOR_NAME"
am="$GIT_AUTHOR_EMAIL"
cn="$GIT_COMMITTER_NAME"
cm="$GIT_COMMITTER_EMAIL"
if [ "$GIT_COMMITTER_EMAIL" = "your@email.to.match" ]
@matzew
matzew / gist:3950763
Created October 25, 2012 06:00
AeroGear-iOS 1.0.0.M1

AeroGear-iOS 1.0.0.M1

A little bit more than two months ago the work on the AeroGear-iOS library started. We added an initial (and simple) API to communicate against RESTful endpoints. The functionality contains:

  • HTTP communication
  • data storage
  • Authentication and user enrollment

This little document describes the API in a more detailed way.

@matzew
matzew / gist:3945727
Created October 24, 2012 12:09
Private versus internal API

Not exposing implementation details

Looking at this pull request and the related discussion:

  • the Pipe interface is the only access that endusers should have to a pipe.
  • the RestAdapter is a HTTP RESTful implementation of the Pipe.
  • Endusers should not be able do do new RestAdapter(...);

Looking at the discussion of the above PR, it's clear that there exposing internal APIs and/or implementation details has PROs and CONS...

@matzew
matzew / gist:3857191
Created October 9, 2012 07:34 — forked from cvasilak/gist:3851304
FAQ or Wiki or ...
  • What is a pipeline ?

A pipeline represents a set of n connections to a server. The pipeline class offers some simple 'management' APIs to work with containing 'pipe' objects. Basically it allows you to add or remove new connections to the pipeline.

  • What is a pipe ?

A pipe represents one connection to a server. The pipe API is basically an abstraction layer for any server side connection, which all allows you to simply 'read' from, or 'write' to a server connection. However, technical details like RESTful APIs (e.g. HTTP PUT or HTTT GET) are not exposed on the pipeline and pipe APIs. In the future you can have different type of pipe objects (-> connections). The default (and CURRENTLY only supported) type is a REST connection.

Below is an example from our JavaScript lib:

@matzew
matzew / gist:3838816
Created October 5, 2012 08:51 — forked from kborchers/gist:3833435
FAQ or Wiki or ...
  • What is a pipeline ?

A pipeline represents a set of n connections to a server. The pipeline class offers some simple 'management' APIs to work with containing 'pipe' objects. Basically it allows you to add or remove new connections to the pipeline.

  • What is a pipe ?

A pipe represents one connection to a server. The pipe API is basically an abstraction layer for any server side connection, which all allows you to simply 'read' from, or 'write' to a server connection. However, technical details like RESTful APIs (e.g. HTTP PUT or HTTT GET) are not exposed on the pipeline and pipe APIs. In the future you can have different type of pipe objects (-> connections). The default (and CURRENTLY only supported) type is a REST connection.

Below is an example from our JavaScript lib:

@piscisaureus
piscisaureus / pr.md
Created August 13, 2012 16:12
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@leemeichin
leemeichin / README.md
Created April 12, 2012 12:02
Modulo Liquid filter for Jekyll

Modulo Liquid filter for Jekyll

Got nested columns in your grid-based Jekyll site?

Wondered why you didn't have a way to calculate the modulo inside your posts loop to open and close your 'rows' containing those nested columns?

Add this filter to your _plugins directory, and use it like so:

{{ x | mod:y }}
@jimbojsb
jimbojsb / gist:1630790
Created January 18, 2012 03:52
Code highlighting for Keynote presentations

Step 0:

Get Homebrew installed on your mac if you don't already have it

Step 1:

Install highlight. "brew install highlight". (This brings down Lua and Boost as well)

Step 2:

@mxcl
mxcl / uninstall_homebrew.sh
Created August 26, 2011 11:25
Uninstall Homebrew
#!/bin/sh
# Just copy and paste the lines below (all at once, it won't work line by line!)
# MAKE SURE YOU ARE HAPPY WITH WHAT IT DOES FIRST! THERE IS NO WARRANTY!
function abort {
echo "$1"
exit 1
}
set -e