Skip to content

Instantly share code, notes, and snippets.

View olivier-schmitt's full-sized avatar

Olivier SCHMITT olivier-schmitt

View GitHub Profile
@olivier-schmitt
olivier-schmitt / gist:5987741
Created July 12, 2013 20:50
ClassLoader and class path
package classloader;
import java.io.InputStream;
public class ShowClassLoader {
public static void main(String[] args) throws Exception {
ClassLoader classloader = ShowClassLoader.class.getClassLoader();
@olivier-schmitt
olivier-schmitt / gist:5946655
Created July 8, 2013 06:34
Two selectors : visible and metadata
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title></title>
<meta name="description" content="">
<style>
.even {background: #CCC}
.odd {background: #FFF}
@olivier-schmitt
olivier-schmitt / gist:5833973
Created June 21, 2013 20:11
Vérifie que le cookie de session renvoyé dans la réponse correspond bien au cookie de session de la requête
if (ResponseCode != null && ResponseCode.equals ("200") == false )
{
Failure= false ;
}
else
{
if (ResponseCode != null && ResponseCode.equals ("200") == true )
@olivier-schmitt
olivier-schmitt / gist:5787443
Created June 15, 2013 08:49
JSF and AJAX : solution
<h:commandButton
id="cmd"
action="#{ajaxCounterBean.execute}"
value="Ajax"
immediate="true">
<c:ajax render="output :output2 :secondform:output3"/>
</h:commandButton>
@olivier-schmitt
olivier-schmitt / gist:5787439
Created June 15, 2013 08:48
JSF and AJAX : use case sample
<h:body>
<h:form id="mainform">
<h:commandButton
id="cmd"
action="#{ajaxCounterBean.execute}"
value="Ajax"
immediate="true">
</h:commandButton>
@olivier-schmitt
olivier-schmitt / gist:5275961
Created March 30, 2013 08:54
AngularJS and URL form encoded : do some post request after configuring HTTP provider behavior.
$http.post("../secure/spot/search", {query: $scope.query}).
success(function(data, status) {
....
}).error(function(data, status) {
...
});
@olivier-schmitt
olivier-schmitt / gist:5275955
Created March 30, 2013 08:51
AngularJS and URL form encoded : Change default HTTP provider behavior and transform request data with JQuery
var guidebookConfig = function($routeProvider, $httpProvider) {
// Change default header content type for post request
$httpProvider.defaults.headers.post = {'Content-Type': 'application/x-www-form-urlencoded'};
// Transform every request to form urlencoded data
$httpProvider.defaults.transformRequest = function(data){
if (data === undefined) {
return data;
}
@olivier-schmitt
olivier-schmitt / gist:5118406
Created March 8, 2013 17:54
Underscore.js template using new syntax
<script type="text/template" id="item-template">
<div class="view">
<input class="toggle" type="checkbox" {{ done ? 'checked="checked"' : '' }} />
<label>{{ title }}</label>
<a class="destroy"></a>
</div>
<input class="edit" type="text" value="{{ title }}" />
</script>
@olivier-schmitt
olivier-schmitt / gist:5118322
Created March 8, 2013 17:46
New template settings JSP/JSP compliant
_.templateSettings = {
interpolate: /\{\{(.+?)\}\}/gim,
evaluate: /\{\{(.+?)\}\}/gim,
escape: /\{\{\-(.+?)\}\}/gim
};
@olivier-schmitt
olivier-schmitt / gist:5118259
Last active December 14, 2015 16:49
Sample template with invalid syntax for JSP/JSF compiler
<script type="text/template" id="item-template">
<div class="view">
<input class="toggle" type="checkbox" <%= done ? 'checked="checked"' : '' %> />
<label><%- title %></label>
<a class="destroy"></a>
</div>
<input class="edit" type="text" value="<%- title %>" />
</script>