Skip to content

Instantly share code, notes, and snippets.

@fabrizioc1
fabrizioc1 / http-proxy.go
Last active October 27, 2020 12:32
Http proxy server in Go
package main
import (
"fmt"
"io"
"log"
"net/http"
)
type HttpConnection struct {
@fabrizioc1
fabrizioc1 / sql_profiler_wcde7.md
Created September 18, 2012 18:58
Installing RAD SQL Profiler in WebSphere Commerce Developer 7
@fabrizioc1
fabrizioc1 / NoCacheFilter.java
Created September 8, 2012 00:14
Servlet filter to skip cache in WebSphere Commerce
package com.fct.wcs.cache;
import java.io.IOException;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
@fabrizioc1
fabrizioc1 / ProxyServer.java
Created September 7, 2012 06:42
Simple Network Proxy
import java.io.*;
import java.net.*;
public class ProxyServer
{
/**
* Thread to handle a single client connection
* This way the server can handle other incoming requests
*/
public static class ClientHandler extends Thread
@fabrizioc1
fabrizioc1 / wcde_gitignore.rb
Created August 21, 2012 21:32
Create a .gitignore for WebSphere Commerce Developer
require 'find'
require 'set'
# Make sure to start in ENV['WCS_HOME']
entries = ['\.metadata/'] + Dir['*'].select{|file| File.directory?(file) }
extensions = Set.new
Find.find('.') do |path|
extensions << "*#{File.extname(path)}" unless FileTest.directory?(path)
end
@fabrizioc1
fabrizioc1 / cucumber_wcs_developer.md
Created August 4, 2012 01:04
Setting up WebSphere Commerce Developer to run Cucumber projects
  1. Maven Eclipse Plugin

1.1. Navigate in the RAD menu to the software update setup:

 Help -> Software Updates -> Available Software -> Add Site

1.2. Enter the following URL: http://m2eclipse.sonatype.org/sites/m2e-e34/

  1. Gherkin Syntax Highlighting
@fabrizioc1
fabrizioc1 / get_top_n_elements.rb
Created June 19, 2012 18:14
Get top n elements from ruby array of hash values
# I have an array where each element is a hash containing a few values and a count.
result = [
{"count" => 3,"name" => "user1"},
{"count" => 10,"name" => "user2"},
{"count" => 10, "user3"},
{"count" => 2, "user4"}
]
# I can sort the array by count as follows:
@fabrizioc1
fabrizioc1 / IE_cucumber.md
Created June 9, 2012 02:03
Run Cucumber with Internet Explorer 9, JRuby, and Windows 7 (64-bit)
  1. Enable protected mode on all security zones

    1.1. Click on the "Start" button

    1.2. Go to "Control Panel"

    1.3. Select "View by: Large Icons"

    1.4. Click on "Internet Options"

@fabrizioc1
fabrizioc1 / jruby_windows_color.txt
Created May 22, 2012 23:23
Getting colored output for Cucumber + JRuby + Windows 7 (64 bit) using ansicon.exe
Steps:
1. Download "https://github.com/downloads/adoxa/ansicon/ansi150.zip"
2. Copy the files under the "x64" directory to somewhere in your path, for example "c:\windows\system32"
3. Download "https://github.com/downloads/adoxa/ansicon/ansi6432.zip"
4. Copy the files under the "x64" directory to somewhere in your path, use the same location as step #2
This should overwrite ANSI32.DLL and ansicon.exe
5. Install ansicon by typing "ansicon -I" at a command prompt