Skip to content

Instantly share code, notes, and snippets.

@inancsevinc
inancsevinc / CookieFilter.java
Created April 12, 2012 13:24
JAX-RS client filter responsible for adding cookies(retrieved from springcontextholder) to the outgoing request
private ClientFilter cookieFilter = new ClientFilter() {
@Override
public ClientResponse handle(ClientRequest cr)
throws ClientHandlerException {
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder
.getRequestAttributes()).getRequest();
Cookie[] cookies = request.getCookies();
StringBuilder strBuilder = new StringBuilder();
if (cookies != null) {
@inancsevinc
inancsevinc / BooleanTypeHandler.java
Created April 12, 2012 13:29
BooleanTypeHandler for MyBatis
import java.sql.CallableStatement;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import org.apache.ibatis.type.BaseTypeHandler;
import org.apache.ibatis.type.JdbcType;
import org.apache.ibatis.type.MappedJdbcTypes;
import org.apache.ibatis.type.MappedTypes;
@inancsevinc
inancsevinc / junit_snippet_jndi.java
Created April 12, 2012 13:35
@BeforeClass method responsible for creating jndi datasource for oracle
@BeforeClass
public static void setUpClass() throws Exception {
try {
System.setProperty(Context.INITIAL_CONTEXT_FACTORY,
"org.apache.naming.java.javaURLContextFactory");
System.setProperty(Context.URL_PKG_PREFIXES, "org.apache.naming");
InitialContext ic = new InitialContext();
ic.createSubcontext("jdbc");
// Construct DataSource
OracleConnectionPoolDataSource ds = new OracleConnectionPoolDataSource();
@inancsevinc
inancsevinc / svn2cc.bat
Created April 12, 2012 14:01
Batch file for exporting subversion repository and checking in to clearcase
@echo off
SET CC_VOB_DIR=
SET CC_VIEW_TAG=
SET CC_COMPONENT_NAME=
SET CC_VOB_NAME=
SET TMP_SVN_EXPORT_DIR=
SET SVN_URL=
@echo deleting directory %TMP_SVN_EXPORT_DIR%
@inancsevinc
inancsevinc / rabbitmqJsonGenerator.html
Created May 11, 2012 11:25
RabbitMq Json Definitions Generator
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>RabbitMq Json Definitions Generator</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script type="text/javascript">
$(function(){
$('#generateBtn').on('click',function(){
var generatedQueues = ''
@inancsevinc
inancsevinc / simpleLiveSearch.html
Created May 16, 2012 09:20
Simple live search example
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title></title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script type="text/javascript">
$(function(){
var items = ['javascript','java','html','css','python','perl','c','c++'];
$.each(items,function(i,item){
$('#items').append($('<li>').text(item));
@inancsevinc
inancsevinc / orientationchange_camera.js
Created June 10, 2012 10:11
jQuery Mobile orientation change handler, using cordova camera api
$(window).on('orientationchange', function(event) {
if (event.orientation) {
if (event.orientation == 'portrait') {
//do something
} else if (event.orientation == 'landscape') {
navigator.camera.getPicture(onSuccess, onFail, {quality: 20});
}
}
);
@inancsevinc
inancsevinc / contactFind.js
Created June 10, 2012 11:52
Cordova contact find example
navigator.contacts.find(['*'], function(contacts) {
alert("number of contacts: " + contacts.length);
$.each(contacts, function(i, contact) {
alert('contact object: ' + JSON.stringify(contact));
});
}, function(contactError) {
alert(contactError);
}, {"multiple": true});
@inancsevinc
inancsevinc / clearcaseChangeFileType
Created June 14, 2012 11:09
Clearcase command for changing file type to overcome max 8000 char on a single line problem
>cleartool chtype compressed_file jquery-ui. min.js
Change version manager and reconstruct all versions for "jquery-ui.min.js"? [no] yes
Changed type of element "jquery-ui.min.js" to "compressed_file".
@inancsevinc
inancsevinc / nginx_subfilter_config
Created June 18, 2012 21:07
configuration example of HttpSubModule, replaces "__name__" in the response
server {
listen 80;
server_name localhost;
root D:/Development/public;
sub_filter_once off;
location / {
if ($uri ~* /(\w+)\.html$) {
set $filename "$1";